zxr615
9 天前
用 tools,限制返回的 Json 结构,在请求中指定定义结构:
``` json
{
"tools": [
{
"type": "function",
"function": {
"name": "generateContent",
"parameters": {
"type": "object",
"properties": {
"filed_1": {
"type": "string",
"description": "这是要返回的字段 1"
},
"filed_2": {
"type": "string",
"description": "这是要返回的字段 2"
}
}
},
"required": [
"filed_1",
"filed_2"
]
}
}
],
"tool_choice": {
"type": "function",
"function": {
"name": "generateContent"
}
}
}
```