Skip to content

fix(traceloop-sdk): ai sdk transform response tool calls#866

Merged
nina-kollman merged 7 commits intomainfrom
nk/llm_completion
Jan 18, 2026
Merged

fix(traceloop-sdk): ai sdk transform response tool calls#866
nina-kollman merged 7 commits intomainfrom
nk/llm_completion

Conversation

@nina-kollman
Copy link
Copy Markdown
Contributor

@nina-kollman nina-kollman commented Jan 18, 2026

Fixes: TLP-1638
ai-sdk v5 does not support the if (toolCall.toolCallType === "function") - there is no call type.

Important

Removes toolCallType check in transformResponseToolCalls to process all tool calls, supporting both v4 and v5 formats.

  • Behavior:
    • Removes toolCallType check in transformResponseToolCalls in ai-sdk-transformations.ts, allowing all tool calls to be processed.
    • Supports both v4 (args) and v5 (input) formats for tool calls, preferring v5 if present.
  • Attributes:
    • Transforms tool call attributes by setting name and arguments in attributes object.
    • Constructs toolCallParts array with type and tool_call details for each tool call.

This description was created by Ellipsis for 2930f07. You can customize this summary. It will automatically update as commits are pushed.

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Standardized tool call processing to ensure consistent handling across all tool call types, improving reliability in AI SDK transformations.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 18, 2026

📝 Walkthrough

Walkthrough

The transformResponseToolCalls function in the AI SDK transformations module was simplified to uniformly process all tool call entries, removing conditional type checking and format selection logic that previously differentiated between function-type tool calls and other types.

Changes

Cohort / File(s) Summary
Tool Call Processing Refactor
packages/traceloop-sdk/src/lib/tracing/ai-sdk-transformations.ts
Removed conditional filtering by toolCallType === "function" and v4/v5 format branching. Tool calls now uniformly processed by deriving arguments from input ?? args, assigning name and arguments to attributes, and appending tool_call objects to parts array regardless of type.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A hop, skip, and simplification bound,
Tool calls now flow without a thorny gate,
No branching paths, just one smooth way around,
Unified logic—oh, how neat and straight!
The transformation hops with elegance uniform.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title 'fix(traceloop-sdk): ai sdk transform response tool calls' clearly and concisely describes the main change: fixing how AI SDK transforms response tool calls, which aligns with the summary showing removal of conditional handling and standardization of tool call processing.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to 2930f07 in 1 minute and 4 seconds. Click for details.
  • Reviewed 47 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. packages/traceloop-sdk/src/lib/tracing/ai-sdk-transformations.ts:147
  • Draft comment:
    Removal of the conditional (toolCall.toolCallType === 'function') means all tool calls are processed. Confirm that transforming non-function tool calls is intended.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.

Workflow ID: wflow_jtH3tFqLqy3LNoIN

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@nina-kollman nina-kollman changed the title fix(traceloop-sdk): ai sdk transform responsetoolcalls fix(traceloop-sdk): ai sdk transform response tool calls Jan 18, 2026
@nina-kollman nina-kollman merged commit 3112d75 into main Jan 18, 2026
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.

2 participants