Skip to content

feat(openai): upload large input value images - #3717

Open
caroger wants to merge 1 commit into
codex/deferred-input-valuefrom
codex/openai-blob-upload-input
Open

caroger wants to merge 1 commit into
codex/deferred-input-valuefrom
codex/openai-blob-upload-input

Conversation

@caroger

@caroger caroger commented Sep 10, 2026

Copy link
Copy Markdown
Collaborator

Why

The OpenAI instrumentor redacts oversized base64 images inside serialized input.value. This change uses the configured BlobUploader after a span records and replaces each oversized image leaf with the validated upload URI.

Chat Completions and Responses share one deferred serializer. The serializer copies the request, preserves unrelated fields, and contains every upload failure within the affected image leaf.

Scope

  • Process messages[*].content[*].image_url.url for Chat Completions.
  • Process input[*].content[*].image_url for Responses.
  • Preserve remote URLs and data URIs at or below the configured budget.
  • Keep output.value and flattened message attributes unchanged.

Tradeoffs

Serialized input.value and flattened image attributes may upload the same content separately. Cross-attribute deduplication is outside this issue.

This PR targets the prerequisite branch from #3537. After the core helper ships, update the OpenAI package's lower bound to that released version before merging this PR into main.

Blast Radius

The change affects OpenAI request span attributes only. The original SDK request and the OpenAI call remain unchanged when copying, decoding, serialization, or upload fails.

Verification

  • uvx tox run -e ruff-mypy-test-openai passed formatting, Ruff, mypy, and 510 tests on OpenAI 2.8.0.
  • uvx tox run -e test-openai-v3 -- tests/openinference/instrumentation/openai/test_input_value_blob_upload.py tests/openinference/instrumentation/openai/test_input_value_image_hiding.py passed 28 tests on OpenAI 3.0.0.

Refs #3540

@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

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant