Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 80 additions & 4 deletions docs/features/reasoning_output.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
Reasoning models return an additional `reasoning_content` field in their output, which contains the reasoning steps that led to the final conclusion.

## Supported Models
| Model Name | Parser Name | Eable_thinking by Default |
|----------------|----------------|---------------------------|
| baidu/ERNIE-4.5-VL-424B-A47B-Paddle | ernie-45-vl | ✓ |
| baidu/ERNIE-4.5-VL-28B-A3B-Paddle | ernie-45-vl | ✓ |
| Model Name | Parser Name | Eable_thinking by Default | Tool Calling |
|---------------|-------------|---------|---------|
| 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 | ✅ no off supported | ✅|

The reasoning model requires a specified parser to extract reasoning content. The reasoning mode can be disabled by setting the `"enable_thinking": false` parameter.

Expand Down Expand Up @@ -81,3 +82,78 @@ for chunk in chat_response:
print(chunk.choices[0].delta, end='')
print("\n")
```
## Tool Calling
The reasoning content is also available when both tool calling and the reasoning parser are enabled. Additionally, tool calling only parses functions from the `content` field, not from the `reasoning_content`.

Model request example:
```bash
curl -X POST "http://0.0.0.0:8390/v1/chat/completions" \
-H "Content-Type: application/json" \
-d '{
"messages": [
{
"role": "user",
"content": "Get the current weather in BeiJing"
}
],
"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
}'
```
Model output example

```json
{
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "",
"reasoning_content": "The user asks about ...",
"tool_calls": [
{
"id": "chatcmpl-tool-311b9bda34274722afc654c55c8ce6a0",
"type": "function",
"function": {
"name": "get_weather",
"arguments": "{\"location\": \"BeiJing\", \"unit\": \"c\"}"
}
}
]
},
"finish_reason": "tool_calls"
}
]
}
```
More reference documentation related to tool calling usage: [Tool Calling](./tool_calling.md)
82 changes: 78 additions & 4 deletions docs/zh/features/reasoning_output.md
Original file line number Diff line number Diff line change
Expand Up @@ -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` 参数可以关闭模型思考模式.

Expand Down Expand Up @@ -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)
Loading