https://www.boundaryml.com logo
I was wondering if I can separate the parser of BA...
# general
s
I was wondering if I can separate the parser of BAML — that is central to structured output accuracy — and use it on the LLM call results in my voice agent SDK? SDKs like pipecat make it a hard to use BAML functions directly partly because the LLM provider calling and tool calling is part of the SDK's internal code. So instead of schema based fn calling:
usercode[prompt + fn(a:str, b:enum, c:int)->z] -> PipecatSDK[LLM call -> LLM function_call] -> usercode[compute function]
I can hack a catch all fn that gets a JSON and calls the parser, something like :
usercode[prompt + catch all fn(x: Any) -> z ] -> PipecatSDK[LLM call -> LLM function_call] -> usercode[fn(x): forward to BAMLParser(x) ]
The schema to the GPT-4.1 can be:
Copy code
{
  "type": "function",
  "function": {
    "name": "fn",
    "description": "Handles an arbitrary user-supplied JSON payload.",
    "strict": false,
    "parameters": {
      "type": "object",
      "properties": {
        "payload": {
          "type": "object",
          "description": "Arbitrary JSON object. May contain any keys."
        }
      },
      "required": [
        "payload"
      ]
    }
  }
}