2023-07-17 14:27:17 +00:00
|
|
|
"""Test ChatGLM API wrapper."""
|
2023-11-21 16:35:29 +00:00
|
|
|
from langchain_core.outputs import LLMResult
|
2023-11-20 21:09:30 +00:00
|
|
|
|
2023-12-11 21:53:30 +00:00
|
|
|
from langchain_community.llms.chatglm import ChatGLM
|
2023-07-17 14:27:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_chatglm_call() -> None:
|
|
|
|
"""Test valid call to chatglm."""
|
|
|
|
llm = ChatGLM()
|
|
|
|
output = llm("北京和上海这两座城市有什么不同?")
|
|
|
|
assert isinstance(output, str)
|
|
|
|
|
|
|
|
|
|
|
|
def test_chatglm_generate() -> None:
|
|
|
|
"""Test valid call to chatglm."""
|
|
|
|
llm = ChatGLM()
|
|
|
|
output = llm.generate(["who are you"])
|
|
|
|
assert isinstance(output, LLMResult)
|
|
|
|
assert isinstance(output.generations, list)
|