简单示例
POST
https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions
system message
提供文档信息时,建议同时设置一个正常role-play的system message,如默认的 “You are a helpful assistant.”,角色设定会对文档的处理效果产生影响,因此建议在消息中明确设定自己的角色。请求示例请求示例
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": "qwen-long",
"messages": [
{"role": "system","content": "You are a helpful assistant."},
{"role": "system","content": "fileid://file-fe-xxx"},
{"role": "user","content": "这篇文章讲了什么?"}
],
"stream": true,
"stream_options": {
"include_usage": true
}
}'
响应示例响应示例
{}
请求参数
Header 参数
Authorization
string
必需
示例值:
Bearer {{DASHSCOPE_API_KEY}}
Content-Type
string
必需
示例值:
application/json
Body 参数application/json