Skip to content

fix: capture reasoning content when model returns both reasoning and text in same response #17

@dbschmigelski

Description

@dbschmigelski

Problem Statement

Description

When using Gemini with thinking mode enabled (thinking_config), reasoning content was being lost from the message history. The model returns both reasoning (thinking process) and text content in the same response, but only the text was captured.

This affected observability, tracing, and any downstream processing that relies on the conversation history containing the full model output.

Before:

[{"text": "2 + 2 = 4"}]

After:

[
  {"reasoningContent": {"reasoningText": {"text": "Let me calculate..."}}},
  {"text": "2 + 2 = 4"}
]

Proposed Solution

No response

Use Case

Description

When using Gemini with thinking mode enabled (thinking_config), reasoning content was being lost from the message history. The model returns both reasoning (thinking process) and text content in the same response, but only the text was captured.

This affected observability, tracing, and any downstream processing that relies on the conversation history containing the full model output.

Before:

[{"text": "2 + 2 = 4"}]

After:

[
  {"reasoningContent": {"reasoningText": {"text": "Let me calculate..."}}},
  {"text": "2 + 2 = 4"}
]

Alternatives Solutions

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions