GPT-4 support (#1778)

This commit is contained in:
Nils Durner 2023-03-19 17:29:44 +01:00 committed by GitHub
parent 3d6fcb85dc
commit 3161ced4bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -163,7 +163,8 @@ class BaseOpenAI(BaseLLM, BaseModel):
def __new__(cls, **data: Any) -> Union[OpenAIChat, BaseOpenAI]: # type: ignore
"""Initialize the OpenAI object."""
if data.get("model_name", "").startswith("gpt-3.5-turbo"):
model_name = data.get("model_name", "")
if model_name.startswith("gpt-3.5-turbo") or model_name.startswith("gpt-4"):
return OpenAIChat(**data)
return super().__new__(cls)