# Memory & Embedding

Xio stores document embeddings to allow fast, context-aware responses. These embeddings are generated when files are uploaded or URLs are processed.

By default, documents are broken into chunks and converted into vectors using your selected embedding provider. These are then stored in your chosen vector database.

To change the embedding provider:

```env
envCopyEditEMBEDDING_PROVIDER=openai
# or
EMBEDDING_PROVIDER=local
```

If you're running locally, make sure the embedding model is loaded and available on the correct port.

You can also adjust how much historical memory Xio retains during a conversation by modifying the number of previous messages included with each prompt. This controls how much context the LLM receives in a single chat exchange.

Example memory setting:

```env
envCopyEditCONTEXT_WINDOW=6
```

This allows six previous messages (user and system) to be passed into the next response cycle.
