Environment variables, their defaults, and which ones need a
re-upload.
Every variable is optional. The defaults work with the
standard docker compose up -d setup, so most
people never need this page. Set variables in the shell before
running pnpm dev (there is no
.env file loading).
Core
Variable
Default
Purpose
PORT
3000
API listen port
OLLAMA_URL
http://localhost:11434
Ollama base URL
QDRANT_URL
http://localhost:6333
Qdrant base URL
DATABASE_URL
postgres://…@localhost:5433/…
Postgres holding conversations and messages
Embedding & generation
Variable
Default
Purpose
OLLAMA_EMBED_MODEL
nomic-embed-text
Embedding model name
OLLAMA_EMBED_DIM
768
Expected embedding dimension — a cross-layer integrity
gate
OLLAMA_EMBED_PREFIXES
on
Prepend the search_query:/search_document: task
prefixes
OLLAMA_GEN_MODEL
llama3
Generation model name
OLLAMA_GEN_TIMEOUT_MS
180000
Generation request timeout
OLLAMA_NUM_CTX
4096
Context window pinned for generation, in tokens; the
prompt budget is computed from it
Retrieval
Variable
Default
Purpose
QDRANT_COLLECTION
rag
Default collection for ingest and retrieval
RETRIEVE_TOP_K
5
Default topK for retrieve()
RETRIEVE_SCORE_THRESHOLD
0.63
Minimum score for a question to get any context
RETRIEVE_MODE
dense
dense or hybrid
RETRIEVE_FUSION
rrf
rrf (rank-based) or dbsf (score-based), hybrid mode
only
What the model reads
These control
context assembly: how much of each matched document goes into the prompt.
Sizes are in llama3 tokens.
Variable
Default
Purpose
RETRIEVE_EXPAND_CONTEXT
on
Whole small documents and neighbours for big ones. 0 =
only the top chunks
WHOLE_DOC_MAX_TOKENS
1000
A matched document up to this size goes into the
prompt whole
CHUNKED_DOC_MAX_TOKENS
1200
Cap on the passages a bigger document can contribute
CONTEXT_TITLE_CHUNK
on
Also include a big document's first chunk (title,
authors)
ANSWER_RESERVE_TOKENS
512
Space kept free in the window for the answer
Uploading
Variable
Default
Purpose
INGEST_CONTEXT_HEADERS
auto
Title header above each chunk: auto = only for
documents with fewer than 2 headings, 1 = always, 0 =
never
Conversation memory
Variable
Default
Purpose
QUERY_REWRITE
on
Rewrite referring follow-ups into standalone questions
OLLAMA_REWRITE_MODEL
OLLAMA_GEN_MODEL
Model used for the rewrite
REWRITE_TIMEOUT_MS
60000
Rewrite timeout; falls back on timeout
RETRIEVE_FOLLOWUP_FLOOR
0.57
Minimum standalone score for the fallback follow-up
path
Storage & limits
Variable
Default
Purpose
DOC_STORE_PATH
./data/documents.json
Document-store JSON file location
MAX_INGEST_BYTES
52428800 (50 MB)
Upload size cap on POST /ingest
To swap the embedding model, set bothOLLAMA_EMBED_MODEL and
OLLAMA_EMBED_DIM. If they don't match,
uploads stop immediately with an error saying which
dimension was expected.
What forces a re-ingest
Changing any of these changes the vectors already stored, so
delete the affected documents and upload them again:
OLLAMA_EMBED_MODEL,
OLLAMA_EMBED_PREFIXES or
INGEST_CONTEXT_HEADERS
Collections created before the hybrid-search schema (they
have a single unnamed vector)
Documents ingested before the heading-split fix or the
automatic title-header feature
.docx files ingested before Word headings were
preserved
The "What the model reads" settings don't change stored
vectors, so they take effect on the next question with no
re-upload.