mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-30 02:13:23 +00:00
community[patch]: standardize baichuan init args (#20209)
Related to https://github.com/langchain-ai/langchain/issues/20085 @baskaryan
This commit is contained in:
parent
cd7abc495a
commit
97d91ec17c
@ -95,7 +95,7 @@ class ChatBaichuan(BaseChatModel):
|
||||
"""[DEPRECATED, keeping it for for backward compatibility] Baichuan Secret Key"""
|
||||
streaming: bool = False
|
||||
"""Whether to stream the results or not."""
|
||||
request_timeout: int = 60
|
||||
request_timeout: int = Field(default=60, alias="timeout")
|
||||
"""request timeout for chat http requests"""
|
||||
model = "Baichuan2-Turbo-192K"
|
||||
"""model name of Baichuan, default is `Baichuan2-Turbo-192K`,
|
||||
|
@ -21,6 +21,23 @@ from langchain_community.chat_models.baichuan import (
|
||||
)
|
||||
|
||||
|
||||
def test_initialization() -> None:
|
||||
"""Test chat model initialization."""
|
||||
|
||||
for model in [
|
||||
ChatBaichuan(
|
||||
model="Baichuan2-Turbo-192K", baichuan_api_key="test-api-key", timeout=40
|
||||
),
|
||||
ChatBaichuan(
|
||||
model="Baichuan2-Turbo-192K",
|
||||
baichuan_api_key="test-api-key",
|
||||
request_timeout=40,
|
||||
),
|
||||
]:
|
||||
assert model.model == "Baichuan2-Turbo-192K"
|
||||
assert model.request_timeout == 40
|
||||
|
||||
|
||||
def test__convert_message_to_dict_human() -> None:
|
||||
message = HumanMessage(content="foo")
|
||||
result = _convert_message_to_dict(message)
|
||||
|
Loading…
Reference in New Issue
Block a user