Skip to content

Unexpected truncation of thought summary with Gemini 2.5 Pro #1157

@giacomoni

Description

@giacomoni

Sometimes, the thought summary returned when setting include_thoughts=True and thinking_budget=32768 is clearly truncated, although the total number of tokens used reported in the response is below the max budget:

GenerateContentResponseUsageMetadata(
  candidates_token_count=2220,
  prompt_token_count=13216,
  prompt_tokens_details=[
    ModalityTokenCount(
      modality=<MediaModality.TEXT: 'TEXT'>,
      token_count=9088
    ),
    ModalityTokenCount(
      modality=<MediaModality.DOCUMENT: 'DOCUMENT'>,
      token_count=4128
    ),
  ],
  thoughts_token_count=5041,
  total_token_count=20477
)

Has anyone encountered this issue before? I am particularly interested to understand if the truncation of the summary is a reflection of a truncation occurring in the original chain of thoughts, or whether this truncation is a bug occurring somewhere in the backend during the generation of the summary itself.

The response contains the full structured output, so the workflow does not break.

Metadata

Metadata

Assignees

Labels

priority: p3Desirable enhancement or fix. May not be included in next release.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions