Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Empty responses by Gemini 2.5-Pro #744

Description

@sebastianrath

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
  )​
)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions