[Docs] Improve reasoning_out docs (#4901)

* [Docs] Improve reasoning_out docs

* [Docs] Improve reasoning_out docs

* [Docs] Improve reasoning_out docs

---------

Co-authored-by: liqinrui <liqinrui@baidu.com>
This commit is contained in:
LiqinruiG
2025-11-10 19:20:38 +08:00
committed by GitHub
parent 07b21d241d
commit aa79e6185a
2 changed files with 158 additions and 8 deletions

View File

@@ -5,10 +5,11 @@
思考模型在输出中返回 `reasoning_content` 字段,表示思考链内容,即得出最终结论的思考步骤.
##目前支持思考链的模型
| 模型名称 | 解析器名称 | 默认开启思考链 |
|---------------|-------------|---------|
| baidu/ERNIE-4.5-VL-424B-A47B-Paddle | ernie-45-vl | |
| baidu/ERNIE-4.5-VL-28B-A3B-Paddle | ernie-45-vl | |
| 模型名称 | 解析器名称 | 默认开启思考链 | 工具调用 |
|---------------|-------------|---------|---------|
| baidu/ERNIE-4.5-VL-424B-A47B-Paddle | ernie-45-vl | | ❌ |
| baidu/ERNIE-4.5-VL-28B-A3B-Paddle | ernie-45-vl | ✅ | ❌ |
| baidu/ERNIE-4.5-21B-A3B-Thinking | ernie-x1 | ✅不支持关思考 | ✅|
思考模型需要指定解析器,以便于对思考内容进行解析. 通过 `"enable_thinking": false` 参数可以关闭模型思考模式.
@@ -83,3 +84,76 @@ for chunk in chat_response:
print("\n")
```
## 工具调用
如果模型支持工具调用, 可以同时启动模型回复内容的思考链解析 `reasoning_content` 及工具解析 `tool-call-parser`。 工具内容仅从模型回复内容 `content` 中进行解析,而不会影响思考链内容。
例如,
```bash
curl -X POST "http://0.0.0.0:8390/v1/chat/completions" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"role": "user",
"content": "北京今天天气怎么样?"
}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Determine weather in my location",
"parameters": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state e.g. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"c",
"f"
]
}
},
"additionalProperties": false,
"required": [
"location",
"unit"
]
},
"strict": true
}
}],
"stream": false
}'
```
返回结果示例如下:
```json
{
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "",
"reasoning_content": "用户问的是..",
"tool_calls": [
{
"id": "chatcmpl-tool-311b9bda34274722afc654c55c8ce6a0",
"type": "function",
"function": {
"name": "get_weather",
"arguments": "{\"location\": \"北京\", \"unit\": \"c\"}"
}
}
]
},
"finish_reason": "tool_calls"
}
]
}
```
更多工具调用相关的使用参考文档 [Tool Calling](./tool_calling.md)