Repository navigation
fix: claude and gemini AI drivers for current models, with Claude reasoning and opt-in prompt caching - #10073
Conversation
- claude: only send temperature if configured (current models reject it), keep $defs in tool schemas (the SDK type dropped every key except type/properties/required), and stop turning thinking blocks into (empty) text blocks, which the API rejects on the next tool loop iteration - openai: only send temperature if configured (reasoning models reject it unless reasoning effort is "none") - gemini: only send temperature if configured (Google warns lower values cause looping on Gemini 3) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
Not sending temperature by default changed sampling for the default setup (gpt-5.2 accepts temperature) from 0.1 to OpenAI's default of 1.0, including Rill-managed AI, while the failing case (reasoning models) already has a workaround: setting reasoning_effort omits temperature. Documents that workaround and tests the existing behavior instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude, openai, and gemini AI drivers for current modelsclaude and gemini AI drivers for current models
- Adds a `prompt_caching` option to the `claude` connector (off by default) that marks the tools, system prompt, and conversation as cache breakpoints, so later steps of a tool loop read them from the prompt cache. Rill-managed AI can enable it with RILL_ADMIN_CLAUDE_PROMPT_CACHING. - Reports cache writes (Claude bills them at a premium) as a new CompleteResult.CacheWriteInputTokens field, passed through the admin Complete API and emitted as a cache_write_input_tokens metric. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude requires thinking blocks to be passed back unmodified within a tool call loop. - Adds a Reasoning content block (text, signature, or redacted data) to rill.ai.v1.ContentBlock. - The claude driver returns thinking and redacted thinking blocks as reasoning, and passes them back as thinking blocks. Since thinking blocks are bound to the tools offered, they are removed when no tools are offered (the final iteration). - The tool call loop keeps reasoning in memory until the loop completes (it isn't added to the session), and message truncation removes all reasoning, since thinking blocks are bound to the history they were produced from. - The admin Complete API removes reasoning from responses unless the client sets include_reasoning, for older runtimes. - The gemini driver and the metrics view and canvas generators skip reasoning blocks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude and gemini AI drivers for current modelsclaude and gemini AI drivers for current models, with Claude reasoning and opt-in prompt caching
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
There was a problem hiding this comment.
This review was posted by an AI agent (OpenHands).
No material correctness, security, or design issues found in this head. Reviewed driver conversion, reasoning lifetime and truncation, admin backward compatibility, and cache-write token propagation.
Focused Go tests passed in runtime/drivers/claude, runtime/drivers/gemini, runtime/drivers/openai, runtime/ai, and admin/server, covering temperature, schema preservation, caching, reasoning round-trips, truncation, and legacy response stripping. All 16 current GitHub checks passed. Provider requests were exercised through fake servers; I did not validate against live model APIs.
✅ APPROVED
LLM profile: unknown · Model: gpt-6-astra
… reasoning and opt-in prompt caching (#10073) * fix: AI drivers for current Claude, OpenAI, and Gemini models - claude: only send temperature if configured (current models reject it), keep $defs in tool schemas (the SDK type dropped every key except type/properties/required), and stop turning thinking blocks into (empty) text blocks, which the API rejects on the next tool loop iteration - openai: only send temperature if configured (reasoning models reject it unless reasoning effort is "none") - gemini: only send temperature if configured (Google warns lower values cause looping on Gemini 3) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * revert: keep the default OpenAI temperature Not sending temperature by default changed sampling for the default setup (gpt-5.2 accepts temperature) from 0.1 to OpenAI's default of 1.0, including Rill-managed AI, while the failing case (reasoning models) already has a workaround: setting reasoning_effort omits temperature. Documents that workaround and tests the existing behavior instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: opt-in prompt caching for Claude and cache write reporting - Adds a `prompt_caching` option to the `claude` connector (off by default) that marks the tools, system prompt, and conversation as cache breakpoints, so later steps of a tool loop read them from the prompt cache. Rill-managed AI can enable it with RILL_ADMIN_CLAUDE_PROMPT_CACHING. - Reports cache writes (Claude bills them at a premium) as a new CompleteResult.CacheWriteInputTokens field, passed through the admin Complete API and emitted as a cache_write_input_tokens metric. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: pass Claude's reasoning back within the tool call loop Claude requires thinking blocks to be passed back unmodified within a tool call loop. - Adds a Reasoning content block (text, signature, or redacted data) to rill.ai.v1.ContentBlock. - The claude driver returns thinking and redacted thinking blocks as reasoning, and passes them back as thinking blocks. Since thinking blocks are bound to the tools offered, they are removed when no tools are offered (the final iteration). - The tool call loop keeps reasoning in memory until the loop completes (it isn't added to the session), and message truncation removes all reasoning, since thinking blocks are bound to the history they were produced from. - The admin Complete API removes reasoning from responses unless the client sets include_reasoning, for older runtimes. - The gemini driver and the metrics view and canvas generators skip reasoning blocks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 2bb80c0)
Fixes AI chat failing on current models with the existing AI drivers, found while building the Bedrock driver (#10069) and from a report that every chat failed on Claude Sonnet 5.5, Opus 5.5, and Haiku 5.5 through the
claudeconnector. The reasoning and prompt caching changes follow the approach in #10074.Driver fixes (first commit)
claude: only sendtemperatureif configured (Opus 4.7+ rejects sampling parameters, and Sonnet/Haiku 5.5 reject non-default values), and keep$defsin tool schemas (BetaToolInputSchemaParamdropped every keyword excepttype/properties/required, so$refparams liketime_range/wherepointed at nothing). Empty text blocks are skipped in requests and responses.gemini: only sendtemperatureif configured (Google recommends the default 1.0 for Gemini 3 and warns lower values can cause looping).openai: no driver change. Its defaulttemperatureof 0.1 is accepted by the default model (gpt-5.2) and is already omitted whenreasoning_effortis set, so the docs now say to setreasoning_effortfor models that reason by default.Opt-in prompt caching for Claude (second commit)
prompt_cachingoption on theclaudeconnector (off by default) marks the tools, system prompt, and conversation as cache breakpoints. Rill-managed AI can enable it withRILL_ADMIN_CLAUDE_PROMPT_CACHING.CompleteResult.CacheWriteInputTokens, passed through the adminCompleteAPI, and emitted as acache_write_input_tokensmetric. Billing will need to price this new metric before enabling caching for managed AI.Claude reasoning within the tool loop (third commit)
Reasoningblock onrill.ai.v1.ContentBlock(text, signature, or redacted data).CompleteAPI removes reasoning from responses unless the client setsinclude_reasoning, so older runtimes (e.g. older Rill Developer versions on managed AI) keep working.geminidriver and the metrics view / canvas generators skip reasoning blocks instead of erroring.Tests: drivers are tested against fake servers through their real SDKs (request body assertions); the tool loop, truncation, and admin stripping have unit tests. The key tests fail against the code without the corresponding fix. Not yet run against the real APIs.
Not in scope: moving the
openaidriver to the Responses API (the newest OpenAI models only support tool calling there).Checklist:
Developed in collaboration with Claude Code