结构化输出请求(Structured Outputs)
POST
http://localhost:11434/api/generate
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'http://localhost:11434/api/generate' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "string",
"prompt": "string",
"stream": true,
"format": {
"type": "string",
"properties": {
"age": {
"type": "string"
},
"available": {
"type": "string"
}
},
"required": [
"string"
]
}
}'
响应示例响应示例
{
"model": "llama3.1:8b",
"created_at": "2024-12-06T00:48:09.983619Z",
"response": "{\n \"age\": 22,\n \"available\": true\n}",
"done": true,
"done_reason": "stop",
"context": [
1,
2,
3
],
"total_duration": 1075509083,
"load_duration": 567678166,
"prompt_eval_count": 28,
"prompt_eval_duration": 236000000,
"eval_count": 16,
"eval_duration": 269000000
}
请求参数
Header 参数
Content-Type
string
必需
示例值:
application/json
Body 参数application/json
返回响应
修改于 2025-03-17 08:11:00