Fix for versioned OpenAI instruct models (#10788)

Versioned OpenAI instruct models may end with numbers, e.g.
`gpt-3.5-turbo-instruct-0914`.

Fixes https://github.com/langchain-ai/langchainjs/issues/2669 in Python
pull/9890/head^2
Jacob Lee 11 months ago committed by GitHub
parent 73afd72e1d
commit 61cecf8b1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -198,7 +198,7 @@ class BaseOpenAI(BaseLLM):
model_name = data.get("model_name", "")
if (
model_name.startswith("gpt-3.5-turbo") or model_name.startswith("gpt-4")
) and not model_name.endswith("-instruct"):
) and "-instruct" not in model_name:
warnings.warn(
"You are trying to use a chat model. This way of initializing it is "
"no longer supported. Instead, please use: "

Loading…
Cancel
Save