文本生成
ChatGLM / GLM 文本生成适合中文问答、写作、总结、改写、分类、抽取、客服回复和知识库问答。
基础文本生成
json
{
"model": "glm-5.1-air",
"messages": [
{ "role": "user", "content": "Write a product description in fewer than 100 words" }
]
}中文客服
json
{
"model": "glm-5.1-air",
"messages": [
{
"role": "system",
"content": "You are an enterprise support assistant. Be polite and concise, and do not promise unverified information."
},
{
"role": "user",
"content": "The user says a top-up has not arrived. Draft a reply."
}
]
}分类与抽取
json
{
"model": "glm-5-flash",
"temperature": 0,
"messages": [
{
"role": "user",
"content": "Classify the text as complaint, inquiry, or praise. Text: I paid, but the order has not arrived."
}
]
}最佳实践
- 中文问答优先测试 GLM-5 系列
- 批量任务测试 turbo 或 flash 模型
- 分类和抽取降低
temperature - 长文档先切分再总结
- 输出 JSON 时配合服务端校验