LangExtract.Prompt.Builder (LangExtract v0.8.0)

Copy Markdown View Source

Renders Q&A-formatted prompts from a template for LLM extraction.

The framing mirrors upstream langextract's QAPromptGenerator: an Examples heading, Q:/A: pairs (answers are code-fenced by WireFormat.format_extractions/1), and a trailing bare A: that primes the model to emit the artifact directly. Measured on the ner benchmark (2026-07-05 probe series, benchmark/decisions/): this scaffold cuts output tokens ~20% versus bare concatenation by reducing adaptive-thinking spend, with no alignment cost.

Summary

Functions

build(template, chunk_text)

@spec build(LangExtract.Template.t(), String.t()) :: String.t()