[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-5547":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":23,"hasPages":23,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":38,"readmeContent":39,"aiSummary":40,"trendingCount":16,"starSnapshotCount":16,"syncStatus":41,"lastSyncTime":42,"discoverSource":43},5547,"baml","BoundaryML\u002Fbaml","BoundaryML","The AI framework that adds the engineering to prompt engineering (Python\u002FTS\u002FRuby\u002FJava\u002FC#\u002FRust\u002FGo compatible)","https:\u002F\u002Fdocs.boundaryml.com",null,"Rust",8350,430,31,188,0,5,17,142,18,92.4,"Apache License 2.0",false,"canary",[5,26,27,28,29,30,31,32,33,34,35,36,37],"boundaryml","guardrails","llm","llm-playground","playground","prompt","prompt-config","prompt-templates","structured-data","structured-generation","structured-output","vscode","2026-06-12 04:00:25","\u003Cdiv align=\"center\">\n\u003Ca href=\"https:\u002F\u002Fboundaryml.com?utm_source=github\" target=\"_blank\" rel=\"noopener noreferrer\">\n  \u003Cpicture>\n    \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"fern\u002Fassets\u002Fbaml-lamb-white.png\">\n    \u003Cimg src=\"fern\u002Fassets\u002Fbaml-lamb-white.png\" height=\"64\" id=\"top\">\n  \u003C\u002Fpicture>\n\u003C\u002Fa>\n\n\u003C\u002Fdiv>\n\n\u003Cdiv align=\"center\">\n\n[![BAML Version](https:\u002F\u002Fimg.shields.io\u002Fpypi\u002Fv\u002Fbaml-py?color=006dad&label=BAML%20Version)](https:\u002F\u002Fpypi.org\u002Fproject\u002Fbaml-py\u002F)\n\n## BAML: Basically a Made-up Language\n\u003Ch4>\n\n[Homepage](https:\u002F\u002Fwww.boundaryml.com\u002F) | [Docs](https:\u002F\u002Fdocs.boundaryml.com) | [BAML AI Chat](https:\u002F\u002Fwww.boundaryml.com\u002Fchat) | [Discord](https:\u002F\u002Fdiscord.gg\u002FBTNBeXGuaS)\n\n\n\n\u003C\u002Fh4>\n\n\n\u003C\u002Fdiv>\n\nBAML is a simple prompting language for building reliable **AI workflows and agents**.\n\nBAML makes prompt engineering easy by turning it into _schema engineering_ -- where you mostly focus on the models of your prompt -- to get more reliable outputs. \nYou don't need to write your whole app in BAML, only the prompts! You can wire-up your LLM Functions in any language of your choice! See our quickstarts for [Python](https:\u002F\u002Fdocs.boundaryml.com\u002Fguide\u002Finstallation-language\u002Fpython), [TypeScript](https:\u002F\u002Fdocs.boundaryml.com\u002Fguide\u002Finstallation-language\u002Ftypescript), [Ruby](https:\u002F\u002Fdocs.boundaryml.com\u002Fguide\u002Finstallation-language\u002Fruby) and [Go, and more](https:\u002F\u002Fdocs.boundaryml.com\u002Fguide\u002Finstallation-language\u002Frest-api-other-languages).\n\nBAML comes with all batteries included -- with full typesafety, streaming, retries, wide model support, even when they don't support native [tool-calling APIs](#enable-reliable-tool-calling-with-any-model)\n\n**Try BAML**: [Prompt Fiddle](https:\u002F\u002Fwww.promptfiddle.com) • [Interactive App Examples](https:\u002F\u002Fbaml-examples.vercel.app\u002F)\n\n\n## The core BAML principle: LLM Prompts are functions\n\nThe fundamental building block in BAML is a function. Every prompt is a function that takes in parameters and returns a type.\n\n```rust\nfunction ChatAgent(message: Message[], tone: \"happy\" | \"sad\") -> string\n```\n\nEvery function additionally defines which models it uses and what its prompt is.\n\n```rust\nfunction ChatAgent(message: Message[], tone: \"happy\" | \"sad\") -> StopTool | ReplyTool {\n    client \"openai\u002Fgpt-4o-mini\"\n\n    prompt #\"\n        Be a {{ tone }} bot.\n\n        {{ ctx.output_format }}\n\n        {% for m in message %}\n        {{ _.role(m.role) }}\n        {{ m.content }}\n        {% endfor %}\n    \"#\n}\n\nclass Message {\n    role string\n    content string\n}\n\nclass ReplyTool {\n  response string\n}\n\nclass StopTool {\n  action \"stop\" @description(#\"\n    when it might be a good time to end the conversation\n  \"#)\n}\n```\n\n## BAML Functions can be called from any language\nBelow we call the ChatAgent function we defined in BAML through Python. BAML's Rust compiler generates a \"baml_client\" to access and call them.\n\n```python\nfrom baml_client import b\nfrom baml_client.types import Message, StopTool\n\nmessages = [Message(role=\"assistant\", content=\"How can I help?\")]\n\nwhile True:\n  print(messages[-1].content)\n  user_reply = input()\n  messages.append(Message(role=\"user\", content=user_reply))\n  tool = b.ChatAgent(messages, \"happy\")\n  if isinstance(tool, StopTool):\n    print(\"Goodbye!\")\n    break\n  else:\n    messages.append(Message(role=\"assistant\", content=tool.response))\n```\nYou can write any kind of agent or workflow using chained BAML functions. An agent is a while loop that calls a Chat BAML Function with some state.\n\nAnd if you need to stream, add a couple more lines:\n```python\nstream = b.stream.ChatAgent(messages, \"happy\")\n# partial is a Partial type with all Optional fields\nfor tool in stream:\n    if isinstance(tool, StopTool):\n      ...\n    \nfinal = stream.get_final_response()\n```\nAnd get fully type-safe outputs for each chunk in the stream.\n\n## Test prompts 10x faster, right in your IDE\nBAML comes with native tooling for [VS Code](https:\u002F\u002Fdocs.boundaryml.com\u002Fguide\u002Finstallation-editors\u002Fvs-code-extension) and [JetBrains IDEs](https:\u002F\u002Fdocs.boundaryml.com\u002Fguide\u002Finstallation-editors\u002Fjetbrains), with support for [other editors](https:\u002F\u002Fdocs.boundaryml.com\u002Fguide\u002Finstallation-editors\u002Fothers) continuing to expand.\n\n**Visualize full prompt (including any multi-modal assets), and the API request**. BAML gives you full transparency and control of the prompt.\n\n![raw-curl](https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002Fc0b34db9-80cd-45a7-a356-6b5ab4a9c5b7)\n\n**Using AI is all about iteration speed.**\n\nIf testing your pipeline takes 2 minutes, you can only test 10 ideas in 20 minutes.\n\nIf you reduce it to 5 seconds, you can test 240 ideas in the same amount of time.\n![resume-attempt2-smaller2](https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F6fc6b8a6-ffed-4cfc-80b8-78bc8a3d66a6)\n\nThe playground also allows you to run tests in parallel -- for even faster iteration speeds 🚀.\n\nNo need to login to websites, and no need to manually define json schemas.\n\n## Enable reliable tool-calling with any model\nBAML works even when the models don't support native tool-calling APIs. We created the SAP (schema-aligned parsing) algorithm to support the flexible outputs LLMs can provide, like markdown within a JSON blob or chain-of-thought prior to answering. [Read more about SAP](https:\u002F\u002Fwww.boundaryml.com\u002Fblog\u002Fschema-aligned-parsing)\n\nWith BAML, your structured outputs work in Day-1 of a model release. No need to figure out whether a model supports parallel tool calls, or whether it supports recursive schemas, or `anyOf` or `oneOf` etc.\n\nSee it in action with: **[Deepseek-R1](https:\u002F\u002Fwww.boundaryml.com\u002Fblog\u002Fdeepseek-r1-function-calling)** and [OpenAI O1](https:\u002F\u002Fwww.boundaryml.com\u002Fblog\u002Fopenai-o1).\n\n\n\n## Switch from 100s of models in a couple lines\n```diff\nfunction Extract() -> Resume {\n+  client openai\u002Fo3-mini\n  prompt #\"\n    ....\n  \"#\n}\n```\n[Retry policies](https:\u002F\u002Fdocs.boundaryml.com\u002Fref\u002Fllm-client-strategies\u002Fretry-policy) • [fallbacks](https:\u002F\u002Fdocs.boundaryml.com\u002Fref\u002Fllm-client-strategies\u002Ffallback) • [model rotations](https:\u002F\u002Fdocs.boundaryml.com\u002Fref\u002Fllm-client-strategies\u002Fround-robin). All statically defined.\n![Fallback Retry](https:\u002F\u002Fwww.boundaryml.com\u002Fblog\u002F2025-01-24-ai-agents-need-a-new-syntax\u002F06-fallback-retry.gif)\nWant to do pick models at runtime? Check out the [Client Registry](https:\u002F\u002Fdocs.boundaryml.com\u002Fguide\u002Fbaml-advanced\u002Fllm-client-registry).\n\nWe support: [OpenAI](https:\u002F\u002Fdocs.boundaryml.com\u002Fref\u002Fllm-client-providers\u002Fopen-ai) • [Anthropic](https:\u002F\u002Fdocs.boundaryml.com\u002Fref\u002Fllm-client-providers\u002Fanthropic) • [Gemini](https:\u002F\u002Fdocs.boundaryml.com\u002Fref\u002Fllm-client-providers\u002Fgoogle-ai-gemini) • [Vertex](https:\u002F\u002Fdocs.boundaryml.com\u002Fref\u002Fllm-client-providers\u002Fgoogle-vertex) • [Bedrock](https:\u002F\u002Fdocs.boundaryml.com\u002Fref\u002Fllm-client-providers\u002Faws-bedrock) • [Azure OpenAI](https:\u002F\u002Fdocs.boundaryml.com\u002Fref\u002Fllm-client-providers\u002Fopen-ai-from-azure) • [Anything OpenAI Compatible](https:\u002F\u002Fdocs.boundaryml.com\u002Fref\u002Fllm-client-providers\u002Fopenai-generic) ([Ollama](https:\u002F\u002Fdocs.boundaryml.com\u002Fref\u002Fllm-client-providers\u002Fopenai-generic-ollama), [OpenRouter](https:\u002F\u002Fdocs.boundaryml.com\u002Fref\u002Fllm-client-providers\u002Fopenai-generic-open-router), [VLLM](https:\u002F\u002Fdocs.boundaryml.com\u002Fref\u002Fllm-client-providers\u002Fopenai-generic-v-llm), [LMStudio](https:\u002F\u002Fdocs.boundaryml.com\u002Fref\u002Fllm-client-providers\u002Fopenai-generic-lm-studio), [TogetherAI](https:\u002F\u002Fdocs.boundaryml.com\u002Fref\u002Fllm-client-providers\u002Fopenai-generic-together-ai), and more)\n\n## Build beautiful streaming UIs\nBAML generates a ton of utilities for NextJS, Python (and any language) to make streaming UIs easy.\n![recipe-generator](https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002Fcf82495b-21fc-40bf-ae98-93eef923d620)\n\nBAML's streaming interfaces are fully type-safe. Check out the [Streaming Docs](https:\u002F\u002Fdocs.boundaryml.com\u002Fguide\u002Fbaml-basics\u002Fstreaming), and our [React hooks](https:\u002F\u002Fdocs.boundaryml.com\u002Fguide\u002Fframework-integration\u002Freact-next-js\u002Fquick-start)\n\n## Fully Open-Source, and offline\n- 100% open-source (Apache 2)\n- 100% private. AGI will not require an internet connection, neither will BAML\n    - No network requests beyond model calls you explicitly set\n    - Not stored or used for any training data\n- BAML files can be saved locally on your machine and checked into Github for easy diffs.\n- Built in Rust. So fast, you can't even tell it's there.\n\n## BAML's Design Philosophy\n\nEverything is fair game when making new syntax. If you can code it, it can be yours. This is our design philosophy to help restrict ideas:\n\n- **1:** Avoid invention when possible\n    - Yes, prompts need versioning — we have a great versioning tool: git\n    - Yes, you need to save prompts — we have a great storage tool: filesystems\n- **2:** Any file editor and any terminal should be enough to use it\n- **3:** Be fast\n- **4:** A first year university student should be able to understand it\n\n## Why a new programming language\n\nWe used to write websites like this:\n\n```python\ndef home():\n    return \"\u003Cbutton onclick=\\\"() => alert(\\\\\\\"hello!\\\\\\\")\\\">Click\u003C\u002Fbutton>\"\n```\n\nAnd now we do this:\n\n```jsx\nfunction Home() {\n  return \u003Cbutton onClick={() => setCount(prev => prev + 1)}>\n          {count} clicks!\n         \u003C\u002Fbutton>\n}\n```\n\nNew syntax can be incredible at expressing new ideas. Plus the idea of maintaining hundreds of f-strings for prompts kind of disgusts us 🤮. Strings are bad for maintainable codebases. We prefer structured strings.\n\nThe goal of BAML is to give you the expressiveness of English, but the structure of code.\n\nFull [blog post](https:\u002F\u002Fwww.boundaryml.com\u002Fblog\u002Fai-agents-need-new-syntax) by us.\n\n\n## Conclusion\n\nAs models get better, we'll continue expecting even more out of them. But what will never change is that we'll want a way to write maintainable code that uses those models. The current way we all just assemble strings is very reminiscent of the early days PHP\u002FHTML soup in web development. We hope some of the ideas we shared today can make a tiny dent in helping us all shape the way we all code tomorrow.\n\n## FAQ\n|   |   |\n| - | - |\n| Do I need to write my whole app in BAML? | Nope, only the prompts! BAML translates definitions into the language of your choice! [Python](https:\u002F\u002Fdocs.boundaryml.com\u002Fguide\u002Finstallation-language\u002Fpython), [TypeScript](https:\u002F\u002Fdocs.boundaryml.com\u002Fguide\u002Finstallation-language\u002Ftypescript), [Ruby](https:\u002F\u002Fdocs.boundaryml.com\u002Fguide\u002Finstallation-language\u002Fruby) and [more](https:\u002F\u002Fdocs.boundaryml.com\u002Fguide\u002Finstallation-language\u002Frest-api-other-languages). |\n| Is BAML stable? | Yes, many companies use it in production! We ship updates weekly! |\n| Why a new language? | [Jump to section](#why-a-new-programming-language) |\n\n\n## Contributing\nCheckout our [guide on getting started](\u002FCONTRIBUTING.md)\n\n## Citation\n\nYou can cite the BAML repo as follows:\n```bibtex\n@software{baml,\n  author = {Boundary ML},\n  title = {BAML},\n  url = {https:\u002F\u002Fgithub.com\u002Fboundaryml\u002Fbaml},\n  year = {2024}\n}\n```\n\n---\n\nMade with ❤️ by Boundary\n\nHQ in Seattle, WA\n\nP.S. We're hiring for software engineers that love rust. [Email us](mailto:founders@boundaryml.com) or reach out on [discord](https:\u002F\u002Fdiscord.gg\u002FENtBB6kkXH)!\n\n\u003Cdiv align=\"left\" style=\"align-items: left;\">\n        \u003Ca href=\"#top\">\n            \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FBack%20to%20Top-000000?style=for-the-badge&logo=github&logoColor=white\" alt=\"Back to Top\">\n        \u003C\u002Fa>\n\u003C\u002Fdiv>\n\n\u003Cimg src=\"https:\u002F\u002Fimgs.xkcd.com\u002Fcomics\u002Fstandards.png\" alt_text=\"hi\" \u002F>\n","BAML是一个用于构建可靠的AI工作流和代理的简单提示语言。它通过将提示工程转化为模式工程，使开发者能够专注于提示模型本身，从而获得更稳定的结果。BAML支持多种编程语言如Python、TypeScript、Ruby等，并提供了类型安全、流式处理、重试机制以及广泛的模型兼容性等特性。适用于需要创建复杂但可控的人工智能交互场景，例如开发聊天机器人、自动化客户服务系统或任何涉及自然语言处理的应用程序。",2,"2026-06-11 03:03:53","top_language"]