Closed
Description
Description of the bug:
when the Candidate.finishReason
response field is not set to STOP
, the Candidate.content
is missing.
example reproduction
curl --request POST \
--header "Content-Type: application/json" \
--data '{"contents":[{"parts":[{"text":"hi!"}]}],"generationConfig":{"maxOutputTokens":1}}' \
https://generativelanguage.googleapis.com/v1/models/gemini-pro:generateContent?key=YOUR_API_KEY
Actual vs expected behavior:
the response to this request is currently
{
"candidates": [
{
"finishReason": "MAX_TOKENS",
"index": 0,
"safetyRatings": [...]
}
],
"promptFeedback": {
"safetyRatings": [...]
}
}
the candidates[0].content
field is expected to contain the first generated token (as maxOutputTokens
was set to 1
), but is missing
Any other information you'd like to share?
this started happening between 2024-01-12 and 2024-01-14 on the v1beta
API version