Skip to content

Gemini thought summaries should not be sent back to API if there are thought signatures #3947

Description

@lwnz42

Question

With gemini models, thought summaries are developer / user facing summaries of model thought process. They are to be used for debugging / display purposes for end users or developers.

As per google gemini documentation.

Thought summaries are synthesized versions of the model's raw thoughts and offer insights into the model's internal reasoning process.

They serve different purpose than raw reasoning text from models like GPT, for example (which OpenAI recommends to pass back to model AFAIK).

But Gemini models have thought signatures for that, which Pydantic AI is handling already - those are needed for preserving the reasoning context and for tool calling.

I understand saving them to message history (so developers can still capture those and show them if they're running user-facing chat-like apps), but why is pydantic AI not skipping the summaries when mapping the past context into parts for google models?

These can be quite verbose and pollute the context window unnecessarily.

I understand that one of main pydantic AI features is being able to use any model with native API and have unified interface, so I'm not sure if that's an oversight (because some other models recommend adding thoughts back), or a feature for multi-provider compatibility (like if the history is being passed from other model, which generates raw thoughts as text).

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugReport that something isn't working, or PR implementing a fixgoogle-gemini

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions