-
Notifications
You must be signed in to change notification settings - Fork 463
Open
Description
Description of the bug:
Hello, I'm occasionally experiencing empty responses by the Gemini model. The task is to chunk a man page into blocks, so the content is of pure technical content.
The response below makes me think it came to a natural stop. Is there any other explanation that could cause this? Rerunning the same prompt multiple times might eventually return the expected output. My API call relies mostly on default values. Any help is appreciated!
contents = [
types.Content(role="user", parts=[types.Part.from_text(text=system_instruction)]),
types.Content(role="user", parts=[types.Part.from_text(text=user_prompt)]),
]
response = self.client.models.generate_content(
model=self.model_name,
contents=contents
))
Actual vs expected behavior:
GenerateContentResponse(
automatic_function_calling_history=[],
candidates=[
Candidate(
content=Content(
role='model'
),
finish_reason=<FinishReason.STOP: 'STOP'>,
index=0
),
],
model_version='gemini-2.5-pro',
response_id='......',
sdk_http_response=HttpResponse(
headers=<dict len=11>
),
usage_metadata=GenerateContentResponseUsageMetadata(
prompt_token_count=11280,
prompt_tokens_details=[
ModalityTokenCount(
modality=<MediaModality.TEXT: 'TEXT'>,
token_count=11280
),
],
thoughts_token_count=11,
total_token_count=11291
)
)
Metadata
Metadata
Assignees
Labels
No labels