# `LeXtract.Document`
[🔗](https://github.com/YgorCastor/lextract.git/blob/main/lib/lextract/document.ex#L1)

Represents an input document for information extraction.

## Fields

* `:text` - Raw text content of the document
* `:additional_context` - Extra context provided to LLM (not part of main text)
* `:document_id` - Unique identifier (auto-generated if not provided)
* `:metadata` - Optional metadata about the document

## Examples

    iex> doc = LeXtract.Document.create("The patient has diabetes.")
    iex> doc.text
    "The patient has diabetes."

# `example`

```elixir
@type example() :: %{text: String.t(), extractions: [map()]}
```

# `t`

```elixir
@type t() :: %LeXtract.Document{
  additional_context: String.t() | nil,
  document_id: String.t(),
  metadata: map() | nil,
  text: String.t()
}
```

# `create`

```elixir
@spec create(
  String.t(),
  keyword()
) :: t()
```

Creates a new document with the given text.

Automatically generates a UUID if `document_id` is not provided.

## Examples

    iex> doc = LeXtract.Document.create("Sample text")
    iex> String.length(doc.document_id)
    36

# `from_texts`

```elixir
@spec from_texts([String.t()]) :: [t()]
```

Creates multiple documents from a list of texts.

## Examples

    iex> docs = LeXtract.Document.from_texts(["Text 1", "Text 2"])
    iex> length(docs)
    2

---

*Consult [api-reference.md](api-reference.md) for complete listing*
