LeXtract.ExampleData (lextract v0.1.2)

View Source

Represents a training example for extraction with input text and expected output.

Used to provide few-shot examples to LLMs and for schema generation from examples.

Fields

  • :input - The input text to extract from
  • :output - The expected output structure with extractions

Examples

iex> example = %LeXtract.ExampleData{
...>   input: "Patient takes aspirin 100mg daily",
...>   output: %{
...>     "extractions" => [
...>       %{
...>         "class" => "Medication",
...>         "medication_attributes" => %{
...>           "name" => "aspirin",
...>           "dosage" => "100mg"
...>         }
...>       }
...>     ]
...>   }
...> }
iex> example.input
"Patient takes aspirin 100mg daily"

Summary

Functions

Creates a new example data struct.

Types

t()

@type t() :: %LeXtract.ExampleData{input: String.t(), output: map()}

Functions

new(input, output)

@spec new(String.t(), map()) :: t()

Creates a new example data struct.

Examples

iex> example = LeXtract.ExampleData.new("text", %{"extractions" => []})
iex> example.input
"text"