Skip to content

Commit 8228294

Browse files
authored
fix: prevent duplicate reasoning_details when converting messages back to API format (#344)
* fix: prevent duplicate reasoning_details when converting messages back to API format * chore: adds changelog * refactor: use helper function for reasoning_details deduplication Replaces boolean flag tracking with a cleaner findFirstReasoningDetails() helper. Priority: message-level > first tool call > first reasoning part. * chore: improves parallel-tool-calls test coverage
1 parent 111f582 commit 8228294

File tree

6 files changed

+819
-49
lines changed

6 files changed

+819
-49
lines changed

.changeset/funny-jobs-send.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@openrouter/ai-sdk-provider": patch
3+
---
4+
5+
Fix parallel tool calls with Claude models when thinking/reasoning is enabled. Previously, reasoning_details were duplicated across all parallel tool calls, causing Anthropic to reject continuation requests.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@ dist
88

99
# Reference repositories (git submodules)
1010
reference/
11+
12+
/tmp

0 commit comments

Comments
 (0)