mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-02 11:39:18 +00:00
baichuan[patch]:standardize chat init args (#21298)
Thank you for contributing to LangChain! community:baichuan[patch]: standardize init args updated `baichuan_api_key` so that aliased to `api_key`. Added test that it continues to set the same underlying attribute. Test checks for `SecretStr` updated `temperature` with Pydantic Field, added unit test. Related to https://github.com/langchain-ai/langchain/issues/20085
This commit is contained in:
@@ -89,7 +89,7 @@ class ChatBaichuan(BaseChatModel):
|
||||
|
||||
baichuan_api_base: str = Field(default=DEFAULT_API_BASE)
|
||||
"""Baichuan custom endpoints"""
|
||||
baichuan_api_key: Optional[SecretStr] = None
|
||||
baichuan_api_key: Optional[SecretStr] = Field(default=None, alias="api_key")
|
||||
"""Baichuan API Key"""
|
||||
baichuan_secret_key: Optional[SecretStr] = None
|
||||
"""[DEPRECATED, keeping it for for backward compatibility] Baichuan Secret Key"""
|
||||
@@ -100,7 +100,7 @@ class ChatBaichuan(BaseChatModel):
|
||||
model = "Baichuan2-Turbo-192K"
|
||||
"""model name of Baichuan, default is `Baichuan2-Turbo-192K`,
|
||||
other options include `Baichuan2-Turbo`"""
|
||||
temperature: float = 0.3
|
||||
temperature: Optional[float] = Field(default=0.3)
|
||||
"""What sampling temperature to use."""
|
||||
top_k: int = 5
|
||||
"""What search sampling control to use."""
|
||||
|
Reference in New Issue
Block a user