Overview
A function is the contract between the application and the AI model. It defines the desired input and a guaranteed output.
Here is a simple BAML function to extract a resume. Note the input is a chunk of resume_text, and the output is an actual resume class. Read prompt syntax to learn more about the prompt and what Jinja templating is.
A function signature directly translates into the same function in the language of your choice, and BAML’s fuzzy parser will handle fixing any common json mistakes LLMs make. Here’s how you call it:
Complex input types
If you have a complex input type you can import them from baml_client
and use them when calling your function. Imagine we injected class Resume
into a different baml function called AnalyzeResume. Here’s what the call looks like:
See more at Calling functions
Checkout PromptFiddle to see various interactive BAML function examples.