Skip to content

fix(langfuse): upload base64 media and export its reference from the langfuse callback - #53934

Merged
yucheng-berri merged 18 commits into
mainfrom
litellm_langfuse_sdk_media_upload
Nov 27, 2026
Merged

yucheng-berri merged 18 commits into
mainfrom
litellm_langfuse_sdk_media_upload

Conversation

@yucheng-berri

@yucheng-berri yucheng-berri commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Handwritten 1-3 sentence description

The langfuse callback uploads base64 images to Langfuse media storage again and leaves a short reference in the trace, where it has stored the whole image inline since v1.104.0.

Details

TLDR

Problem this solves:

  • The langfuse callback stopped uploading base64 images to Langfuse media storage
  • Images now land inline in the trace input, about 30 KB each
  • Self-hosted Langfuse stores them as is, so trace storage grows many times over
  • Downstream exports of the traces table run out of memory

How it solves it:

  • Replaces each base64 payload with the Langfuse media reference before export
  • Uploads the bytes through the Langfuse media REST API
  • Runs uploads on one background thread per export channel
  • Covers data URIs plus the Anthropic and Vertex typed blocks, as SDK v2 did, and Gemini inline_data parts, as the current Langfuse SDK does

User Flow

Before: a proxy admin on self-hosted Langfuse sees every image request stored with the full base64 image inside the trace

  1. The admin sets success_callback: ["langfuse"] in litellm_settings and points LANGFUSE_HOST at their Langfuse
  2. A developer sends POST http://localhost:4000/v1/chat/completions with an image_url whose url is data:image/png;base64,...
  3. The admin opens the trace in Langfuse and the input shows the whole data:image/png;base64,... string, tens of kilobytes per image
  4. Langfuse media storage has no file for that image

After: the same request stores a short media reference and the image itself sits in Langfuse media storage

  1. The admin keeps the same config
  2. The developer sends the same POST http://localhost:4000/v1/chat/completions
  3. The trace input shows @@@langfuseMedia:type=image/png|id=...|source=base64_data_uri@@@ in place of the image
  4. Langfuse renders the image from its media storage, where the uploaded file now sits

Affected release

Regression since v1.104.0-rc.1, the first version carrying the Langfuse SDK v4 migration (#36741). On SDK v2 the SDK did this replacement and upload before ingestion.

Behavior changes

  • The langfuse callback sends media references again instead of inline base64, for image, audio, PDF and the other content types Langfuse stores
  • For each payload the proxy now calls POST /api/public/media, the returned storage URL, and PATCH /api/public/media/{id} on the Langfuse host, from a background thread
  • This is the flow the Langfuse SDK and the Langfuse multi-modality docs use, and like the SDK it always writes the reference
    • A self-hosted Langfuse needs a media bucket (LANGFUSE_S3_MEDIA_UPLOAD_*), as those docs state. Without one every trace keeps a reference with no file, where main keeps the image inline
      • The same happens when a single upload fails. Approved by yucheng-berri on 2026-11-25
      • The same happens when the upload queue is full, as of 0de408ebef9. The image is skipped with a warning and counted as a failed upload, which is what the Langfuse SDK does. Before that commit the image stayed inline. Approved by yucheng-berri on 2026-11-26
  • New env setting LANGFUSE_MEDIA_QUEUE_MAX_BYTES sets how many bytes of decoded media may wait for upload per Langfuse credential set in each worker, 100 MB when unset. Approved by yucheng-berri on 2026-11-26
  • A payload with a content type Langfuse does not store stays inline, where SDK v2 wrote a reference and then failed the upload
  • A data URI followed by other text in the same string stays inline, so the text is kept
  • A Gemini inline_data or inlineData part is uploaded and its data replaced by the reference, added in 94df9454160. Main keeps it inline and SDK v2 did too, the current Langfuse SDK replaces it
    • The Gemini generateContent route logs the prompt text only on main and here, so this applies to a part that reaches the trace another way, such as request metadata
  • A request rejected for a missing or wrong LiteLLM key already logged a failure trace with the image, and now also uploads that image to Langfuse
    • Approved by yucheng-berri on 2026-11-25
  • Proxy shutdown waits for queued uploads, which took 9.0 s against 8.0 s on main in the audit run
    • Approved by yucheng-berri on 2026-11-25
  • The Langfuse flush at proxy shutdown now also reports failure when a media upload failed or did not finish in time, which adds a warning to the shutdown log
    • Approved by yucheng-berri on 2026-11-25
  • Nothing is removed or renamed and no config changes. langfuse_otel and the OTel v2 Langfuse path are untouched, they have always sent media inline

Regression tests: tests/unit/integrations/langfuse/test_langfuse_media.py, the media tests at the end of tests/unit/integrations/langfuse/test_langfuse_sdk.py, and tests/integration/observability/test_langfuse_delivery.py::test_langfuse_callback_uploads_a_base64_image_and_exports_only_its_media_reference.

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have added meaningful tests
  • The handful of test files covering my change pass locally, e.g. uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*, make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more
  • My PR passes all required CI/CD checks (e.g., lint, schema.d.ts sync check, etc.)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • Every automated review on my PR's latest commit has finished, and I have addressed or replied to each of its findings before requesting a maintainer review

Delays in PR merge?

If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).

Screenshots / Proof of Fix

One audit run on a Linux VM, all of it at e0fd39a3dda. Before is main's langfuse.py and langfuse_sdk.py at the merge base b7a83256e24 in the same tree, After is e0fd39a3dda. Both sides ran a real proxy with 4 workers and Postgres, real OpenAI (gpt-4o-mini), Bedrock Claude Haiku 4.5 and Gemini 2.5 Flash calls, and a self-hosted Langfuse 3.227.1 (langfuse/langfuse and langfuse/langfuse-worker with ClickHouse, Postgres, Redis and a MinIO media bucket). A recording proxy sits between LiteLLM and Langfuse, forwards every request unchanged and logs method, path, size and status, so the wire numbers below are what LiteLLM sent. Nothing in the product path is mocked.

Shared setup, env vars OPENAI_API_KEY, LANGFUSE_PUBLIC_KEY, LANGFUSE_SECRET_KEY, LITELLM_MASTER_KEY, and LANGFUSE_HOST pointing at the recording proxy.

model_list:
  - model_name: gpt-4o-mini
    litellm_params:
      model: openai/gpt-4o-mini
      api_key: os.environ/OPENAI_API_KEY
litellm_settings:
  success_callback: ["langfuse"]
  failure_callback: ["langfuse"]
general_settings:
  master_key: os.environ/LITELLM_MASTER_KEY
python litellm/proxy/proxy_cli.py --config config.yaml --port 24742 --num_workers 4
curl -s http://127.0.0.1:24742/v1/chat/completions -H "Authorization: Bearer $LITELLM_MASTER_KEY" -H "Content-Type: application/json" -d '{"model": "gpt-4o-mini", "max_tokens": 20, "messages": [{"role": "user", "content": [{"type": "text", "text": "Describe this image in five words."}, {"type": "image_url", "image_url": {"url": "data:image/png;base64,<a random noise PNG>"}}]}]}'
curl -s -u "$LANGFUSE_PUBLIC_KEY:$LANGFUSE_SECRET_KEY" "$LANGFUSE_HOST/api/public/observations?traceId=<trace id>"

Before (b7a8325)

  1. The request returns 200
  2. LiteLLM sends one trace export with 41,295 bytes of span attributes, the whole image inside it, and no media call
  3. The stored generation input holds the full data:image/png;base64,... string, which the Langfuse UI shows as a PNG chip
  4. Nothing is in media storage

Trace on main, self-hosted Langfuse 3.227.1, the input holds the base64 image

After (e0fd39a)

  1. The same request returns 200
  2. LiteLLM sends POST /api/public/media (201), uploads the 27,817 byte image to the returned storage URL, sends PATCH /api/public/media/YOOnzDEwPBHodP5SlZNhsl with uploadHttpStatus: 200, and exports a trace with 4,269 bytes of span attributes
  3. The stored generation input holds @@@langfuseMedia:type=image/png|id=YOOnzDEwPBHodP5SlZNhsl|source=base64_data_uri@@@ in place of the image
  4. GET /api/public/media/YOOnzDEwPBHodP5SlZNhsl returns the file, byte for byte the image that was sent

The screenshots are the same request shapes sent with a readable test image. They were retaken on eaf02c8da2e against main, except the Bedrock Claude one, which is from e0fd39a3dda.

Trace with the fix, chat completions, self-hosted Langfuse 3.227.1

Trace with the fix, /v1/messages on Bedrock Claude

Trace on main, /v1/responses

Trace with the fix, /v1/responses

Self-hosted Langfuse 4.85.0, before and after:

Trace on main, self-hosted Langfuse 4.85.0

Trace with the fix, self-hosted Langfuse 4.85.0

Trace on main, /v1/responses, self-hosted Langfuse 4.85.0

Trace with the fix, /v1/responses, self-hosted Langfuse 4.85.0

The audited requests on the LiteLLM Logs page:

LiteLLM Logs page with the audited requests

Audit matrix, base b7a8325 against head e0fd39a

Every row ran on both sides. "Same" means status, span count, span attribute keys, stored fields, metadata keys and the input with the image masked are equal.

Area Cells Result on head Other differences from base
/v1/chat/completions, /v1/messages, /v1/responses, by curl, OpenAI SDK and Anthropic SDK, sync and async, streaming and not, on OpenAI, Bedrock Claude and Gemini 19 200, reference stored, media identical to what was sent Same
callbacks: ["langfuse"] in place of success_callback 5 Reference stored, media identical Same
Key-level and team-level Langfuse credentials without a host 2 Reference stored, media identical Same
Invalid base64, data URI followed by prose, content type Langfuse does not store, text only 4 Stays inline or untouched Same
Image in request metadata, PDF, 5 MB image, 9-part message, same image 5 times, image in an earlier turn 10 References stored, the 5 MB export drops from 6,767,729 to 3,911 bytes Same
Wrong provider key (401), unknown model, image_url.url sent as an int, empty, 5 KB of text 5 Same status as base, failure trace logged Same
image_url.url sent as a list holding a data URI (400 on both sides) 1 The failure trace input holds a reference, the upload was registered and not confirmed Base keeps it inline
Request with no LiteLLM key (401) 1 Failure trace logged as on base, and its image is now uploaded too New media calls
Wrong Langfuse keys on a key 1 Nothing stored, request still 200, the next request on good keys stores its media Same
Burst of 30 mixed requests, 2 rounds 60 Every request exported once with its media stored, median latency 3.5 s and 3.1 s Base 3.3 s and 3.1 s
MinIO paused 20 s during a burst, 2 rounds 48 Every media file stored after it resumes Same
Media API slowed to 3 s per call, 2 rounds 36 Every media file confirmed, burst time unchanged Same
One worker killed 16 16 of 16 exported once, 16 media stored Same
Proxy stopped right after a burst 16 16 of 16 media stored before exit, exit takes 9.0 s Exit took 8.0 s on base
Langfuse unreachable for 15 s during a burst, 2 rounds 72 26 and 7 of 36 traces arrive, each with its media, no reference without a file Base delivered 22 and 11 of 36, the trace loss is not from this PR
Self-hosted Langfuse with no media bucket, 24 requests 24 All 24 traces carry a reference with no file, as with the current Langfuse SDK Base keeps all 24 inline
Bucket restored 60 Every trace is a reference with its media stored, starting with the first request -
Proxy left up 100 minutes, one request every 5 minutes, against self-hosted Langfuse 4.85.0 20 Media stored on every request c420bc31643, the head before the client fix, stops storing media at minute 85 with Cannot send a request, as the client has been closed
Chat completions, /v1/messages, /v1/responses and a request with an invalid proxy key, against Langfuse Cloud 4.86.0, self-hosted 3.227.1 and self-hosted 4.85.0 12 Reference stored, file byte-identical Base stores the base64 inline on both self-hosted versions
langfuse 4.7.0 and 4.18.0 installed with the head tree, pooled client evicted, then one upload 2 POST, PUT and PATCH all sent -
300,000 random payloads through extract_media at 9bf6e604107 and at e0fd39a3dda, with and without media, in four JSON layouts 300,000 Same output and same extracted media on every payload, 43,532 media-free payloads are no longer parsed -

A 1.1 MB media-free tool result with 12,000 rows, one of them "encoding": "base64", took 33.7 ms to scan at 9bf6e604107 and takes 0.96 ms at e0fd39a3dda.

The VM was shared and under load during the run, so latency numbers are for comparing the two sides only.

pytest tests/unit/integrations/langfuse gives 274 passed at e0fd39a3dda. The tests check that media-free values come back unchanged, the scan time is measured above and not pinned by a test.

Not run: S3 or GCS in place of MinIO, audio input, a proxy with Redis, and the full matrix against Langfuse 4.x and Langfuse Cloud.

Type

🐛 Bug Fix

Caveats (if any)

Medium

  • A failed upload leaves a reference with no stored file, as with the current Langfuse SDK
    • This includes a self-hosted Langfuse with no media bucket configured
    • SDK v2 did the same when the storage upload failed, but kept the image inline when POST /api/public/media itself failed, which is what a missing media bucket causes
  • A failure trace for a request rejected before the provider call keeps the image inline inside model parameters, on main and here
    • That field is a text dump of the request, so only the trace input gets the reference
  • Uploads waiting in memory are capped by LANGFUSE_MEDIA_QUEUE_MAX_BYTES, 100 MB of decoded media by default
    • An image that does not fit is not uploaded and its trace keeps the reference
    • Measured on a Linux VM with a Langfuse that never answers and 1,500 images of 1 MB each. Memory grew 101 MB with the cap, 1.5 GB with the cap removed, and 1.5 GB on Langfuse SDK 4.15.2, whose queue is capped at 100,000 items
    • The setting is not on the docs site yet, so it is listed with the internal tuning settings in tests/documentation_tests/test_env_keys.py
  • A process forked after the first logged call uploads its own media, as the Langfuse SDK does
    • 66bd514a538 gives the forked child its own upload queue and thread. Before it, the child wrote references that nothing uploaded
    • Proven by a unit test and by a script that forks after one upload. The child's upload did not finish before the fix and finishes after it
    • Run again live at 66bd514a538 against main with 4 workers. The 12 cells on Langfuse Cloud, self-hosted 3.227.1 and 4.85.0 store a reference and a byte-identical file, and the 19 endpoint cells, the sad and edge cells, the worker kill and the stop after a burst match main apart from the image. The chaos bursts, the no bucket leg and the long uptime leg were not run again at this commit
    • Run again live at 94df9454160 against main with 4 workers, the full matrix except the long uptime leg. Every cell matches main apart from the image, including both chaos rounds and the no bucket leg. The Bedrock Claude cells returned 403 on both sides from an expired test credential, so they covered the failure trace only
    • A request with a Gemini inline_data part and one with an inlineData part in metadata, run on a Mac against Langfuse Cloud. 94df9454160 stores the reference and the file, main stores the base64
    • Run again live at eaf02c8da2e against main with 4 workers, the same matrix plus the Gemini metadata requests and a full queue leg. Every cell matches main apart from the image. With LANGFUSE_MEDIA_QUEUE_MAX_BYTES=1000 the trace holds the reference, no upload is sent and the proxy logs the full queue warning, while main keeps the base64. The Bedrock Claude cells returned 403 on both sides again and the long uptime leg was not run
  • The upload address comes from the Langfuse host
    • It is used as given, for a host the operator configured and for one set in key or team callback settings
      • 484ba0f1705 removed the validate_url check on it. The key or team Langfuse host is not validated by default, so the check added no protection, and it refused storage that is private or reachable only through an egress proxy
      • Run live at 66bd514a538 on self-hosted Langfuse 3.227.1 with the media bucket on 127.0.0.1. The four key and team host cells store a reference and a byte-identical file, where e0fd39a3dda left a reference with no file and main keeps the image inline
    • The upload does not follow redirects
    • Langfuse is told the storage status, never the storage response body
  • One upload thread per credential set, so slow storage delays media, never traces
  • Proxy shutdown flush waits for uploads within its existing 10 s cap
  • Queued uploads get 5 s to finish when the export channel shuts down

Low

  • Payloads nested more than 10 levels deep stay inline, as on SDK v2
  • Langfuse Cloud already extracted inline media server side, so Cloud users see no change in stored traces
  • The audit matrix used self-hosted Langfuse 3.227.1. Langfuse 4.85.0 and Cloud 4.86.0 got the four request shapes and the long-uptime leg only

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

Devin Review


Note

Medium Risk
Changes observability export behavior and adds async HTTP to operator-supplied storage URLs; failed or full-queue uploads can leave traces with references but no stored file, and proxy shutdown/flush timing now depends on media upload completion.

Overview
Restores Langfuse SDK v2-style handling of multimodal traces: base64 payloads in observation input/output/metadata are swapped for @@@langfuseMedia:...@@@ references before OTLP export, while decoded bytes are registered and uploaded via Langfuse’s media REST API (POST /api/public/media, storage PUT, PATCH confirmation) on a per-credential background thread.

Adds litellm/integrations/langfuse/langfuse_media.py with extract_media (data URIs, Anthropic/Vertex typed blocks, Gemini inline_data), bounded queue sizing via LANGFUSE_MEDIA_QUEUE_MAX_BYTES (default 100 MB), fork-safe upload restarts, and no redirect following on storage PUTs. langfuse_sdk.py wraps the span exporter in _MediaExtractingExporter, builds a MediaUploader for live channels (skipped in mock mode), and LangfuseTracing.flush now waits for pending/failed uploads as well as trace batches.

Regression and integration tests cover extraction edge cases, upload retries, queue limits, and end-to-end proxy → Langfuse delivery without inline base64 in exported spans.

Reviewed by Cursor Bugbot for commit eaf02c8. Bugbot is set up for automated code reviews on this repo. Configure here.

…langfuse callback

The v2 SDK replaced base64 payloads in a trace's input, output and metadata with
Langfuse media references and uploaded the bytes before ingestion. The v4 export
channel sends spans through litellm's own exporter, which had no such step, so
images reached Langfuse inline and multiplied the stored trace size on servers
that do not extract them.

The export channel now replaces data URIs and the Anthropic and Vertex typed
blocks with the same references and uploads the bytes through the Langfuse media
REST API on one background thread per channel.
@veria-ai

veria-ai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

PR overview

All previously flagged issues have been addressed. No open security concerns remain on this pull request.

Fixed/addressed: 3 · PR risk: 0/10

Reviews

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

1 similar comment
@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Devin Review found 4 potential issues.

5 flags not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

@greptile-apps

greptile-apps Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · The PR appears safe to merge, with both numbered findings fixed and no new actionable issues found.RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with both numbered findings fixed and no new actionable issues found.

Summary

Restores Langfuse media uploads and replaces inline base64 with media references. The latest changes fix the inherited failure lock after a fork and remove a race from the queue test.

yucheng-berri accepted missing files after failed uploads because the Langfuse SDK also requires media storage and keeps references on failure. They also accepted skipping sibling fields after matching Gemini media because this matches the SDK and Gemini parts hold one content kind.

  • The Langfuse callback exports media references and uploads the media separately.

Reviews (18) · Last reviewed commit: "fix(langfuse): give a forked child its o..." · Reviewed by Greptile

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

…age response

Media the uploader has no room for now stays inline in the span, the cap counts
decoded bytes, and a failed upload makes flush report failure. The storage PUT
no longer follows redirects and Langfuse is told the storage status without the
storage response body. A data URI followed by text is left as it is, trace level
media is registered without an observation, and queued uploads get five seconds
to finish at shutdown.
@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

…eue an attribute's media as a whole

A Langfuse host that comes with a key's or team's credentials now has the upload
URLs it returns checked with validate_url, so it cannot point the upload at an
internal address. A host the operator configured keeps naming its own storage.
The media of one attribute is queued all together or not at all, so an attribute
that stays inline no longer leaves part of its media uploading.
@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

A Langfuse with no media route or bucket, or one whose upload URL is refused, answers the same
way for every payload. After the first such answer the uploader turns media away, so the exporter
keeps it inline, and one upload per pause checks whether Langfuse takes media again.
@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

The span export keeps trying through a short Langfuse outage, so a trace could arrive with a
reference whose single registration attempt had failed. Registration now waits out the same delays.
@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

A call rejected before the provider, such as an unknown model or a failed key check, is logged
with its request body as the model parameters, which left the image inline in those traces.
@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

@greptileai

@yucheng-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

…hosts

The Langfuse host on a key or team is not validated by default, so checking only the
upload URL it returns added no protection. The check resolved DNS on the proxy and
refused storage that is private or reachable only through an egress proxy, which left
the trace with a media reference and no file.
…media_upload

# Conflicts:
#	tests/code_coverage_tests/recursive_detector.py
A fork copies the upload queue but none of the parent's threads, so a child forked after
the first logged call wrote media references that nothing uploaded. The child now gets
its own queue and thread, and the parent keeps uploading what it had queued.
@yucheng-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

The Langfuse SDK replaces Gemini inline_data and inlineData parts with a media reference. The callback now does the same, so a Gemini-native request with an image no longer stores its base64 inline.
@yucheng-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

…op keeping media inline when it is full

LANGFUSE_MEDIA_QUEUE_MAX_BYTES sets how many decoded bytes wait for upload per
export channel, 100 MB when unset. Media that does not fit is no longer kept
inline in the span: the span carries the reference, the upload is skipped with
a warning and counted as failed, as the Langfuse SDK does when its queue is
full.
@yucheng-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

A lock a parent thread held at the fork stays locked in the child. The queue
test now holds the first upload until the second has been turned away.
@yucheng-berri

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit eaf02c8. Configure here.

@yucheng-berri
yucheng-berri merged commit 14c4a6f into main Nov 27, 2026
118 checks passed
@yucheng-berri
yucheng-berri deleted the litellm_langfuse_sdk_media_upload branch November 27, 2026 19:29
mateo-berri added a commit that referenced this pull request Nov 28, 2026
… request's logged input (#54928)

Since #53934 the Langfuse callback replaces a base64 image in the exported input with its
media reference, so a refused request that carries an image no longer logs the base64 itself.
The image endpoints now expect the reference and not the base64, and the text endpoints keep
expecting the prompt inline

Co-authored-by: mateo <277851410+mateo-berri@users.noreply.github.com>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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