mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-28 10:39:23 +00:00
- `llm(prompt)` -> `llm.invoke(prompt)` - `llm(prompt=prompt` -> `llm.invoke(prompt)` (same with `messages=`) - `llm(prompt, callbacks=callbacks)` -> `llm.invoke(prompt, config={"callbacks": callbacks})` - `llm(prompt, **kwargs)` -> `llm.invoke(prompt, **kwargs)`
20 lines
564 B
Python
20 lines
564 B
Python
"""Test ChatGLM API wrapper."""
|
|
from langchain_core.outputs import LLMResult
|
|
|
|
from langchain_community.llms.chatglm import ChatGLM
|
|
|
|
|
|
def test_chatglm_call() -> None:
|
|
"""Test valid call to chatglm."""
|
|
llm = ChatGLM()
|
|
output = llm.invoke("北京和上海这两座城市有什么不同?")
|
|
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)
|