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

fix: add missing hardcodings for popular OpenAI models #1863

Merged
merged 1 commit into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions letta/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,27 @@
LLM_MAX_TOKENS = {
"DEFAULT": 8192,
## OpenAI models: https://platform.openai.com/docs/models/overview
# "o1-preview
sarahwooders marked this conversation as resolved.
Show resolved Hide resolved
"chatgpt-4o-latest": 128000,
# "o1-preview-2024-09-12
"gpt-4o-2024-08-06": 128000,
"gpt-4-turbo-preview": 128000,
"gpt-4o": 128000,
"gpt-3.5-turbo-instruct": 16385,
"gpt-4-0125-preview": 128000,
"gpt-3.5-turbo-0125": 16385,
# "babbage-002": 128000,
# "davinci-002": 128000,
"gpt-4-turbo-2024-04-09": 128000,
# "gpt-4o-realtime-preview-2024-10-01
"gpt-4-turbo": 8192,
"gpt-4o-2024-05-13": 128000,
# "o1-mini
# "o1-mini-2024-09-12
# "gpt-3.5-turbo-instruct-0914
"gpt-4o-mini": 128000,
# "gpt-4o-realtime-preview
"gpt-4o-mini-2024-07-18": 128000,
# gpt-4
"gpt-4-1106-preview": 128000,
"gpt-4": 8192,
Expand Down
6 changes: 6 additions & 0 deletions letta/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ def list_llm_models(self) -> List[LLMConfig]:
configs.append(
LLMConfig(model=model_name, model_endpoint_type="openai", model_endpoint=self.base_url, context_window=context_window_size)
)

# for OpenAI, sort in reverse order
if self.base_url == "https://api.openai.com/v1":
# alphnumeric sort
configs.sort(key=lambda x: x.model, reverse=True)

return configs

def list_embedding_models(self) -> List[EmbeddingConfig]:
Expand Down
Loading