feat(openai): surface Gemini thinking + request thought summaries - #301
Open
philipph-askui wants to merge 1 commit into
Open
feat(openai): surface Gemini thinking + request thought summaries#301philipph-askui wants to merge 1 commit into
philipph-askui wants to merge 1 commit into
Conversation
The OpenAI-compatible path only carried the Gemini thought_signature; it never surfaced the model's reasoning. Two additions, mirroring the C# SDK change (askui/csharp-sdk#13): - Parse reasoning into a thinking block: read `reasoning_content` / `reasoning` from the response message's extra fields, and split inline `<think>…</think>` out of `content` (how Gemini via Vertex's OpenAI endpoint returns its thought summary). Either becomes a BetaThinkingBlock ahead of the spoken text. - Request the summary on the AskUI Gemini path via `extra_body.google.thinking_config.include_thoughts`. Vertex rejects `reasoning_effort` and a custom `thinking_config` together ("found both", 400), so only the latter is sent; caller-supplied options win. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
philipph-askui
marked this pull request as ready for review
July 28, 2026 20:19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The problem (conceptually)
A reasoning model keeps its "thinking" separate from its spoken answer. Claude returns that reasoning as a distinct, typed thinking block; the OpenAI-compatible path (how Gemini is served via the AskUI API) is messier and, as a result, dropped the reasoning entirely:
reasoning_content/reasoning) or — for Gemini — inline in the answer text, wrapped in<think>…</think>tags. The parser ignored the side field and passed the inline tags straight through as part of the answer.So a Python-SDK user running Gemini through the AskUI API saw no reasoning at all, or raw
<think>tags leaking into the answer. (There's also a sharp edge: Vertex 400s if a request carries bothreasoning_effortand a customthinking_config— "found both" — so the opt-in must usethinking_configalone.)This path previously only carried the Gemini
thought_signature(multi-turn tool calling, #290); reasoning was never surfaced.The fix (conceptually)
Make the OpenAI-compatible path speak the same internal thinking vocabulary as the Anthropic path:
extra_body.google.thinking_config.include_thoughts, deliberately notreasoning_effort).<think>…</think>— and lift either into the sameBetaThinkingBlockthe Anthropic path already produces, ahead of the spoken text.Changes
models/openai/messages_api.py— parsereasoning_content/reasoning; split inline<think>…</think>out ofcontent; emit aBetaThinkingBlockbefore the text block.model_providers/askui_vlm_provider.py— on the Google backend, request thoughts viaextra_body.google.thinking_config.include_thoughts(callerprovider_optionswin).ruff+mypyclean.Related PRs
This is a parity port of the C# SDK change:
The desktop app runs on the C# SDK, so it does not depend on this PR; this is a standalone-product parity fix for Python-SDK users.
🤖 Generated with Claude Code