mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-03 03:59:42 +00:00
community[patch]: Update root_validators ChatModels: ChatBaichuan, QianfanChatEndpoint, MiniMaxChat, ChatSparkLLM, ChatZhipuAI (#22853)
This PR updates root validators for: - ChatModels: ChatBaichuan, QianfanChatEndpoint, MiniMaxChat, ChatSparkLLM, ChatZhipuAI Issues #22819 --------- Co-authored-by: Eugene Yurtsev <eyurtsev@gmail.com>
This commit is contained in:
@@ -7,7 +7,7 @@ from langchain_community.chat_models.baichuan import ChatBaichuan
|
||||
|
||||
|
||||
def test_chat_baichuan_default() -> None:
|
||||
chat = ChatBaichuan(streaming=True)
|
||||
chat = ChatBaichuan(streaming=True) # type: ignore[call-arg]
|
||||
message = HumanMessage(content="请完整背诵将进酒,背诵5遍")
|
||||
response = chat.invoke([message])
|
||||
assert isinstance(response, AIMessage)
|
||||
@@ -15,7 +15,7 @@ def test_chat_baichuan_default() -> None:
|
||||
|
||||
|
||||
def test_chat_baichuan_default_non_streaming() -> None:
|
||||
chat = ChatBaichuan()
|
||||
chat = ChatBaichuan() # type: ignore[call-arg]
|
||||
message = HumanMessage(content="请完整背诵将进酒,背诵5遍")
|
||||
response = chat.invoke([message])
|
||||
assert isinstance(response, AIMessage)
|
||||
@@ -39,7 +39,7 @@ def test_chat_baichuan_turbo_non_streaming() -> 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")
|
||||
response = chat.invoke([message])
|
||||
assert isinstance(response, AIMessage)
|
||||
@@ -47,7 +47,7 @@ def test_chat_baichuan_with_temperature() -> None:
|
||||
|
||||
|
||||
def test_chat_baichuan_with_kwargs() -> None:
|
||||
chat = ChatBaichuan()
|
||||
chat = ChatBaichuan() # type: ignore[call-arg]
|
||||
message = HumanMessage(content="百川192K API是什么时候上线的?")
|
||||
response = chat.invoke(
|
||||
[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:
|
||||
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.top_p == 0.7
|
||||
assert chat.with_search_enhance is True
|
||||
|
@@ -107,7 +107,7 @@ def test_baichuan_key_masked_when_passed_from_env(
|
||||
"""Test initialization with an API key provided via an env variable"""
|
||||
monkeypatch.setenv("BAICHUAN_API_KEY", "test-api-key")
|
||||
|
||||
chat = ChatBaichuan()
|
||||
chat = ChatBaichuan() # type: ignore[call-arg]
|
||||
print(chat.baichuan_api_key, end="") # noqa: T201
|
||||
captured = capsys.readouterr()
|
||||
assert captured.out == "**********"
|
||||
|
Reference in New Issue
Block a user