Skip to main content

RAG API

The RAG API is IntelliAsk's retrieval-augmented generation service — a FastAPI + LangChain app that indexes uploaded files into a vector database and retrieves relevant chunks at query time. This is the complete reference for its configuration and embeddings providers.

The RAG API powers IntelliAsk's Chat with Files. When a user uploads a document, the RAG API splits it into chunks, embeds those chunks with a configurable embeddings provider, and stores the vectors in a vector database (PostgreSQL + pgvector by default). At query time it retrieves the most relevant chunks so the model can answer with grounded context.

It is a Python FastAPI + LangChain service.

Looking to just run it?

To wire the RAG API into the Compose stack (image tags, resource limits, and the stack-level RAG_* keys), see Deploy → Components → RAG API. For the end-user feature, see Features → RAG API.

Optional — disabled by default

RAG needs a working embeddings provider, or rag-api crash-loops on start, so the stack ships it disabled. intelliask provision asks whether to enable it and points you at the embeddings setup first. Once a provider is configured in config/.env, turn it on with intelliask module enable rag (and off with intelliask module disable rag). The app runs fine without it — RAG features are just unavailable until it is enabled.

What's in this section

At a glance

StackPython 3.10 · FastAPI · LangChain
Default port8000 (RAG_PORT)
Vector DBPostgreSQL + pgvector (default) or MongoDB Atlas
AuthOptional JWT (JWT_SECRET) shared with the app

How it works

Index. A file is uploaded; the RAG API extracts text, splits it into chunks (CHUNK_SIZE/CHUNK_OVERLAP), and embeds each chunk with the configured provider.

Store. The embeddings and metadata (including a file_id) are written to the vector database, batched for memory efficiency (EMBEDDING_BATCH_SIZE/EMBEDDING_MAX_QUEUE_SIZE).

Retrieve. At query time, the question is embedded and the most similar chunks for the relevant file_ids are fetched via vector search.

Answer. IntelliAsk passes those chunks to the model as context, so the response is grounded in the user's documents.

The RAG API pairs with a vector database. In the stack that's the bundled pgvector Vector DB component; you can also point it at MongoDB Atlas. See Configuration → Vector database.

Last updated on