多轮对话
POST
https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
reasoning_content
字段(思考过程)与content
(回复内容),您可以将content
字段通过{'role': 'assistant', 'content':拼接后的流式输出content}
添加到上下文,无需添加reasoning_content
字段。请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions' \
--header 'Authorization: Bearer {{DASHSCOPE_API_KEY}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "qwq-32b",
"messages": [
{
"role": "user",
"content": "你好"
},
{
"role": "assistant",
"content": "你好!很高兴见到你,有什么我可以帮忙的吗?"
},
{
"role": "user",
"content": "你是谁?"
}
],
"stream": true
}'
响应示例响应示例
{}
请求参数
Header 参数
Authorization
string
必需
示例值:
Bearer {{DASHSCOPE_API_KEY}}
Content-Type
string
必需
示例值:
application/json
Body 参数application/json