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

Enumeration of supported format types for parsing LLM outputs.

Supports JSON and YAML formats for structured data extraction.

## Examples

    iex> LeXtract.FormatType.from_string("json")
    {:ok, :json}

    iex> LeXtract.FormatType.to_string(:yaml)
    "yaml"

    iex> LeXtract.FormatType.all()
    [:json, :yaml]

# `t`

```elixir
@type t() :: :json | :yaml
```

# `all`

```elixir
@spec all() :: [t()]
```

Returns a list of all supported format types.

## Examples

    iex> LeXtract.FormatType.all()
    [:json, :yaml]

# `from_string`

```elixir
@spec from_string(String.t()) :: {:ok, t()} | {:error, Exception.t()}
```

Converts a string to a format type atom.

Accepts "json", "yaml", and "yml" as valid format strings.

## Examples

    iex> LeXtract.FormatType.from_string("json")
    {:ok, :json}

    iex> LeXtract.FormatType.from_string("yaml")
    {:ok, :yaml}

    iex> LeXtract.FormatType.from_string("yml")
    {:ok, :yaml}

    iex> {:error, error} = LeXtract.FormatType.from_string("invalid")
    iex> is_exception(error)
    true

# `to_string`

```elixir
@spec to_string(t()) :: String.t()
```

Converts a format type atom to its string representation.

## Examples

    iex> LeXtract.FormatType.to_string(:json)
    "json"

    iex> LeXtract.FormatType.to_string(:yaml)
    "yaml"

---

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