Add temperature to ChatOpenAI (#2152)

Just add `temperature` parameter to ChatOpenAI class.


https://python.langchain.com/en/latest/getting_started/getting_started.html#building-a-language-model-application-chat-models
There are descriptions like `chat = ChatOpenAI(temperature=0)` in the
documents, but it is confusing because it is not supported as an
explicit parameter.
This commit is contained in:
Shota Terashita 2023-03-30 05:04:44 +09:00 committed by GitHub
parent 8b91a21e37
commit 09085c32e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -110,6 +110,8 @@ class ChatOpenAI(BaseChatModel, BaseModel):
client: Any #: :meta private:
model_name: str = "gpt-3.5-turbo"
"""Model name to use."""
temperature: float = 0.7
"""What sampling temperature to use."""
model_kwargs: Dict[str, Any] = Field(default_factory=dict)
"""Holds any model parameters valid for `create` call not explicitly specified."""
openai_api_key: Optional[str] = None