Skip to content

fix(mastra): transform LLM input/output for Braintrust Thread view#2213

Open
Cedric / ViaDézo1er (viadezo1er) wants to merge 1 commit into
mainfrom
cedric/thread-view-llm-io-transform
Open

fix(mastra): transform LLM input/output for Braintrust Thread view#2213
Cedric / ViaDézo1er (viadezo1er) wants to merge 1 commit into
mainfrom
cedric/thread-view-llm-io-transform

Conversation

@viadezo1er

Copy link
Copy Markdown
Contributor

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.

@viadezo1er Cedric / ViaDézo1er (viadezo1er) force-pushed the cedric/thread-view-llm-io-transform branch 4 times, most recently from 636e135 to 0526243 Compare July 9, 2026 19:16
@viadezo1er Cedric / ViaDézo1er (viadezo1er) marked this pull request as ready for review July 9, 2026 19:28
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.
@viadezo1er Cedric / ViaDézo1er (viadezo1er) force-pushed the cedric/thread-view-llm-io-transform branch from 0526243 to 655a42d Compare July 9, 2026 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant