Skip to content

The agent engineering platform.

community[patch]: Add test case for MoonshotChat (#24960)

ZhangShenao71c0564c9f8d
diff --git a/libs/community/tests/integration_tests/chat_models/test_moonshot.py b/libs/community/tests/integration_tests/chat_models/test_moonshot.py
new file mode 100644
index 0000000000..a44b485716
--- /dev/null
+++ b/libs/community/tests/integration_tests/chat_models/test_moonshot.py
@@ -0,0 +1,36 @@
+"""Test Moonshot Chat Model."""
+
+from langchain_core.messages import AIMessage, BaseMessage, HumanMessage
+
+from langchain_community.chat_models.moonshot import MoonshotChat
+
+
+def test_default_call() -> None:
+ """Test default model call."""
+ chat = MoonshotChat() # type: ignore[call-arg]
+ response = chat.invoke([HumanMessage(content="How are you?")])
+ assert isinstance(response, BaseMessage)
+ assert isinstance(response.content, str)
+
+
+def test_model() -> None:
+ """Test model kwarg works."""
+ chat = MoonshotChat(model="moonshot-v1-32k") # type: ignore[call-arg]
+ response = chat.invoke([HumanMessage(content="How are you?")])
+ assert isinstance(response, BaseMessage)
+ assert isinstance(response.content, str)
+
+
+def test_multiple_history() -> None:
+ """Tests multiple history works."""
+ chat = MoonshotChat() # type: ignore[call-arg]
+
+ response = chat.invoke(
+ [
+ HumanMessage(content="How are you?"),
+ AIMessage(content="I'm fine, and you?"),
+ HumanMessage(content="Not bad!"),
+ ]
+ )
+ assert isinstance(response, BaseMessage)
+ assert isinstance(response.content, str)
diff --git a/libs/community/tests/integration_tests/chat_models/test_zhipuai.py b/libs/community/tests/integration_tests/chat_models/test_zhipuai.py
index 1f6c4e9af8..5750705eab 100644
--- a/libs/community/tests/integration_tests/chat_models/test_zhipuai.py
+++ b/libs/community/tests/integration_tests/chat_models/test_zhipuai.py
@@ -1,4 +1,4 @@
-"""Test Alibaba Tongyi Chat Model."""
+"""Test ZhipuAI Chat Model."""
from langchain_core.callbacks import CallbackManager
from langchain_core.messages import AIMessage, BaseMessage, HumanMessage