Skip to content

Refine LLM tools: modern API params - #100

Merged
GuanyiLi-Craig merged 1 commit into
mainfrom
gl/refine-llm-tools
Jun 21, 2026
Merged

Refine LLM tools: modern API params#100
GuanyiLi-Craig merged 1 commit into
mainfrom
gl/refine-llm-tools

Conversation

@GuanyiLi-Craig

Copy link
Copy Markdown
Contributor

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

  • New opt-in thinking (adaptive) and effort (output_config) fields + builder methods; merged with chat_params (caller wins) and omitted when unset.
  • Map stop_reason == "refusal" onto Message.refusal instead of silently returning blank content.
  • Default model → claude-haiku-4-5; max_tokens default 409616384.

GeminiTool

  • Bug fix: chat_params (temperature, etc.) were silently dropped whenever no tools were present — config is now always built.
  • Use the SDK-native system_instruction config field instead of faking a leading user turn.
  • New opt-in thinking_budget (Gemini 2.5 ThinkingConfig).
  • Default model → gemini-2.5-flash-lite (also fixes a field/from_dict default mismatch).

OpenAITool

  • New 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 (deepseek-chat, openrouter/auto, qwen3) and inherit the shared OpenAI-compatible improvements.

Lowest-cost defaults

Provider Default
Claude claude-haiku-4-5
OpenAI gpt-4.1-nano
Gemini gemini-2.5-flash-lite
DeepSeek deepseek-chat
OpenRouter openrouter/auto
Ollama qwen3

Each leaves an inline comment pointing to the upgrade path for harder tasks.

Testing

  • 86 LLM-tool tests pass (incl. new tests for thinking/effort merge, refusal mapping, thinking_budget, reasoning_effort/verbosity).
  • 226 broader tests (tools, serialization roundtrip, agents) pass.
  • black / isort / flake8 clean; mypy clean (0 issues).

🤖 Generated with Claude Code

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>
Copilot AI review requested due to automatic review settings June 21, 2026 20:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@GuanyiLi-Craig GuanyiLi-Craig changed the title Refine LLM tools: modern API params + lowest-cost defaults Refine LLM tools: modern API params Jun 21, 2026
@GuanyiLi-Craig
GuanyiLi-Craig merged commit 1a570a9 into main Jun 21, 2026
19 of 20 checks passed
GuanyiLi-Craig added a commit that referenced this pull request Jun 23, 2026
Releases the changes merged since 0.0.35:
- #100 Refine LLM tools: modern API params
- #101 Replace container singleton with request-scoped runtime DI
- #102 Bump dependencies to clear Dependabot security alerts

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

2 participants