From 61cecf8b1b5d8708f4a8f418c4be759c33c8b59f Mon Sep 17 00:00:00 2001 From: Jacob Lee Date: Tue, 19 Sep 2023 15:50:06 -0700 Subject: [PATCH] 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 --- libs/langchain/langchain/llms/openai.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/langchain/langchain/llms/openai.py b/libs/langchain/langchain/llms/openai.py index 33b312a5da..b494ea48da 100644 --- a/libs/langchain/langchain/llms/openai.py +++ b/libs/langchain/langchain/llms/openai.py @@ -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: "