AI applications are increasingly expanding beyond text input and output to accept and generate images, audio, video, and more. At Braintrust, we are committed to supporting these advanced capabilities. Today, we’re excited to share that you can now upload, download, and contextually view attachments in Braintrust.
Until today, you could log text, structured data, and images (base64 or URLs) to Braintrust. Now, you can upload any type of binary attachment. Once the upload is complete, you can view images, audio, video, and PDF files right inside your traces.
To upload an attachment, create a new Attachment object to represent the file path or in-memory buffer that you want to upload:
const logger = initLogger();
logger.log({
input: {
question: "What is this?",
context: new Attachment({
data: "path/to/input_image.jpg",
filename: "user_input.jpg",
contentType: "image/jpeg",
}),
},
output: "Example response.",
});
You can place the Attachment anywhere in a log, dataset, or feedback log.
Behind the scenes, the Braintrust SDK automatically detects and uploads attachments in the background, in parallel to the original logs. This ensures that the latency of your logs isn’t affected by any additional processing.
Your files are securely stored in an object store and associated with the uploading user’s organization. Only you can access your attachments.
If your trace has any attachments, they show up as an additional list under the data viewer in the trace pane. You can preview most images, audio files, videos, or PDFs in the Braintrust UI. You can also download any file to view it locally.
Uploading, downloading, and viewing attachments not only simplifies debugging, but also provides observability for multimodal and complex applications. You can use it to log:
JSONAttachment, which automatically converts inline JSON to attachments when you need to bypass size limits.Try out attachments today and let us know what you think. And if you have strong opinions on how complex evals should be implemented, come work with us.