

Also from Kynth Studios


Also from Kynth Studios


Also from Kynth Studios
123456<Overview>7 BAML (Basically, A Made-Up Language) is a domain-specific language for building LLM prompts as functions.8 You can build an agentic workflow with BAML.9</Overview>1011 <Schema>12 // Define output schemas using classes13 class MyObject {14 // Optional string fields use ?15 // @description is optional, but if you include it, it goes after the field.16 name string? @description("The name of the object")1718 // Arrays of primitives19 // arrays cannot be optional.20 tags string[]2122 // Enums must be declared separately and are optional23 status MyEnum?2425 // Union types26 type "success" | "error"2728 // Primitive types29 count int30 enabled bool31 score float3233 // nested objects34 nested MyObject23536 // image type37 myImg image3839 {#// checks and assertions. Uses jinja syntax inside the parentheses.40 // For a single property use one @41 bar int @assert(between_0_and_10, {{ "{{ this > 0 and this < 10 }}" }}) //this = MyObject.bar value42 quux string43 // assertions for multiple fields use @@ and go at the bottom of the class. Uses jinja syntax inside the parentheses.44 // Do NOT add descriptions after the assertion.45 @@assert(length_limit, {{ "{{ this.quux|length < this.baz }}" }})#}46 }4748 // Enums are declared separately49 enum MyEnum {50 PENDING51 ACTIVE @description("Item is currently active")52 COMPLETE53 }5455 // Comments use double slashes56 // Recursive types and inline definitions are not supported5758 </Schema>5960 <Functions>61 // Functions define inputs, outputs and prompts62 // function name is always PascalCase63 function MyFunction(input: MyObject) -> string {64 client "openai/gpt-4o"65 // prompt with jinja syntax inside here. with double curly braces for variables.66 // make sure to include: \{\{ ctx.output_format \}\} in the prompt, which prints the output schema instructions so the LLM returns the output in the correct format (json or string, etc.). DO NOT write the output schema manually.67 prompt #"6869 "#70 }7172 <LLMClients>73 You can use any of the following:74 - openai/gpt-4o75 - openai/gpt-4o-mini76 - anthropic/claude-3-5-sonnet-latest (note the "3-5")77 - anthropic/claude-3-5-haiku-latest78 </LLMClients>7980 <Prompt>81 When writing the prompt:82 1. Make sure to include the input in the prompt (even if it's an image) using {{ "{{ input }}" }}83 2. Make sure to include {{ "{{ ctx.output_format }}" }} in the prompt so the LLM knows how to format the output.84 3. You do not need to specify to "answer in JSON format". Only write in the prompt brief instruction, and any other task-specific things to keep in mind for the task.85 4. Write a {{ "{{ _.role(\"user\") }}" }} tag to indicate where the user's inputs start. So if there's a convo you can write86 #"{{ "{{ _.role(\"user\") }}" }} {{ "{{ some-variable }}" }}#8788 DO NOT REPEAT output schema fields in the prompt. They are included with {{ "{{ ctx.output_format }}" }}.89```baml90 class TweetAnalysis {91 mainTopic string @description("The primary topic or subject matter of the tweet")92 isSpam bool @description("Whether the tweet appears to be spam")93 }9495 function ClassifyTweets(tweets: string[]) -> TweetAnalysis[] {96 client "openai/gpt-4o-mini"97 prompt #"98 Analyze each of the following tweets and classify them:99 {{ "{{ _.role(\"user\") }}" }} {{ "{{ tweets }}" }}100101 {{ "{{ ctx.output_format }}" }}102 "#103 }104```105 </Prompt>106107 </Functions>108109 <Usage in other languages>110 You can use BAML in python, typescript, and other languages.111112```python113 import asyncio114 from baml_client import b // this client is autogenerated115 from baml_client.types import WeatherAPI116117 def main():118 # In python, BAML functions are synchronous.119 weather_info = b.UseTool("What's the weather like in San Francisco?")120 print(weather_info)121 assert isinstance(weather_info, WeatherAPI)122 print(f"City: {weather_info.city}")123 print(f"Time of Day: {weather_info.timeOfDay}")124125 if __name__ == '__main__':126 main()127```128129```typescript130 import { b } from './baml_client' // this client is autogenerated131 import { WeatherAPI } from './baml_client/types'132 import assert from 'assert'133134 const main = async () => {135 const weatherInfo = await b.UseTool("What's the weather like in San Francisco?")136 console.log(weatherInfo)137 assert(weatherInfo instanceof WeatherAPI)138 console.log(`City: ${weatherInfo.city}`)139 console.log(`Time of Day: ${weatherInfo.timeOfDay}`)140 }141```142143 </Usage>144145Do NOT use numbers as confidence intervals if you need to use them. Prefer an enum with descriptions or literals like "high", "medium", "low".146Don't add confidence levels to extraction schemas.147148Don't use LLM functions to "validate" any other output. {#You should use @assert for that on each field in the output type. Search the docs for "assert" to see how to use it.#}149150Dedent all declarations.151152Note that the types exported by BAML are pydantic classes in python, and interfaces in Tyepscript, except for primitive types.
One repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| K-Mistele/opensearchAGENTS.md · 30 | AGENTS.md | buildtestlint-formatstyle+2 | 94/100 | 14 days ago | |
| K-Mistele/opensearch.cursor/rules/default.mdc · 30 | Cursor rules | buildtestlint-formatstyle+2 | 94/100 | 14 days ago | |
| K-Mistele/opensearch.cursor/rules/opensearch-project-structure.mdc · 30 | Cursor rules | setupteststylearch+4 | 81/100 | 14 days ago | |
| K-Mistele/opensearch.cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdc · 30 | Cursor rules | setupteststyle | 73/100 | 14 days ago |
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| hiromaily/go-crypto-wallet.cursor/rules/typescript.mdc · 126 | Cursor rules | setupbuildtestlint-format+6 | 100/100 | 14 days ago | |
| TechSquidTV/Hermes.cursor/rules/10-hermes-api.mdc · 46 | Cursor rules | testlint-formatstylearch+5 | 100/100 | 14 days ago | |
| Allymahmoud/case-intake-platform.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| dodgecfr/combatfilms-webapp.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| deifos/clipmira-subtitles.cursor/rules/frontend.mdc · 1 | Cursor rules | setuptestlint-formatstyle+7 | 99/100 | 14 days ago | |
| markstev/mark-starter.cursor/rules/frontend.mdc · 0 | Cursor rules | setuptestlint-formatstyle+6 | 99/100 | 14 days ago | |
| langflow-ai/langflow.cursor/rules/docs_development.mdc · 153k | Cursor rules | setupbuildtestlint-format+7 | 97/100 | 14 days ago | |
| bybren-llc/safe-agentic-workflow.cursor/rules/10-backend-python.mdc · 399 | Cursor rules | testlint-formatstylegit+4 | 97/100 | today |
A badge carrying the measured quality of the strongest agent config file in this repository, out of 100. It reads from this index every time somebody loads your page, so it changes when the measurement changes and there is nothing to keep up to date. Free, no account, and the value is not something you or we can set by hand.
[](https://rulestack.kynth.studio/configs/k-mistele-opensearch-cursor-rules-baml)Would rather not hotlink us? Every badge is also served in shields.io’s endpoint schema, so shields renders the image and your readers never talk to our domain:
Published by Toolproof, the masthead over this index and eight others. The method behind the number is at toolproof.kynth.studio/methodology, and the whole thing is readable as JSON with no key at /api.