Optional ReadonlycontentThe size of the media record in bytes
ReadonlycontentThe MIME type of the media record
ReadonlymediaThe unique Langfuse identifier of the media record
ReadonlyurlThe signed download URL of the media record
Optional ReadonlyurlThe expiry date and time (ISO 8601) of the signed download URL
Fetches the media over the network and returns raw base64 (no data URI prefix).
Useful for Anthropic ({ source: { type: "base64", media_type: media.contentType, data: await media.fetchBase64() } })
or LangChain ({ type: "image", base64: await media.fetchBase64(), mime_type: media.contentType }).
The media content as a base64 string
Fetches the media content from the signed URL over the network.
Useful for local evaluators / image libraries, manual base64 conversion, or
the Vercel AI SDK ({ type: "image", image: await media.fetchBytes() }).
The media content as raw bytes
Returns whether the signed download URL is expired or near expiry.
Treat the URL as expired this many seconds before its actual expiry to account for clock skew and download time (default: 60).
true if the URL is expired or within the threshold of expiry. If the expiry is unknown or unparseable, returns false.
A resolved reference to a media record stored in Langfuse.
Returned when fetching dataset items with
resolveMediaReferences: true. It holds the media metadata and a signed download URL, and exposes helpers to fetch the content in the formats commonly expected by LLM providers.The signed
urlis short-lived. Fetch the content promptly, or re-fetch the dataset item if LangfuseMediaReference.urlIsExpired returns true.Example: Feeding media to a provider