[API Error: 生成数据错误: HTTP 错误!状态:400,响应:[{
“error”: {
“code”: 400,
“message”: “Invalid JSON payload received. Unknown name “max_new_tokens”: Cannot find field.”,
“status”: “INVALID_ARGUMENT”,
“details”: [
{
“@type”: “type.googleapis.com/google.rpc.BadRequest”,
“fieldViolations”: [
{
“description”: “Invalid JSON payload received. Unknown name “max_new_tokens”: Cannot find field.”
}
]
}
]
}
}
] TraceID:00-ccfe7b7c52bf31ace1f0bafff0fb4087-e80d07f2c9f9c1a2-01]
說gemini 沒用max_new_tokens 要用
Google API 規格不支援 max_new_tokens 參數名稱。此參數通常用於 Hugging Face 或 OpenAI 相容的介面。
Solution 解決方案
Replace max_new_tokens with max_output_tokens. Place it within the generationConfig object.
將 max_new_tokens 替換為 max_output_tokens 。並將其放置在 generationConfig 物件中。
但是似乎沒有這個設定