Package dev.braintrust.trace
Class Base64Attachment
java.lang.Object
dev.braintrust.trace.Base64Attachment
Utility to serialize LLM attachment data in a braintrust-friendly manner.
Users of the SDK likely don't need to use this utility directly because instrumentation will properly serialize messages out of the box.
The serialized json will conform to the otel input/output GenericPart schema. See https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-input-messages.json and https://opentelemetry.io/docs/specs/semconv/gen-ai/gen-ai-output-messages.json
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic com.fasterxml.jackson.databind.JsonSerializer<Base64Attachment>create a jackson serializer for attachment datagetType()static Base64AttachmentCreate a new attachment out of base64 datastatic Base64AttachmentofFile(Base64Attachment.ContentType contentType, String filePath) convenience utility to convert a file to a base64 attachment
-
Method Details
-
of
Create a new attachment out of base64 data- Parameters:
base64DataUri- must conform to data:(content-type);base64,BYTES
-
ofFile
convenience utility to convert a file to a base64 attachment -
createSerializer
create a jackson serializer for attachment data -
getType
-
getBase64Data
-