LangExtract.Prompt.Template (LangExtract v0.6.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. See LangExtract.Prompt.ExampleData for what a good example pins down.

%Template{
  description: "Extract medical conditions and medications.",
  examples: [
    %ExampleData{
      text: "Patient was diagnosed with diabetes and prescribed metformin.",
      extractions: [
        %Extraction{class: "condition", text: "diabetes"},
        %Extraction{class: "medication", text: "metformin"}
      ]
    }
  ]
}

Summary

Types

t()

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