Skip to content

feat(lm): update rig-core v0.31.0, fix reasoning in tool loops, parallel tool calls#80

Merged
darinkishore merged 1 commit intomainfrom
rig-update
Feb 19, 2026
Merged

feat(lm): update rig-core v0.31.0, fix reasoning in tool loops, parallel tool calls#80
darinkishore merged 1 commit intomainfrom
rig-update

Conversation

@darinkishore
Copy link
Collaborator

@darinkishore darinkishore commented Feb 19, 2026

Summary

  • Bump rig-core to v0.31.0, reqwest to 0.13
  • Fix reasoning content handling in tool loops: response.choice is OneOrMany<AssistantContent> — providers like Anthropic return [Reasoning, ToolCall] or [Reasoning, Text]. The old code only checked .first(), which caused tool calls behind reasoning blocks to be silently dropped and reasoning blocks to be stripped from chat history (breaking Anthropic's required thinking signature echo)
  • Support parallel tool calling: multiple tool_use blocks in a single response are now all executed and their results batched into a single User message
  • Extract find_and_execute_tool / execute_tool_batch / push_tool_results helpers to deduplicate the tool-lookup-by-name loop that was copy-pasted 2x
  • Add 8 unit tests for classify_choice covering: text-only, single tool call, reasoning+tool call, reasoning+text, reasoning-only fallback, tool-call-wins-over-text, multiple parallel tool calls, image-only fallback

Bugs fixed

  1. [Reasoning, ToolCall] responses treated as terminal reasoning — tool call never executed, tool loop exits prematurely
  2. Assistant history only included OneOrMany::one(ToolCall), dropping reasoning blocks — subsequent Anthropic API calls would fail due to missing thinking signatures
  3. Same .first() bug in the initial call() dispatch

Test plan

  • cargo clippy clean (0 warnings)
  • cargo test all 30 unit tests + 10 doc-tests pass
  • 8 new classify_choice unit tests covering all code paths
  • Smoke test: Anthropic claude-sonnet-4 extended thinking + single tool call
  • Smoke test: Anthropic claude-sonnet-4 extended thinking + parallel tool calls (3 tools in one response)
  • Smoke test: OpenAI gpt-4o-mini tool call (baseline regression check)

…pport parallel tool calls

- Bump rig-core to v0.31.0, reqwest to 0.13
- Fix response.choice processing: scan all content blocks via classify_choice()
  instead of only checking .first(), which missed tool calls behind reasoning blocks
- Preserve full assistant content (reasoning + tool calls) in chat history so
  Anthropic thinking signatures are echoed back correctly
- Support parallel tool calling (multiple tool_use blocks in one response)
- Extract find_and_execute_tool / execute_tool_batch helpers to deduplicate tool lookup
- Add 8 unit tests for classify_choice covering all code paths
@darinkishore darinkishore merged commit 3ef1382 into main Feb 19, 2026
6 of 10 checks passed
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.

1 participant

Comments