# Chat with local documents using Ollama and MariaDB Vector cache

> Quick Overview This workflow ingests documents from an FTP server into MariaDB Vector using Ollama embeddings, then provides a local chat interface that answers questions with retrieved context and caches repeated questions in a MariaDB Q&A table. How it works 1. Starts a manual ingestion run that lists and downloads a file from an FTP server and extracts its text. 2. Sends the extracted text to an Ollama chat model to generate a short summary and assign a category from an allowed list. 3. Splits the document text into chunks, creates embeddings with Ollama, and inserts each chunk plus its vector and metadata into a MariaDB documents table. 4. Receives a question via an n8n Chat trigger and normalizes it to look up a matching answer in the MariaDB qacache table. 5. If there is no cached answer, embeds the question with Ollama and retrieves the top similar chunks from MariaDB using vector distance. 6. Builds a context-cited prompt from the retrieved chunks and uses an Ollama chat model 

- **Domain**: `n8n-workflow-21639.n8n.io`
- **Provider**: n8n.io (https://n8n.io)
- **Kind**: workflow
- **Live-responds (last probe)**: None
- **Signed card**: False
- **Streaming**: False
- **Quality score**: 40%

## URLs
- Agent card: https://n8n.io/workflows/21639
- Page (HTML): https://agenstry.com/agents/n8n-workflow-21639.n8n.io
- Documentation: https://n8n.io/workflows/21639
