mirror of
https://github.com/kennethreitz/langchain.git
synced 2026-06-05 23:00:18 +00:00
fa0a9e502a
Description: Add LLM for ChatGLM-6B & ChatGLM2-6B API Related Issue: Will the langchain support ChatGLM? #4766 Add support for selfhost models like ChatGLM or transformer models #1780 Dependencies: No extra library install required. It wraps api call to a ChatGLM(2)-6B server(start with api.py), so api endpoint is required to run. Tag maintainer: @mlot Any comments on this PR would be appreciated. --------- Co-authored-by: mlot <limpo2000@gmail.com> Co-authored-by: Bagatur <baskaryan@gmail.com>
19 lines
540 B
Python
19 lines
540 B
Python
"""Test ChatGLM API wrapper."""
|
|
from langchain.llms.chatglm import ChatGLM
|
|
from langchain.schema import LLMResult
|
|
|
|
|
|
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)
|