Skip to content

OpenAI-GCP Vertex AI translator: reasoning_content returned as nested dict instead of string (non-streaming) #1974

@MotzWanted

Description

@MotzWanted

Description

The non-streaming OpenAI-to-GCP Vertex AI translator returns reasoning_content as a nested dict instead of a plain string for Gemini 3 models. This breaks OpenAI-compatible clients (e.g. litellm pydantic validation rejects the response).

The streaming path already handles this correctly using StreamReasoningContent. Gemini 2.5 models are unaffected.

Actual response:

"reasoning_content": {"reasoningContent": {"reasoningText": {"text": "...", "signature": "..."}}}

Expected:

"reasoning_content": "the thinking text..."

Root cause:
geminiCandidatesToOpenAIChoices in internal/translator/gemini_helper.go wraps the value in Bedrock types.

Suggested fix:
set Value to the string directly (3 occurrences):

// before
Value: &openai.ReasoningContent{ReasoningContent: &awsbedrock.ReasoningContentBlock{...}}
// after
Value: thoughtSummary

Error (client-side):

pydantic_core._pydantic_core.ValidationError: 1 validation error for Message
reasoning_content
  Input should be a valid string [type=string_type, input_value={'reasoningContent': {'re...}}, input_type=dict]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions