|
|
@ -7,7 +7,7 @@ from langchain_community.chat_models.baichuan import ChatBaichuan
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_chat_baichuan_default() -> None:
|
|
|
|
def test_chat_baichuan_default() -> None:
|
|
|
|
chat = ChatBaichuan(streaming=True)
|
|
|
|
chat = ChatBaichuan(streaming=True) # type: ignore[call-arg]
|
|
|
|
message = HumanMessage(content="请完整背诵将进酒,背诵5遍")
|
|
|
|
message = HumanMessage(content="请完整背诵将进酒,背诵5遍")
|
|
|
|
response = chat.invoke([message])
|
|
|
|
response = chat.invoke([message])
|
|
|
|
assert isinstance(response, AIMessage)
|
|
|
|
assert isinstance(response, AIMessage)
|
|
|
@ -15,7 +15,7 @@ def test_chat_baichuan_default() -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_chat_baichuan_default_non_streaming() -> None:
|
|
|
|
def test_chat_baichuan_default_non_streaming() -> None:
|
|
|
|
chat = ChatBaichuan()
|
|
|
|
chat = ChatBaichuan() # type: ignore[call-arg]
|
|
|
|
message = HumanMessage(content="请完整背诵将进酒,背诵5遍")
|
|
|
|
message = HumanMessage(content="请完整背诵将进酒,背诵5遍")
|
|
|
|
response = chat.invoke([message])
|
|
|
|
response = chat.invoke([message])
|
|
|
|
assert isinstance(response, AIMessage)
|
|
|
|
assert isinstance(response, AIMessage)
|
|
|
@ -39,7 +39,7 @@ def test_chat_baichuan_turbo_non_streaming() -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_chat_baichuan_with_temperature() -> None:
|
|
|
|
def test_chat_baichuan_with_temperature() -> None:
|
|
|
|
chat = ChatBaichuan(temperature=1.0)
|
|
|
|
chat = ChatBaichuan(temperature=1.0) # type: ignore[call-arg]
|
|
|
|
message = HumanMessage(content="Hello")
|
|
|
|
message = HumanMessage(content="Hello")
|
|
|
|
response = chat.invoke([message])
|
|
|
|
response = chat.invoke([message])
|
|
|
|
assert isinstance(response, AIMessage)
|
|
|
|
assert isinstance(response, AIMessage)
|
|
|
@ -47,7 +47,7 @@ def test_chat_baichuan_with_temperature() -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_chat_baichuan_with_kwargs() -> None:
|
|
|
|
def test_chat_baichuan_with_kwargs() -> None:
|
|
|
|
chat = ChatBaichuan()
|
|
|
|
chat = ChatBaichuan() # type: ignore[call-arg]
|
|
|
|
message = HumanMessage(content="百川192K API是什么时候上线的?")
|
|
|
|
message = HumanMessage(content="百川192K API是什么时候上线的?")
|
|
|
|
response = chat.invoke(
|
|
|
|
response = chat.invoke(
|
|
|
|
[message], temperature=0.88, top_p=0.7, with_search_enhance=True
|
|
|
|
[message], temperature=0.88, top_p=0.7, with_search_enhance=True
|
|
|
@ -58,7 +58,7 @@ def test_chat_baichuan_with_kwargs() -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_extra_kwargs() -> None:
|
|
|
|
def test_extra_kwargs() -> None:
|
|
|
|
chat = ChatBaichuan(temperature=0.88, top_p=0.7, with_search_enhance=True)
|
|
|
|
chat = ChatBaichuan(temperature=0.88, top_p=0.7, with_search_enhance=True) # type: ignore[call-arg]
|
|
|
|
assert chat.temperature == 0.88
|
|
|
|
assert chat.temperature == 0.88
|
|
|
|
assert chat.top_p == 0.7
|
|
|
|
assert chat.top_p == 0.7
|
|
|
|
assert chat.with_search_enhance is True
|
|
|
|
assert chat.with_search_enhance is True
|
|
|
|