Skip to content

不支持思考的 Gemini 模型请求不应包含 includeThoughts #7985

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sxjeru opened this issue May 27, 2025 · 4 comments · Fixed by #7987
Closed

不支持思考的 Gemini 模型请求不应包含 includeThoughts #7985

sxjeru opened this issue May 27, 2025 · 4 comments · Fixed by #7987

Comments

@sxjeru
Copy link
Contributor

sxjeru commented May 27, 2025

一些不支持思考的模型增加includeThoughts后出现错误,例如 Gemini API 的 gemini-2.0-flash-preview-image-generation 和 Vertex 的gemini-2.0-flashgemini-2.0-flash-lite

{
  "error": {
    "message": "Thinking is not enabled for models/gemini-2.0-flash-preview-image-generation",
    "statusCode": 400,
    "statusCodeText": "[400 Bad Request]"
  },
  "provider": "google"
}

Vertex 的 Gemini 2.0 Flash

{
  "error": {
    "message": "[VertexAI.ClientError]: got status: 400 Bad Request. {\"error\":{\"code\":400,\"message\":\"Unable to submit request because Thinking_config.include_thoughts is only enabled when thinking is enabled.. Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini\",\"status\":\"INVALID_ARGUMENT\"}}"
  },
  "provider": "vertexai"
}

Originally posted by @KoellM in #7686 (comment)

@lobehubbot
Copy link
Member

👀 @sxjeru

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

@dosubot dosubot bot added the Gemini label May 27, 2025
Copy link

dosubot bot commented May 27, 2025

你反馈的问题是正确的:部分 Gemini 模型(如 gemini-2.0-flash-preview-image-generationgemini-2.0-flashgemini-2.0-flash-lite)本身并不支持“思考”能力(thinking/thoughts),因此请求中包含 includeThoughts 参数会导致 400 Bad Request 错误。错误信息明确指出只有启用了思考能力的模型才能使用该参数。

根据模型描述,Gemini 2.5 Flash 及相关模型分为“带思考”和“不带思考”两个版本,只有带有 :thinking 后缀的模型才支持思考能力和相关参数(如 includeThoughts)。标准版本(无 :thinking 后缀)会显式避免生成思考内容,且价格也不同。如果你需要思考能力,需选择支持该能力的模型,否则请求中不应包含 includeThoughts 参数,否则会报错。相关说明

建议:

  • 使用不支持思考的 Gemini 模型时,请确保请求中不包含 includeThoughts 参数。
  • 只有在选择带有 :thinking 后缀的 Gemini 模型时,才可以使用 includeThoughts
  • 如果你在代码或配置中动态生成请求参数,建议根据模型类型自动排除不支持的参数,避免此类错误。

目前在 lobe-chat 仓库中未检索到针对该问题的详细文档或历史讨论,但模型描述和错误信息已明确说明了参数兼容性。

To reply, just mention my name @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@lobehubbot
Copy link
Member

@sxjeru

This issue is closed, If you have any questions, you can comment and reply.
此问题已经关闭。如果您有任何问题,可以留言并回复。

@lobehubbot
Copy link
Member

🎉 This issue has been resolved in version 1.88.18 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants