Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formalize Language Model Information Management. #432

Merged
merged 1 commit into from
Feb 12, 2025

Conversation

copybara-service[bot]
Copy link

@copybara-service copybara-service bot commented Feb 11, 2025

Formalize Language Model Information Management.

This CL introduces lf.ModelInfo as a standardized contract for managing language model information. It encapsulates key LLM capabilities, including context length, multimodal support, pricing, and rate limits. Detailed information about each LLM can be accessed via the lf.LanguageModel.model_info property.

Additionally, we introduce two new class methods:

  • lf.LanguageModel.dir(), which lists all available LLMs in Langfun.
  • lf.LanguageModel.get(name), which allows instantiation of any LLM by name.

For example:

lm = lf.LanguageModel.get('gemini-1.5-pro', temperature=1.0, timeout=None)

or

lm = lf.LanguageModel.get('gpt-4o')

Besides,we apply a consistent class name conventions to well-known LLMs.
For example: Gpt35Turbo, Claude35Sonnet, Gemini15Pro.

@copybara-service copybara-service bot force-pushed the test_724599567 branch 2 times, most recently from 80b97aa to 7e76c24 Compare February 11, 2025 19:40
@copybara-service copybara-service bot changed the title Introduce lf.ModelInfo. Formalize Language Model Information Management. Feb 11, 2025
@copybara-service copybara-service bot force-pushed the test_724599567 branch 3 times, most recently from 9c3d387 to abab906 Compare February 12, 2025 04:59
This CL introduces `lf.ModelInfo` as a standardized contract for managing language model information. It encapsulates key LLM capabilities, including context length, multimodal support, pricing, and rate limits. Detailed information about each LLM can be accessed via the `lf.LanguageModel.model_info` property.

Additionally, we introduce two new class methods:

- `lf.LanguageModel.dir()`, which lists all available LLMs in Langfun.
- `lf.LanguageModel.get(name)`, which allows instantiation of any LLM by name.

For example:
```
lm = lf.LanguageModel.get('gemini-1.5-pro', temperature=1.0, timeout=None)
```
or
```
lm = lf.LanguageModel.get('gpt-4o')
```
Besides,we apply a consistent class name conventions to well-known LLMs.
For example: `Gpt35Turbo`, `Claude35Sonnet`, `Gemini15Pro`.
PiperOrigin-RevId: 725890159
@copybara-service copybara-service bot merged commit 2ae17d3 into main Feb 12, 2025
1 check passed
@copybara-service copybara-service bot deleted the test_724599567 branch February 12, 2025 05:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant