You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched the LangChain documentation with the integrated search.
I used the GitHub search to find a similar question and didn't find it.
I am sure that this is a bug in LangChain rather than my code.
The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
defstandardize_model_name(
model_name: str,
is_completion: bool=False,
*,
token_type: TokenType=TokenType.PROMPT,
) ->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. Deprecated in favor of ``token_type``. token_type: Token type. Defaults to ``TokenType.PROMPT``. Returns: Standardized model name. """ifis_completion:
warn_deprecated(
since="0.3.13",
message=(
"is_completion is deprecated. Use token_type instead. Example:\n\n""from langchain_community.callbacks.openai_info import TokenType\n\n""standardize_model_name('gpt-4o', token_type=TokenType.COMPLETION)\n"
),
removal="1.0",
)
token_type=TokenType.COMPLETIONmodel_name=model_name.lower()
if".ft-"inmodel_name:
model_name=model_name.split(".ft-")[0] +"-azure-finetuned"if":ft-"inmodel_name:
model_name=model_name.split(":")[0] +"-finetuned-legacy"if"ft:"inmodel_name:
model_name=model_name.split(":")[1] +"-finetuned"iftoken_type==TokenType.COMPLETIONand (
model_name.startswith("gpt-4")
ormodel_name.startswith("gpt-3.5")
ormodel_name.startswith("gpt-35")
ormodel_name.startswith("o1-")
or ("finetuned"inmodel_nameand"legacy"notinmodel_name)
):
returnmodel_name+"-completion"if (
token_type==TokenType.PROMPT_CACHEDand (model_name.startswith("gpt-4o") ormodel_name.startswith("o1"))
andnot (model_name.startswith("gpt-4o-2024-05-13"))
):
returnmodel_name+"-cached"else:
returnmodel_name
Error Message and Stack Trace (if applicable)
No response
Description
langchain==0.3.17
langchain-community==0.3.16
langchain-openai==0.3.3
langchain-core==0.3.33
openai==1.61.0
System Info
System Information
OS: Darwin
OS Version: Darwin Kernel Version 24.1.0: Thu Oct 10 21:06:23 PDT 2024; root:xnu-11215.41.3~3/RELEASE_ARM64_T8132
Python Version: 3.9.6 (default, Oct 4 2024, 08:01:31)
[Clang 16.0.0 (clang-1600.0.26.4)]
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
No response
Description
System Info
System Information
Package Information
Optional packages not installed
Other Dependencies
The text was updated successfully, but these errors were encountered: