fix(mastra): transform LLM input/output for Braintrust Thread view#2213
Draft
Cedric / ViaDézo1er (viadezo1er) wants to merge 1 commit into
Draft
fix(mastra): transform LLM input/output for Braintrust Thread view#2213Cedric / ViaDézo1er (viadezo1er) wants to merge 1 commit into
Cedric / ViaDézo1er (viadezo1er) wants to merge 1 commit into
Conversation
983f955 to
5966a4f
Compare
MODEL_GENERATION spans logged input/output verbatim, so Braintrust's
Thread view could not render them as a conversation. Unwrap input from
{ messages: [...] } into a bare chat-message array (and wrap a single
{ role, content } object), and reshape output { text, ...rest } into
{ role: 'assistant', content: text, ...rest }. Non-model spans are
unchanged.
Ports mastra-ai/mastra#10794 (fixes #9848). Adds js/src/wrappers/
mastra.test.ts and regenerates the mastra-instrumentation e2e snapshots.
The richer per-message AI-SDK->OpenAI conversion (convertAISDKMessage)
is tracked separately as thread-view-tool-call-rendering.
5966a4f to
ecad03f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
MODEL_GENERATION spans logged input/output verbatim, so Braintrust's
Thread view could not render them as a conversation. Unwrap input from
{ messages: [...] } into a bare chat-message array (and wrap a single
{ role, content } object), and reshape output { text, ...rest } into
{ role: 'assistant', content: text, ...rest }. Non-model spans are
unchanged.
Ports mastra-ai/mastra#10794 (fixes #9848). Adds js/src/wrappers/
mastra.test.ts and regenerates the mastra-instrumentation e2e snapshots.
The richer per-message AI-SDK->OpenAI conversion (convertAISDKMessage)
is tracked separately as thread-view-tool-call-rendering.