mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-22 14:49:29 +00:00
community[patch]: Add test case for MoonshotChat (#24960)
Add test case for `MoonshotChat`.
This commit is contained in:
parent
c65e48996c
commit
71c0564c9f
@ -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)
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user