# `Foresight.Text.Sanitize`
[🔗](https://github.com/fosferon/foresight/blob/v0.3.2/lib/foresight/text/sanitize.ex#L1)

Scrubs model output of characters that break downstream systems.

Removes ASCII control characters other than tab, newline and carriage return
(they break JSON decoding and Postgres's UTF-8 encoding), the DEL character, and
any bytes that are not valid UTF-8. Applied to every text the retain extractor
and the consolidation merge take from a model before it is stored. Port of
Hindsight's `sanitize_llm_output` (`engine/llm_wrapper.py`).

# `llm_output`

```elixir
@spec llm_output(String.t() | nil) :: String.t() | nil
```

---

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