Ark/bra 3203 otel attachments #38
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Braintrust-friendly attachments, conforming to otel genai semconv
tl;dr
Attachmentutil which serializes attachments in a way Braintrust will recognizeto implement otel Support in an SDK
Attachmentutil which:Attachment Examples
And the instrumentation will use this util to map vendor-specific message parts. For example, OAI image_url:
--->
{ type: "base64_attachment", content: "data:image/jpeg;base64,SOME_BASE64" }details
Otel genai semconv does not actually define a format for attachments or images, so we have to map vendor-specific formats to something Braintrust can understand. We do this with our own GenericPart message as defined in the otel input/output message json schemas
Braintrust recognizes three attachment types.
{ type: "base64_attachment", content: "SOME_BASE64" }{ type: "braintrust_attachment", filename, key, content_type }{ type: "inline_attachment", filename, src, content_type }Currently, the SDK will send
base64_attachmentand the backend will convert it tobraintrust_attachmentIn the future, the SDK may do this conversion before sending traces. If we decide to go that route, this will not require any code changes for SDK users. It will happen somewhere in the implementation (probably a span processor).