Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

rvergis
Copy link

@rvergis rvergis commented Oct 4, 2025

Summary

Fixes issue #9287 where pydantic-ai tool calls were showing null input/output in the Langfuse UI.

Changes Made

  • Extended OtelIngestionProcessor: Added support for pydantic-ai specific fields tool_arguments and tool_response in the extractInputAndOutput() method
  • Proper Field Mapping:
    • tool_arguments → observation input
    • tool_response → observation output
  • Comprehensive Tests: Added test cases in otelMapping.servertest.ts to verify the new mapping functionality
  • Maintained Priority Order: Ensures pydantic-ai mapping doesn't interfere with existing integrations (Langfuse SDK, Vercel AI SDK, etc.)

Technical Details

The fix adds pydantic-ai field mapping after the generic input/output mapping but before GCP Vertex Agent mapping, maintaining the proper priority chain:

  1. Langfuse SDK attributes (highest priority)
  2. Vercel AI SDK attributes
  3. Generic input/output attributes
  4. 🆕 Pydantic-AI tool_arguments/tool_response
  5. GCP Vertex Agent attributes
  6. Other integration attributes

Test Coverage

  • ✅ Maps tool_arguments to input correctly
  • ✅ Maps tool_response to output correctly
  • ✅ Works with only input present
  • ✅ Works with only output present
  • ✅ Maintains priority order with other integrations

Related Issue

Closes #9287

🤖 Generated with Claude Code

Co-Authored-By: Claude noreply@anthropic.com


Important

Fixes pydantic-ai tool call mapping in OtelIngestionProcessor to correctly map tool_arguments and tool_response to input and output.

  • Behavior:
    • Fixes pydantic-ai tool call mapping in OtelIngestionProcessor by adding support for tool_arguments and tool_response in extractInputAndOutput().
    • Maps tool_arguments to input and tool_response to output.
    • Ensures pydantic-ai mapping does not interfere with existing integrations.
  • Tests:
    • Adds test cases in otelMapping.servertest.ts to verify mapping of tool_arguments and tool_response.
    • Tests cover scenarios with only input, only output, and priority order maintenance.

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

@CLAassistant
Copy link

CLAassistant commented Oct 4, 2025

CLA assistant check
All committers have signed the CLA.

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Oct 4, 2025
This fix addresses issue langfuse#9287 by adding support for pydantic-ai specific fields in OtelIngestionProcessor.

Based on enhanced context analysis that included:
- Related Issue langfuse#5515: Original discussion about tool call mapping
- Related PR langfuse#9074: Add support for OpenAI tool calls (merged)
- Related PR langfuse#8813: Related implementation patterns (merged)
- Official Documentation: https://langfuse.com/integrations/frameworks/pydantic-ai

Changes Made:
- Add tool_arguments → input mapping in OtelIngestionProcessor.ts
- Add tool_response → output mapping in OtelIngestionProcessor.ts
- Add comprehensive test coverage for pydantic-ai field mapping
- Maintain proper priority order in mapping chain

The solution follows established patterns from related PRs and maintainer guidance
from the referenced discussions.

🤖 Generated with Enhanced AI Developer Agent
Co-Authored-By: Claude <noreply@anthropic.com>
@rvergis rvergis force-pushed the fix-pydantic-ai-tool-call-mapping branch from c07adac to 37974e0 Compare October 4, 2025 22:21
@nimarb nimarb self-requested a review October 7, 2025 11:27
@nimarb nimarb self-assigned this Oct 7, 2025
@rvergis rvergis changed the title Fix pydantic-ai tool call mapping in OtelIngestionProcessor fix(pydantic-ai) - tool call mapping in OtelIngestionProcessor Oct 8, 2025
@rvergis rvergis changed the title fix(pydantic-ai) - tool call mapping in OtelIngestionProcessor fix(pydantic-ai): tool call mapping in OtelIngestionProcessor Oct 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: pydantic-ai tool call shows null input/output

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.