arindamkhaled
05/28/2026, 9:06 PMavery (BAML)
05/28/2026, 10:24 PMts
//baml_src/extract.baml
class Resume {
name string
skills string[]
}
function ExtractResume(resume_text: string) -> Resume {
client Dummy
prompt #"
Extract the resume below.
{{ resume_text }}
{{ ctx.output_format }} "#
}
client<llm> Dummy {
provider openai-generic
options { base_url "http://localhost:9/v1" model "x" api_key "x" }
}
py
# main.py
import subprocess
from baml_client.sync_client import b
# 1. Render prompt (task + schema) — no network call, just to get ctx.output_format
req = b.request.ExtractResume("Jane Doe — Rust, Python, K8s")
# steal ctx.output_format from the BAML prompt
prompt = "\n".join(m["content"] for m in req.body.json()["messages"])
# 2. Run the CLI as the "model"
raw = subprocess.run(["claude", "-p", prompt], capture_output=True, text=True).stdout
# 3. Schema-aligned parse into the typed Resume
resume = b.parse.ExtractResume(raw)
print(resume.model_dump_json(indent=2))
we're cooking up a solution to this internally for the new compiler and this will be a first class feature once that lands!avery (BAML)
05/28/2026, 10:28 PMavery (BAML)
05/28/2026, 10:28 PMarindamkhaled
05/29/2026, 2:17 AM