Skip to main content
ABV supports multi-modal traces including text, images, audio, and other attachments. By default, base64 encoded data URIs are handled automatically by the ABV SDKs. They are extracted from the payloads commonly used in multi-modal LLMs, uploaded to ABV’s object storage, and linked to the trace. This also works if you:
  1. Reference media files via external URLs.
  2. Customize the handling of media files in the SDKs via the ABVMedia class.
  3. Integrate via the ABV API directly.
Learn more on how to get started and how this works under the hood below. Examples:

Supported media formats

ABV supports:
  • Images: .png, .jpg, .webp
  • Audio files: .mpeg, .mp3, .wav
  • Other attachments: .pdf, plain text

Get Started

Base64 data URI encoded media

If you use base64 encoded images, audio, or other files in your LLM applications, upgrade to the latest version of the ABV SDKs. The ABV SDKs automatically detect and handle base64 encoded media by extracting it, uploading it separately as a ABV Media file, and including a reference in the trace. This works with standard Data URI (MDN) formatted media (like those used by OpenAI and other LLMs). For examples using the OpenAI SDK and LangChain, refer to the Python SDK instrumentation guide or JavaScript/TypeScript SDK instrumentation guide.

External media (URLs)

ABV supports in-line rendering of media files via URLs if they follow common formats. In this case, the media file is not uploaded to ABV’s object storage but simply rendered in the UI directly from the source.

Supported formats:

Markdown images
OpenAI content parts

Custom attachments

If you want to have more control or your media is not base64 encoded, you can upload arbitrary media attachments to ABV via the SDKs using the new ABVMedia class. Wrap media with ABVMedia before including it in trace inputs, outputs, or metadata. See the multi-modal documentation for examples.

Python SDK

Install package

JS/TS SDK

Install packages
Add credentials Add your ABV credentials to your environment variables. Make sure that you have a .env file in your project root and a package like dotenv to load the variables. Createinstrumentation.ts file and use dotenv package to load the variables. Additional parameters are provided to get trace visible in the UI immediately. Import the instrumentation.ts file at the top of your application.

API

If you use the API directly to log traces to ABV, you need to follow these steps:

1) Upload media to ABV

  1. If you use base64 encoded media: you need to extract it from the trace payloads similar to how the ABV SDKs do it.
  2. Initialize the upload and get a mediaId and presignedURL: POST /api/public/media.
  3. Upload media file: PUT [presignedURL].
See the Public API documentation for details on using the API directly to upload media files.

2) Add reference to mediaId in trace/observation

Use the ABV Media Token to reference the mediaId in the trace or observation input, output, or metadata.

How does it work?

When using media files (that are not referenced via external URLs), ABV handles them in the following way:

1. Media Upload Process

Detection and Extraction

  • ABV supports media files in traces and observations on input, output, and metadata fields
  • SDKs separate media from tracing data client-side for performance optimization
  • Media files are uploaded directly to object storage (AWS S3 or compatible)
  • Original media content is replaced with a reference string

Security and Optimization

  • Uploads use presigned URLs with content validation (content length, content type, content SHA256 hash)
  • Deduplication: Files are simply replaced by their mediaId reference string if already uploaded
  • File uniqueness determined by project, content type, and content SHA256 hash

Implementation Details

  • Python SDK: Background thread handling for non-blocking execution
  • JS/TS SDKs: Asynchronous, non-blocking implementation
  • API support for direct uploads (see Public API documentation)

2. Media Reference System

The base64 data URIs and the wrapped ABVMedia objects in ABV traces are replaced by references to the mediaId in the following standardized token format, which helps reconstruct the original payload if needed:
  • MIME_TYPE: MIME type of the media file, e.g., image/jpeg
  • ABV_MEDIA_ID: ID of the media file in ABV’s object storage
  • SOURCE_TYPE: Source type of the media file, can be base64_data_uri, bytes, or file
Based on this token, the ABV UI can automatically detect the mediaId and render the media file inline. The ABVMedia class provides utility functions to extract the mediaId from the reference string.

3. Resolving Media References

When dealing with traces, observations, ~~or ~~dataset items that include media references, you can convert them back to their base64 data URI format using the resolve_media_references utility method provided by the ABV client. This is particularly useful for reinserting the original content during fine-tuning, dataset runs, or replaying a generation. The utility method traverses the parsed object and returns a deep copy with all media reference strings replaced by the corresponding base64 data URI representations.

Python SDK

JS/TS SDK