Allow 3.5-turbo instruct models in the OpenAI LLM class (#10750)

@baskaryan @hwchase17
pull/10751/head
Jacob Lee 11 months ago committed by GitHub
parent 4c80978ec6
commit 579d14fbc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -196,7 +196,9 @@ class BaseOpenAI(BaseLLM):
def __new__(cls, **data: Any) -> Union[OpenAIChat, BaseOpenAI]: # type: ignore
"""Initialize the OpenAI object."""
model_name = data.get("model_name", "")
if model_name.startswith("gpt-3.5-turbo") or model_name.startswith("gpt-4"):
if (
model_name.startswith("gpt-3.5-turbo") or model_name.startswith("gpt-4")
) and not model_name.endswith("-instruct"):
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