Skip to content

Support OpenAI Responses API content parts#1981

Open
RitwijParmar wants to merge 1 commit into
pydantic:mainfrom
RitwijParmar:codex/logfire-openai-responses-content-parts
Open

Support OpenAI Responses API content parts#1981
RitwijParmar wants to merge 1 commit into
pydantic:mainfrom
RitwijParmar:codex/logfire-openai-responses-content-parts

Conversation

@RitwijParmar
Copy link
Copy Markdown

Fixes #1901.

This fills in the Responses API content-part gap in the OpenAI instrumentation:

  • input_text now maps to a text part/event instead of falling through as unknown
  • input_image handles the Responses API's flat image_url string as well as file_id and inline file data
  • input_file maps URL and file-id references to document URI parts, and inline file_data to a document blob part
  • the legacy events path now records useful content for these same parts instead of gen_ai.unknown

I kept unknown/future part types on the existing generic fallback, so this should be narrowly scoped to the documented Responses API part types.

Tests run:

  • uv run pytest tests/otel_integrations/test_openai.py -q -k "input_to_events or convert_responses_inputs"
  • uv run ruff check logfire/_internal/integrations/llm_providers/openai.py tests/otel_integrations/test_openai.py
  • uv run ruff format --check --diff logfire/_internal/integrations/llm_providers/openai.py tests/otel_integrations/test_openai.py
  • uv run pyright logfire/_internal/integrations/llm_providers/openai.py tests/otel_integrations/test_openai.py

AI disclosure: I used AI assistance while editing and reviewing this patch, then ran the tests and checks above locally.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@codecov
Copy link
Copy Markdown

codecov Bot commented May 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Signed-off-by: Ritwij Aryan Parmar <ritwij.aryan.parmar@gmail.com>
@RitwijParmar RitwijParmar force-pushed the codex/logfire-openai-responses-content-parts branch from 8249198 to fec0bc1 Compare May 28, 2026 17:44
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.

OpenAI Responses API content types input_text/input_image/input_file not recognized by instrument_openai

1 participant