结构化输出对话请求(Structured Outputs)
POST
http://localhost:11434/api/chat
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'http://localhost:11434/api/chat' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "string",
"messages": [
{
"role": "string",
"content": "string"
}
],
"stream": true,
"format": {
"type": "string",
"properties": {
"age": {
"type": "string"
},
"available": {
"type": "string"
}
},
"required": [
"string"
]
},
"options": {
"temperature": 0
}
}'
响应示例响应示例
{
"model": "llama3.1",
"created_at": "2024-12-06T00:46:58.265747Z",
"message": {
"role": "assistant",
"content": "{\"age\": 22, \"available\": false}"
},
"done_reason": "stop",
"done": true,
"total_duration": 2254970291,
"load_duration": 574751416,
"prompt_eval_count": 34,
"prompt_eval_duration": 1502000000,
"eval_count": 12,
"eval_duration": 175000000
}
请求参数
Header 参数
Content-Type
string
必需
示例值:
application/json
Body 参数application/json