LangExtract.Template (LangExtract v0.9.0)

Copy Markdown View Source

The extraction task definition: a plain-language description of what to extract, plus few-shot examples showing the expected output.

There is no schema DSL and no fine-tuned model — the template is rendered into a few-shot prompt by LangExtract.Prompt.Builder, and the examples are what teach the model the class vocabulary, span granularity, attributes, and output format.

Build templates with LangExtract.template!/2, which accepts plain maps for examples and validates them against the production aligner; LangExtract.template/2 is the non-raising twin for runtime task definitions (user-uploaded or JSON-loaded). The struct is public for pattern matching and introspection.

Summary

Types

t()

@type t() :: %LangExtract.Template{
  description: String.t(),
  examples: [LangExtract.Template.Example.t()]
}