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

add gpt-4o-mini and add token notification for gpt-4o and 4o-mini #689

Closed
wants to merge 1 commit into from
Closed
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
15 changes: 15 additions & 0 deletions vocode/streaming/agent/token_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"gpt-4-turbo": 127940,
"gpt-4o": 127940,
"gpt-4o-2024-05-13": 127940,
"gpt-4o-mini":127940,
}


Expand All @@ -83,6 +84,8 @@ def get_chat_gpt_max_tokens(model_name: str):
def get_tokenizer_info(model: str) -> Optional[TokenizerInfo]:
if "gpt-35-turbo" in model:
model = "gpt-3.5-turbo"
elif "gpt-4o-mini" in model:
model = "gpt-4o-mini"
elif "gpt-4o" == model:
model = "gpt-4o"
elif "gpt4" in model or "gpt-4" in model:
Expand Down Expand Up @@ -111,6 +114,18 @@ def get_tokenizer_info(model: str) -> Optional[TokenizerInfo]:
)
tokens_per_message = 3
tokens_per_name = 1
elif "gpt-4o-mini" in model:
logger.debug(
"Warning: gpt-4o-mini may update over time. Returning num tokens assuming gpt-4o-mini-2024-07-18."
)
tokens_per_message = 3
tokens_per_name = 1
elif "gpt-4o" in model:
logger.debug(
"Warning: gpt-4o may update over time. Returning num tokens assuming gpt-4o-2024-05-13"
)
tokens_per_message = 3
tokens_per_name = 1
elif "gpt-4" in model:
logger.debug(
"Warning: gpt-4 may update over time. Returning num tokens assuming gpt-4-0613."
Expand Down
1 change: 1 addition & 0 deletions vocode/streaming/models/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
OPENAI_GPT_4_MODEL_NAME = "gpt-4"
OPENAI_GPT_4_32K_MODEL_NAME = "gpt-4-32k"
OPENAI_GPT_4_O_MODEL_NAME = "gpt-4o"
OPENAI_GPT_4_O_MINI_MODEL_NAME = "gpt-4o-mini"
OPENAI_GPT_35_TURBO_1106_MODEL_NAME = "gpt-3.5-turbo-1106"
OPENAI_GPT_4_1106_PREVIEW_MODEL_NAME = "gpt-4-1106-preview"
ANTHROPIC_CLAUDE_3_HAIKU_MODEL_NAME = "claude-3-haiku-20240307"
Expand Down