get_openai_callback() does not show the cost taken for gpt4o-mini model #26847
Replies: 1 comment
-
Hey @AarthiAlagammai! I'm here to help you with any bugs, questions, or contributions you have regarding LangChain. Let's tackle this together! The Here is the relevant part of the def standardize_model_name(
model_name: str,
is_completion: bool = False,
) -> str:
"""
Standardize the model name to a format that can be used in the OpenAI API.
Args:
model_name: Model name to standardize.
is_completion: Whether the model is used for completion or not.
Defaults to False.
Returns:
Standardized model name.
"""
model_name = model_name.lower()
if ".ft-" in model_name:
model_name = model_name.split(".ft-")[0] + "-azure-finetuned"
if ":ft-" in model_name:
model_name = model_name.split(":")[0] + "-finetuned-legacy"
if "ft:" in model_name:
model_name = model_name.split(":")[1] + "-finetuned"
if is_completion and (
model_name.startswith("gpt-4")
or model_name.startswith("gpt-3.5")
or model_name.startswith("gpt-35")
or model_name.startswith("o1-")
or ("finetuned" in model_name and "legacy" not in model_name)
):
return model_name + "-completion"
else:
return model_name To resolve this issue, the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Checked other resources
Commit to Help
Example Code
Description
get_openai_callback() does not show the cost taken for gpt4o-mini model
System Info
pip freeze|grep langchain
langchain==0.3.0
Beta Was this translation helpful? Give feedback.
All reactions