Skip to content

fix(vertex): map reasoning_effort to thinkingBudget for Gemini 2.5 - #1741

Open
Solaris-star wants to merge 1 commit into
Portkey-AI:mainfrom
Solaris-star:fix/1639-gemini25-reasoning-effort-budget
Open

fix(vertex): map reasoning_effort to thinkingBudget for Gemini 2.5#1741
Solaris-star wants to merge 1 commit into
Portkey-AI:mainfrom
Solaris-star:fix/1639-gemini25-reasoning-effort-budget

Conversation

@Solaris-star

Copy link
Copy Markdown

Summary

#1639: on Vertex /v1/responses (and chat transforms in OSS), bare reasoning_effort was always mapped to thinkingConfig.thinkingLevel. That field is Gemini 3+ only. On Gemini 2.5 (especially gemini-2.5-flash-lite, default thinking off) Vertex silently drops it → HTTP 200 with zero reasoning tokens.

Nested reasoning: { effort } worked in production as a workaround; bare shorthand did not.

Change

  • Branch reasoning_effort / nested reasoning.effort by model family:
    • Gemini 2.5thinkingConfig.thinkingBudget (+ includeThoughts)
    • Gemini 3+thinkingConfig.thinkingLevel (previous behaviour)
  • Shared helpers in transformGenerationConfig.ts; google provider reuses them
  • Unit tests for mapping, family detection, bare vs nested, and none

Effort → budget map: minimal=512, low=1024, medium=8192, high=24576 (numeric strings also accepted).

Test plan

  • npx jest src/providers/google-vertex-ai/transformGenerationConfig.test.ts11 passed
  • Hosted Responses-API path (if separate from OSS transform) still needs maintainer verify against Vertex virtual keys from the issue matrix

Fixes #1639

Bare reasoning_effort was always emitted as thinkingLevel, which Vertex
silently drops on Gemini 2.5 models. flash-lite defaults thinking off,
so the no-op was user-visible as zero reasoning tokens.

Branch by model family:
- Gemini 2.5 → thinkingBudget (+ includeThoughts)
- Gemini 3+ → thinkingLevel
Also honor nested reasoning.effort (Responses API shape).

Fixes Portkey-AI#1639
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

reasoning_effort silently no-ops for Vertex gemini-2.5-flash-lite on /v1/responses

1 participant