Skip to content

fix(integrations): log DSPy and LiteLLM images as attachments - #935

Merged
Abhijeet Prasad (AbhiPrasad) merged 3 commits into
mainfrom
abhi/sdk-551-python-sdk-dspy-and-litellm-integrations-log-images-inline
Oct 15, 2026
Merged

Abhijeet Prasad (AbhiPrasad) merged 3 commits into
mainfrom
abhi/sdk-551-python-sdk-dspy-and-litellm-integrations-log-images-inline

Conversation

@AbhiPrasad

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

DSPy and LiteLLM currently send inline image bytes, which is bad!

Convert DSPy Image values (including nested Pydantic fields and RootModel roots) and image data URIs to SDK attachments before logging, while preserving provider requests, unrelated field serializers, and excluded fields. DSPy materializes images after Pydantic serialization, preserving model/field serializer redactions and list, scalar, or mapping output shapes. LiteLLM reuses the existing OpenAI input attachment conversion.

Fixes https://linear.app/braintrustdata/issue/SDK-551/python-sdk-dspy-and-litellm-integrations-log-images-inline-not-as

Convert inline images before span serialization and preserve provider inputs. Consolidate VCR coverage across supported versions and remove redundant tests and unused cassettes.

Fixes SDK-551.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T16:26:14.731947Z 090b157 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4654e618b1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Materialize RootModel roots directly and use converted raw fields for list/scalar model serializers, respecting field exclusions. Extend the image VCR regression while reusing existing provider recordings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dc711ab4b7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Materialize only the serialized representation of Pydantic models. Decode DSPy image prompt strings after serialization so redacted fields remain omitted and custom list, scalar, and mapping schemas are preserved. Extend the existing VCR regression to cover redactions and reshaping.
@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) merged commit b0cd11b into main Oct 15, 2026
98 checks passed
@AbhiPrasad
Abhijeet Prasad (AbhiPrasad) deleted the abhi/sdk-551-python-sdk-dspy-and-litellm-integrations-log-images-inline branch October 15, 2026 16:10
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