import os
os.environ["ZHIPU_API_KEY"] = "your-zhipu-api-key"
from unionllm import unionchat
# model call
response = unionchat(
provider="zhipuai",
model="glm-4",
messages = [{ "content": "Hello, how are you?","role": "user"}],
stream=False
)
print(response)
from unionllm import unionchat
# model call
response = unionchat(
provider="zhipuai",
model="glm-4",
messages = [{ "content": "Hello, how are you?","role": "user"}],
stream=True
)
for chunk in response:
print(chunk)
# model call
response = unionchat(
provider="zhipuai",
model="glm-4",
api_key="your-zhipu-api-key",
messages = [{ "content": "Hello, how are you?","role": "user"}]
)
支持天工的所有文本模型
参考文档: