Refine LLM tools: modern API params - #100
Merged
Merged
Conversation
Align the provider LLM tools with current SDK surfaces (verified against anthropic 0.109.2, openai 2.42.0, google-genai 2.8.0) and add first-class, opt-in config for the modern reasoning/thinking knobs. All additions are backward-compatible; defaults are set to each provider's lowest-cost current-generation model. ClaudeTool: - Add opt-in `thinking` (adaptive) and `effort` (output_config) fields with builder methods; merged with chat_params (caller wins) and omitted when unset. - Map stop_reason == "refusal" onto Message.refusal instead of returning blank content silently. - Default model -> claude-haiku-4-5; max_tokens default 4096 -> 16384. GeminiTool: - Fix bug where chat_params were dropped whenever no tools were present. - Use the SDK-native system_instruction config field instead of faking a leading user turn. - Add opt-in `thinking_budget` (Gemini 2.5 ThinkingConfig). - Default model -> gemini-2.5-flash-lite (fixes from_dict/field mismatch). OpenAITool: - Add opt-in `reasoning_effort` and `verbosity` fields (gpt-5/o-series) via _extra_create_kwargs. - Default model -> gpt-4.1-nano. DeepSeek/OpenRouter/Ollama already default to their lowest-cost option and inherit the shared OpenAI-compatible improvements. Tests updated for new defaults/behavior; black/isort/flake8 clean, mypy clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Summary
Aligns the provider LLM tools with current SDK surfaces and adds first-class, opt-in config for the modern reasoning/thinking knobs. All additions are backward-compatible. Defaults are set to each provider's lowest-cost current-generation model.
Every new parameter was verified against the installed SDKs (
anthropic 0.109.2,openai 2.42.0,google-genai 2.8.0) — none are guessed.Changes by provider
ClaudeTool
thinking(adaptive) andeffort(output_config) fields + builder methods; merged withchat_params(caller wins) and omitted when unset.stop_reason == "refusal"ontoMessage.refusalinstead of silently returning blank content.claude-haiku-4-5;max_tokensdefault4096→16384.GeminiTool
chat_params(temperature, etc.) were silently dropped whenever no tools were present — config is now always built.system_instructionconfig field instead of faking a leadinguserturn.thinking_budget(Gemini 2.5ThinkingConfig).gemini-2.5-flash-lite(also fixes a field/from_dictdefault mismatch).OpenAITool
reasoning_effortandverbosityfields (gpt-5 / o-series) via_extra_create_kwargs.gpt-4.1-nano.DeepSeek / OpenRouter / Ollama — already default to their lowest-cost option (
deepseek-chat,openrouter/auto,qwen3) and inherit the shared OpenAI-compatible improvements.Lowest-cost defaults
claude-haiku-4-5gpt-4.1-nanogemini-2.5-flash-litedeepseek-chatopenrouter/autoqwen3Each leaves an inline comment pointing to the upgrade path for harder tasks.
Testing
thinking_budget,reasoning_effort/verbosity).black/isort/flake8clean;mypyclean (0 issues).🤖 Generated with Claude Code