fleet-memory/hindsight-api-slim/hindsight_api/engine/providers
Kagura 585ac76f39
fix(claude-code): implement tool_choice support for forced tool calls (#733)
* fix(claude-code): implement tool_choice support for forced tool calls

The call_with_tools() method now properly handles the tool_choice parameter
to force specific tool calls. Previously, the parameter was accepted but ignored,
causing the reflect agent to fail when trying to force specific tools on each
iteration.

Fixes #732

Changes:
- When tool_choice forces a specific function: filter allowed_tools to only
  that tool (with mcp prefix) and add a strong system prompt instruction
- When tool_choice is 'required': add instruction that model must call at
  least one tool
- When tool_choice is 'none': clear allowed_tools and mcp_servers to disable
  all tools
- When tool_choice is 'auto' (default): no change (existing behavior)

This matches the approach used in the OpenAI provider while adapting to the
Claude Agent SDK's lack of native tool_choice parameter by using allowed_tools
filtering and system prompt instructions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* style: fix ruff formatting in alembic migration

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-30 10:30:53 +02:00
..
__init__.py feat: add 'none' LLM provider for chunk-only storage mode (#691) 2026-03-25 18:01:20 +01:00
anthropic_llm.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
claude_code_llm.py fix(claude-code): implement tool_choice support for forced tool calls (#733) 2026-03-30 10:30:53 +02:00
codex_llm.py fix(codex): resolve JSON serialization and logging exception propagation in codex_llm (#724) 2026-03-27 13:37:30 +01:00
gemini_llm.py fix: support gemini-3.1-flash-lite-preview by preserving thought_signature in tool calls (#568) 2026-03-13 16:43:01 +01:00
litellm_llm.py feat: add LiteLLM LLM provider for Bedrock and 100+ providers (#679) 2026-03-25 14:17:38 +01:00
mock_llm.py feat: introduce hindsight-api-slim and hindsight-all-slim packages (#560) 2026-03-13 13:50:03 +01:00
none_llm.py feat: add 'none' LLM provider for chunk-only storage mode (#691) 2026-03-25 18:01:20 +01:00
openai_compatible_llm.py feat: add support for ark and volcano LLM providers (#714) 2026-03-26 17:14:13 +01:00