mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-23 07:09:31 +00:00
community[patch]: fix cost calculations for o3 in OpenAI callback (#30807)
Resolves https://github.com/langchain-ai/langchain/issues/30795
This commit is contained in:
parent
446361a0d3
commit
f005988e31
@ -218,12 +218,17 @@ def standardize_model_name(
|
||||
or model_name.startswith("gpt-3.5")
|
||||
or model_name.startswith("gpt-35")
|
||||
or model_name.startswith("o1-")
|
||||
or model_name.startswith("o3-")
|
||||
or ("finetuned" in model_name and "legacy" not in model_name)
|
||||
):
|
||||
return model_name + "-completion"
|
||||
if (
|
||||
token_type == TokenType.PROMPT_CACHED
|
||||
and (model_name.startswith("gpt-4o") or model_name.startswith("o1"))
|
||||
and (
|
||||
model_name.startswith("gpt-4o")
|
||||
or model_name.startswith("o1")
|
||||
or model_name.startswith("o3")
|
||||
)
|
||||
and not (model_name.startswith("gpt-4o-2024-05-13"))
|
||||
):
|
||||
return model_name + "-cached"
|
||||
|
Loading…
Reference in New Issue
Block a user