Skip to content

[ENHANCEMENT] Use of BAML for parsing llm output to correct malformed responses #10481

@DarkEden-coding

Description

@DarkEden-coding

Problem (one or two sentences)

Hello! I have had some issues with llms like grok code that struggle with adhering to function definition format, to solve this I think that BAML may be a good solution https://boundaryml.com/. I would be willing to put some work into implementation as well. Any foreseen issues with using BAML for this?

Context (who is affected and when)

Everyone who uses llms that are not great at following specific output formats

Desired behavior (conceptual, not technical)

Would correct malformed output to correctly edit files and end conversations

Constraints / preferences (optional)

Simple toggle in settings (experimental for a while and somewhere else after). Uses rust so will be fast if we can use rust in the extension.

Request checklist

  • I've searched existing Issues and Discussions for duplicates
  • This describes a specific problem with clear context and impact

Roo Code Task Links (optional)

No response

Acceptance criteria (optional)

Given malformed output from Grok code (or others)
Then output should be automatically corrected client side and work correctly with current system
The malformed llm output should not affect the rest of the pipeline

Proposed approach (optional)

Take the output of the llm (streamed) and pipe it through the BAML system (I have not looked into detail on exact implementation with BAML)

Trade-offs / risks (optional)

Slight latency addition, possible issues with correct output to be malformed by BAML (unlikely)

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNew feature or requestIssue - Needs InfoMissing details or unclear. Waiting on author to provide more context.

    Type

    No type

    Projects

    Status

    Issue [Needs Info]

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions