Skip to content

fix: ensure pipecat metadata is JSON#3003

Open
duncankmckinnon wants to merge 3 commits intomainfrom
pipecat-metadata-format
Open

fix: ensure pipecat metadata is JSON#3003
duncankmckinnon wants to merge 3 commits intomainfrom
pipecat-metadata-format

Conversation

@duncankmckinnon
Copy link
Copy Markdown
Contributor

Fix metadata serialization for non-dict LLM settings in pipecat instrumentor

Problem

When using pipecat with Google Gemini (or other providers with Pydantic model settings), the metadata span attribute was being set to a Python repr string like:

GoogleLLMSettings(model='gemini-3-flash-preview', extra={}, system_instruction=None, ...)

This caused export failures with StatusCode.UNKNOWN because the Arize backend requires metadata to be valid JSON.

Fix

In _attributes.py, the LLMServiceAttributeExtractor.extract_from_service method now converts non-dict settings objects to dicts before JSON serialization, using model_dump() (Pydantic v2), dict() (Pydantic v1), or __dict__ as fallbacks.

Testing

All 66 existing tests pass.

@duncankmckinnon duncankmckinnon requested a review from a team as a code owner April 16, 2026 17:52
@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Apr 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files.

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant