Reorx’s Forge 头像

消息来源频道

Reorx’s Forge

@reorx_share

频道3,130 位成员公开可见0 人在线

A chronicle of my journey in forging my ideas into writings and products. Archive: https://app.shokichan.com/c/tg/reorx_share

成员规模3,130 位成员
在线情况0 人在线
消息总数6,041 条消息
浏览量总数784,746 次浏览

在这个频道里搜索消息……

t.me/reorx_share

BAML 发明了一种新的语言,来构建可以作为 building block 使用的 LLM 函数。一开始我以为这是个 agent framework, 但仔细阅读后发现,它更适合作为一个「编配 prompt + 发起向 LLM 的请求 + 结构化解析 LLM 返回数据」的组件,来帮助你更好地构建 AI 应用。BAML 解决的是 LLM I/O 的工程化问题,使上层业务可以专注于 workflow、RAG、agent 等应用层逻辑的维护,减少重复代码,增加与 LLM 交互的鲁棒性。
https://github.com/boundaryml/baml
之前看过一个 Python 库 guidance 有着类似的想法,也是将 LLM 调用函数化,但我觉得 BAML 更让人信服,它背后的公司 Boundary 对 LLM 的结构化输出有很多自己的理解和研究,他们提出了一个理念叫 Schema Aligned Parsing, 来代替目前主流的 JSON schema 方案。这两篇文章解释了 SAP 的原理以及为什么要这么做:
- https://www.boundaryml.com/blog/schema-aligned-parsing
- https://www.boundaryml.com/blog/type-definition-prompting-baml
这篇文章用数据说明了 BAML 的 SAP 方案在准确性和成本控制上超越 OpenAI 的 function calling: https://www.boundaryml.com/blog/sota-function-calling
关于为什么发明一种新的语言,BAML 的开发者们认为,就像我们从 inline javascript 进化到 JSX, 新的语法是从新的想法和需求中应运而生的,而且维护几百个 f-string 让人恶心。这点我特别赞同,不得不 quote 一下原文:
…the idea of maintaining hundreds of f-strings for prompts kind of disgusts us 🤮. Strings are bad for maintainable codebases. We prefer structured strings.
另外,BAML 还有一个可以在线运行的 playground,能非常直观地理解它到底是什么、可以怎么用:
https://www.promptfiddle.com/