Code: invalid_request_error, HTTP Status: 400)
错误信息
The `reasoning_content` in the thinking mode must be passed back to the API. (Model Provider Error Code: invalid_request_error, HTTP Status: 400)
AI 解决方案
错误分析
1.错误翻译
原文:The `reasoning_content` in the thinking mode must be passed back to the API. (Model Provider Error Code: invalid_request_error, HTTP Status: 400)
译文:在思考模式下的 `reasoning_content` 必须被传回给API。(模型提供商错误码:invalid_request_error,HTTP状态码:400)
2. 原因分析
reasoning_content(推理过程)字段包含在请求体中。3决方案
修改您的API请求代码,在请求参数中包含
reasoning_content 字段。示例修复代码 (Python/HTTP请求):
import requests
import json
# 假设这是你从上一次API响应中获取的推理内容
previous_reasoning_content = "这是一段模型之前的推理过程..."
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {
"model": "your-model-with-thinking",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "你的新问题"}
],
# !!!关键修复:将之前的推理内容传回
"reasoning_content": previous_reasoning_content,
# 如果流式返回,通常也需要设置 stream=True
"stream": False
}
response = requests.post("https://api.example.com/v1/chat/completions",
headers=headers,
json=payload)
print(response.json())
4. 预防措施
reasoning_content),而不仅仅是 content,以备后续请求使用。