Skip to content

需要添加 gemini 专属以支持关闭思考过程 #6334

@xuhuanzy

Description

@xuhuanzy

需求/建议描述

根据 gemini 官方示例附加generationConfig后请求失败

curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-X POST \
-d '{
  "contents": [
    {
      "parts": [
        {
          "text": "Provide a list of 3 famous physicists and their key contributions"
        }
      ]
    }
  ],
  "generationConfig": {
    "thinkingConfig": {
          "thinkingBudget": 1024
          # Thinking off:
          # "thinkingBudget": 0
          # Turn on dynamic thinking:
          # "thinkingBudget": -1
    }
  }
}'

提示

[ {
  "error" : {
    "code" : 400,
    "message" : "Invalid JSON payload received. Unknown name \"generationConfig\": Cannot find field.",
    "status" : "INVALID_ARGUMENT",
    "details" : [ {
      "@type" : "type.googleapis.com/google.rpc.BadRequest",
      "fieldViolations" : [ {
        "description" : "Invalid JSON payload received. Unknown name \"generationConfig\": Cannot find field."
      } ]
    } ]
  }
} ]

建议的解决方案

添加gemini专属

附加信息

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions