baml icon indicating copy to clipboard operation
baml copied to clipboard

Expose jsonish parser to language bindings

Open antoniomdk opened this issue 1 year ago • 0 comments

In some cases, the BAML DSL can add some friction in adoption, for example, lack of tooling (IDE integrations, linters, etc.), plus it requires using a custom LLM client.

I think the key differentiator of BAML is the flexible parser + typescript-ish schema generator. If we can get access to both tools as Python/TS functions, it will open the doors for many integrations that rely on commonly used LLM clients like the OpenAI SDK.

The current bindings already expose primitives to generate BAML types from code, so we could have a function that takes the type object + LLM response and returns a parsed object. Another function that generates the schema representation from the types object is required to pass it as part of the prompt.

Note: forgive me if some of this functionality is already exposed, I couldn't find it in the codebase.

antoniomdk avatar Oct 01 '24 00:10 antoniomdk