Settings reference¶
Generated by scripts/gen_settings_doc.py from src/lasagna/core/config.py and
src/lasagna/settings.lasagna.toml. Do not edit by hand: run the script.
Where a setting comes from, lowest priority first:
- the default below;
settings.lasagna.toml,[rag]table (LASAGNA_SETTINGS_FILEnames another file);- the environment variable:
LASAGNA_<NAME>, orRAG_<NAME>(the older name, still read;LASAGNA_wins when both are set); - the session (
lasagna configure --profile <name> -s <session>, the REST API or MCP).
The settings file and environment variables are the process defaults. A session's profile and overrides are kept in the session database and win over both for that session only.
An environment variable that does not parse, or is outside the allowed values,
stops the process with an error naming it, except log_level, which warns and
keeps its default: it is also the lasagna command's console level (WARNING
unless set), and a typo in it must not stop lasagna doctor. A RAG_ variable that is not a
setting is ignored with a warning that suggests the closest one. Booleans take
true/false, 1/0, yes/no or on/off; lists and objects take JSON.
Data lives in ~/.lasagna (LASAGNA_DATA_DIR): the databases in dbs/
(LASAGNA_DB_DIR) and uploads in uploads/ (LASAGNA_UPLOAD_DIR). A
~/.rag_knowledge from an earlier version is moved there on first use.
Vector Database¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
vector_backend |
str | "milvus" |
LASAGNA_VECTOR_BACKEND, RAG_VECTOR_BACKEND |
Vector database backend to use. |
vector_backend_config |
object | {} |
LASAGNA_VECTOR_BACKEND_CONFIG, RAG_VECTOR_BACKEND_CONFIG |
Backend-specific configuration. |
collection_name |
str | "rag_documents_v2" |
LASAGNA_COLLECTION_NAME, RAG_COLLECTION_NAME |
The vector collection this configuration reads and writes. |
embedding_dim |
int, 1 to 16384 | 1024 |
LASAGNA_EMBEDDING_DIM, RAG_EMBEDDING_DIM |
Vector size; an embedding_model set without one brings its own size. |
metric_type |
str | "COSINE" |
LASAGNA_METRIC_TYPE, RAG_METRIC_TYPE |
vector similarity: COSINE, L2 or IP. |
index_type |
str | "HNSW" |
LASAGNA_INDEX_TYPE, RAG_INDEX_TYPE |
dense index on servers; Milvus Lite always uses FLAT. |
index_params |
object | {"M": 16, "efConstruction": 256} |
LASAGNA_INDEX_PARAMS, RAG_INDEX_PARAMS |
HNSW build parameters. |
search_params |
object | {"ef": 128} |
LASAGNA_SEARCH_PARAMS, RAG_SEARCH_PARAMS |
HNSW search breadth. |
Embedding Model¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
embedding_provider |
str | "huggingface" |
LASAGNA_EMBEDDING_PROVIDER, RAG_EMBEDDING_PROVIDER |
where embeddings are computed. |
embedding_model |
str | "BAAI/bge-m3" |
LASAGNA_EMBEDDING_MODEL, RAG_EMBEDDING_MODEL |
dense+sparse+ColBERT, 8K context, 100+ languages. |
embedding_model_fallback |
str | "BAAI/bge-large-en-v1.5" |
LASAGNA_EMBEDDING_MODEL_FALLBACK, RAG_EMBEDDING_MODEL_FALLBACK |
loaded if the model fails; never during evaluation. |
embedding_backend |
str | "auto" |
LASAGNA_EMBEDDING_BACKEND, RAG_EMBEDDING_BACKEND |
Embedding backend: 'auto', 'sentence-transformers', or 'flag-embedding'. |
normalize_embeddings |
bool | true |
LASAGNA_NORMALIZE_EMBEDDINGS, RAG_NORMALIZE_EMBEDDINGS |
Normalize embedding vectors for cosine similarity. Required for most models. |
batch_size |
int | 32 |
LASAGNA_BATCH_SIZE, RAG_BATCH_SIZE |
How many text pieces to process at once. Higher = faster but uses more memory. |
use_gpu |
bool | true |
LASAGNA_USE_GPU, RAG_USE_GPU |
Process documents faster using your graphics card, if available. |
embedding_truncate_dim |
int or none | none | LASAGNA_EMBEDDING_TRUNCATE_DIM, RAG_EMBEDDING_TRUNCATE_DIM |
Matryoshka dimension truncation. None = use full dim. |
Chunking¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
chunking_strategy |
str | "hierarchical" |
LASAGNA_CHUNKING_STRATEGY, RAG_CHUNKING_STRATEGY |
what runs: enable_hierarchical, then preserve_headers or preserve_tables, override another name. |
chunk_size |
int, 1 to 100000 | 800 |
LASAGNA_CHUNK_SIZE, RAG_CHUNK_SIZE |
How large each piece of content should be (in characters). Smaller = more precise, larger = more context. |
chunk_overlap |
int, 0 to 100000 | 0 |
LASAGNA_CHUNK_OVERLAP, RAG_CHUNK_OVERLAP |
Research: no measurable benefit from overlap (arXiv:2601.14123) |
semantic_threshold |
float | 0.75 |
LASAGNA_SEMANTIC_THRESHOLD, RAG_SEMANTIC_THRESHOLD |
How sensitive the smart splitter is to topic changes. Lower = more splits, higher = fewer splits. |
semantic_breakpoint_method |
str | "absolute" |
LASAGNA_SEMANTIC_BREAKPOINT_METHOD, RAG_SEMANTIC_BREAKPOINT_METHOD |
How the semantic chunker picks breakpoints: 'absolute' or a Kamradt method. |
semantic_breakpoint_amount |
float or none | none | LASAGNA_SEMANTIC_BREAKPOINT_AMOUNT, RAG_SEMANTIC_BREAKPOINT_AMOUNT |
The breakpoint method's parameter; None uses the method's default. |
semantic_buffer_size |
int | 1 |
LASAGNA_SEMANTIC_BUFFER_SIZE, RAG_SEMANTIC_BUFFER_SIZE |
Neighbouring sentences embedded with each sentence, on either side. |
min_chunk_size |
int | 200 |
LASAGNA_MIN_CHUNK_SIZE, RAG_MIN_CHUNK_SIZE |
Pieces smaller than this are merged with their neighbors. |
max_chunk_size |
int | 1500 |
LASAGNA_MAX_CHUNK_SIZE, RAG_MAX_CHUNK_SIZE |
Pieces larger than this are force-split to keep them manageable. |
window_size |
int | 3 |
LASAGNA_WINDOW_SIZE, RAG_WINDOW_SIZE |
Number of sentences per chunk in sentence_window strategy. |
sentence_overlap |
int | 1 |
LASAGNA_SENTENCE_OVERLAP, RAG_SENTENCE_OVERLAP |
Number of sentences to overlap in sentence_window strategy. |
enable_hierarchical |
bool | true |
LASAGNA_ENABLE_HIERARCHICAL, RAG_ENABLE_HIERARCHICAL |
Keeps related pieces of a document together so answers include full context, not just fragments. |
parent_chunk_size |
int | 2000 |
LASAGNA_PARENT_CHUNK_SIZE, RAG_PARENT_CHUNK_SIZE |
Size of the broader context pieces (in characters). Provides surrounding context when needed. |
child_chunk_size |
int | 500 |
LASAGNA_CHILD_CHUNK_SIZE, RAG_CHILD_CHUNK_SIZE |
Size of the precise matching pieces (in characters). Used for initial search. |
auto_merge_threshold |
float | 0.5 |
LASAGNA_AUTO_MERGE_THRESHOLD, RAG_AUTO_MERGE_THRESHOLD |
When enough small pieces match from the same section, automatically use the full section instead. |
enable_late_chunking |
bool | false |
LASAGNA_ENABLE_LATE_CHUNKING, RAG_ENABLE_LATE_CHUNKING |
Late chunking: embed full doc, pool per chunk (Jina, arxiv:2409.04701) |
late_chunking_overlap |
int | 512 |
LASAGNA_LATE_CHUNKING_OVERLAP, RAG_LATE_CHUNKING_OVERLAP |
Tokens shared by consecutive windows in long late chunking. |
chunk_unit |
str | "chars" |
LASAGNA_CHUNK_UNIT, RAG_CHUNK_UNIT |
What chunk_size and chunk_overlap count: 'chars', 'words' or 'tokens'. |
chunk_tokenizer |
str or none | none | LASAGNA_CHUNK_TOKENIZER, RAG_CHUNK_TOKENIZER |
Tokenizer for chunk_unit='tokens': a Hugging Face name, or 'tiktoken: |
recursive_separators |
list | ["\n\n", "\n", ". ", "? ", "! ", " ", ""] |
LASAGNA_RECURSIVE_SEPARATORS, RAG_RECURSIVE_SEPARATORS |
Separators the recursive chunker tries, coarsest first. |
recursive_keep_separator |
str | "end" |
LASAGNA_RECURSIVE_KEEP_SEPARATOR, RAG_RECURSIVE_KEEP_SEPARATOR |
Whether a separator ends the piece before it ('end') or starts the next ('start'). |
markdown_header_levels |
int | 6 |
LASAGNA_MARKDOWN_HEADER_LEVELS, RAG_MARKDOWN_HEADER_LEVELS |
Deepest Markdown header level the markdown_header chunker splits on (1-6). |
markdown_strip_headers |
bool | true |
LASAGNA_MARKDOWN_STRIP_HEADERS, RAG_MARKDOWN_STRIP_HEADERS |
Leave header lines out of markdown_header chunk text (they are in metadata). |
markdown_split_long_sections |
bool | true |
LASAGNA_MARKDOWN_SPLIT_LONG_SECTIONS, RAG_MARKDOWN_SPLIT_LONG_SECTIONS |
Split Markdown sections longer than chunk_size with the recursive chunker. |
proposition_model |
str or none | none | LASAGNA_PROPOSITION_MODEL, RAG_PROPOSITION_MODEL |
LLM that writes propositions; None uses the configured default. |
proposition_passage_size |
int | 100 |
LASAGNA_PROPOSITION_PASSAGE_SIZE, RAG_PROPOSITION_PASSAGE_SIZE |
Words per passage the proposition chunker hands to the LLM. |
contextual_base_chunker |
str | "recursive" |
LASAGNA_CONTEXTUAL_BASE_CHUNKER, RAG_CONTEXTUAL_BASE_CHUNKER |
Registered chunker whose chunks the contextual chunker situates. |
contextual_model |
str or none | none | LASAGNA_CONTEXTUAL_MODEL, RAG_CONTEXTUAL_MODEL |
LLM that writes each chunk's context; None uses the configured default. |
contextual_max_document_chars |
int or none | 50000 |
LASAGNA_CONTEXTUAL_MAX_DOCUMENT_CHARS, RAG_CONTEXTUAL_MAX_DOCUMENT_CHARS |
Characters of the document in each context prompt; None for all of it. |
preserve_tables |
bool | true |
LASAGNA_PRESERVE_TABLES, RAG_PRESERVE_TABLES |
Prevents tables from being split across multiple pieces. |
preserve_headers |
bool | true |
LASAGNA_PRESERVE_HEADERS, RAG_PRESERVE_HEADERS |
Attaches section headings to their content so context is never lost. |
extract_metadata |
bool | true |
LASAGNA_EXTRACT_METADATA, RAG_EXTRACT_METADATA |
keep page, section and file metadata on each chunk. |
max_file_size |
int | 52428800 |
LASAGNA_MAX_FILE_SIZE, RAG_MAX_FILE_SIZE |
50MB. |
max_content_length |
int | 4000 |
LASAGNA_MAX_CONTENT_LENGTH, RAG_MAX_CONTENT_LENGTH |
Maximum content length per chunk in storage (characters). |
Hybrid Search¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
enable_hybrid_search |
bool | true |
LASAGNA_ENABLE_HYBRID_SEARCH, RAG_ENABLE_HYBRID_SEARCH |
Finds results by both meaning and exact keywords, so it catches acronyms, IDs, and rare terms that pure AI search misses. |
hybrid_alpha |
float, 0.0 to 1.0 | 0.7 |
LASAGNA_HYBRID_ALPHA, RAG_HYBRID_ALPHA |
Balance between understanding meaning (right) and matching exact words (left). Most documents work best around 0.7. |
sparse_method |
str | "bm25" |
LASAGNA_SPARSE_METHOD, RAG_SPARSE_METHOD |
Which keyword-based retrieval method to use alongside AI vector search. |
default_top_k |
int, 1 to 10000 | 20 |
LASAGNA_DEFAULT_TOP_K, RAG_DEFAULT_TOP_K |
Research: 75+ introduces hard negatives (ICLR 2025) |
similarity_threshold |
float, 0.0 to 1.0 | 0.3 |
LASAGNA_SIMILARITY_THRESHOLD, RAG_SIMILARITY_THRESHOLD |
Cut applied to the per-query normalized score when the agentic loop or an evaluation's generation track searches. Searches from the CLI, REST, MCP and the SDK apply no threshold unless the request sets min_score. |
rrf_k |
int | 60 |
LASAGNA_RRF_K, RAG_RRF_K |
RRF constant for Reciprocal Rank Fusion. |
enable_bm25_stemming |
bool | true |
LASAGNA_ENABLE_BM25_STEMMING, RAG_ENABLE_BM25_STEMMING |
Enable Porter stemming for BM25. |
bm25_max_sessions |
int | 1000 |
LASAGNA_BM25_MAX_SESSIONS, RAG_BM25_MAX_SESSIONS |
Maximum number of in-memory BM25 session indices to keep. |
bm25_session_ttl_seconds |
int | 86400 |
LASAGNA_BM25_SESSION_TTL_SECONDS, RAG_BM25_SESSION_TTL_SECONDS |
Idle TTL for BM25 session indices in seconds. |
bm25_k1 |
float | 1.2 |
LASAGNA_BM25_K1, RAG_BM25_K1 |
BM25 term-frequency saturation for the bm25 and hybrid retrievers. |
bm25_b |
float | 0.75 |
LASAGNA_BM25_B, RAG_BM25_B |
BM25 document-length normalisation for the bm25 and hybrid retrievers. |
splade_model |
str | "naver/splade-cocondenser-ensembledistil" |
LASAGNA_SPLADE_MODEL, RAG_SPLADE_MODEL |
Masked-language-model checkpoint the splade retriever encodes with. |
hybrid_fusion_depth |
int | 1000 |
LASAGNA_HYBRID_FUSION_DEPTH, RAG_HYBRID_FUSION_DEPTH |
Candidates each list contributes to hybrid_rrf / hybrid_convex fusion. |
hybrid_convex_normalization |
str | "tmm" |
LASAGNA_HYBRID_CONVEX_NORMALIZATION, RAG_HYBRID_CONVEX_NORMALIZATION |
Score normalisation for hybrid_convex: 'tmm', 'minmax' or 'zscore'. |
Reranking¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
enable_reranking |
bool | true |
LASAGNA_ENABLE_RERANKING, RAG_ENABLE_RERANKING |
Double-checks results with a precision model to put the most relevant ones first. |
reranker_model |
str | "mixedbread-ai/mxbai-rerank-large-v1" |
LASAGNA_RERANKER_MODEL, RAG_RERANKER_MODEL |
BEIR NDCG@10 = 57.49. |
rerank_top_k |
int, 1 to 1000 | 5 |
LASAGNA_RERANK_TOP_K, RAG_RERANK_TOP_K |
Research: context cliff at ~2,500 tokens. |
reranker_batch_size |
int | 16 |
LASAGNA_RERANKER_BATCH_SIZE, RAG_RERANKER_BATCH_SIZE |
How many results to score at once. Higher = faster but uses more memory. |
custom_reranker |
str | "" |
LASAGNA_CUSTOM_RERANKER, RAG_CUSTOM_RERANKER |
Registry name for a custom reranker component (empty string = use default). |
custom_query_enhancer |
str | "" |
LASAGNA_CUSTOM_QUERY_ENHANCER, RAG_CUSTOM_QUERY_ENHANCER |
Registry name for a custom query enhancer component (empty string = use default). |
llm_reranker_model |
str | "" |
LASAGNA_LLM_RERANKER_MODEL, RAG_LLM_RERANKER_MODEL |
Model for LLM listwise reranker (empty config = configured default). |
llm_reranker_window_size |
int | 20 |
LASAGNA_LLM_RERANKER_WINDOW_SIZE, RAG_LLM_RERANKER_WINDOW_SIZE |
Sliding window size for listwise reranking. |
llm_reranker_step_size |
int | 10 |
LASAGNA_LLM_RERANKER_STEP_SIZE, RAG_LLM_RERANKER_STEP_SIZE |
How far the listwise reranker's window moves toward the top each step. |
colbert_model |
str | "colbert-ir/colbertv2.0" |
LASAGNA_COLBERT_MODEL, RAG_COLBERT_MODEL |
ColBERT late-interaction model name. |
monot5_model |
str | "castorini/monot5-base-msmarco-10k" |
LASAGNA_MONOT5_MODEL, RAG_MONOT5_MODEL |
Sequence-to-sequence checkpoint the monot5 reranker scores with. |
flashrank_model |
str | "ms-marco-TinyBERT-L-2-v2" |
LASAGNA_FLASHRANK_MODEL, RAG_FLASHRANK_MODEL |
FlashRank model name for the flashrank reranker. |
cohere_rerank_model |
str | "rerank-v3.5" |
LASAGNA_COHERE_RERANK_MODEL, RAG_COHERE_RERANK_MODEL |
Cohere Rerank model for the cohere reranker. |
reranker_trust_remote_code |
bool | false |
LASAGNA_RERANKER_TRUST_REMOTE_CODE, RAG_RERANKER_TRUST_REMOTE_CODE |
Let the cross-encoder run modelling code shipped with its checkpoint. |
enable_context_reordering |
bool | true |
LASAGNA_ENABLE_CONTEXT_REORDERING, RAG_ENABLE_CONTEXT_REORDERING |
Lost-in-the-middle fix: reorder results so best are at start and end. |
enable_context_compression |
bool | false |
LASAGNA_ENABLE_CONTEXT_COMPRESSION, RAG_ENABLE_CONTEXT_COMPRESSION |
Enable context compression to reduce noise/tokens after reranking. |
compression_method |
str | "extractive" |
LASAGNA_COMPRESSION_METHOD, RAG_COMPRESSION_METHOD |
Compression method: 'extractive' or 'abstractive'. |
compression_ratio |
float | 0.3 |
LASAGNA_COMPRESSION_RATIO, RAG_COMPRESSION_RATIO |
Target compression ratio (0.3 = keep 30%). |
enable_graph_retrieval |
bool | false |
LASAGNA_ENABLE_GRAPH_RETRIEVAL, RAG_ENABLE_GRAPH_RETRIEVAL |
Enable GraphRAG entity-linked retrieval. |
graph_max_hops |
int | 2 |
LASAGNA_GRAPH_MAX_HOPS, RAG_GRAPH_MAX_HOPS |
Max traversal depth in knowledge graph. |
graph_entity_types |
list | ["PERSON", "ORG", "CONCEPT", "LOCATION", "TECHNOLOGY", "E... |
LASAGNA_GRAPH_ENTITY_TYPES, RAG_GRAPH_ENTITY_TYPES |
Entity types for graph extraction. |
graph_extraction_model |
str | "" |
LASAGNA_GRAPH_EXTRACTION_MODEL, RAG_GRAPH_EXTRACTION_MODEL |
Model for entity extraction (empty config = configured default). |
agentic_prompts |
object | {} |
LASAGNA_AGENTIC_PROMPTS, RAG_AGENTIC_PROMPTS |
Per-node prompt overrides for the agentic graph, keyed by node name. |
agentic_models |
object | {} |
LASAGNA_AGENTIC_MODELS, RAG_AGENTIC_MODELS |
Per-node model overrides for the agentic graph, keyed by node name. |
enable_raptor |
bool | false |
LASAGNA_ENABLE_RAPTOR, RAG_ENABLE_RAPTOR |
Enable RAPTOR recursive summary tree indexing. |
raptor_max_cluster_size |
int | 10 |
LASAGNA_RAPTOR_MAX_CLUSTER_SIZE, RAG_RAPTOR_MAX_CLUSTER_SIZE |
Max chunks per cluster in RAPTOR tree. |
raptor_max_levels |
int | 5 |
LASAGNA_RAPTOR_MAX_LEVELS, RAG_RAPTOR_MAX_LEVELS |
Max tree depth. |
enable_speculative_rag |
bool | false |
LASAGNA_ENABLE_SPECULATIVE_RAG, RAG_ENABLE_SPECULATIVE_RAG |
Enable speculative RAG: parallel draft generation + verification. |
speculative_n_drafts |
int | 3 |
LASAGNA_SPECULATIVE_N_DRAFTS, RAG_SPECULATIVE_N_DRAFTS |
Number of parallel draft answers for speculative RAG. |
speculative_subset_size |
int | 3 |
LASAGNA_SPECULATIVE_SUBSET_SIZE, RAG_SPECULATIVE_SUBSET_SIZE |
Number of context chunks per draft in speculative RAG. |
self_ask_max_follow_ups |
int | 5 |
LASAGNA_SELF_ASK_MAX_FOLLOW_UPS, RAG_SELF_ASK_MAX_FOLLOW_UPS |
Self-Ask: follow-up questions searched before the model must conclude. |
ircot_paragraphs_per_step |
int | 6 |
LASAGNA_IRCOT_PARAGRAPHS_PER_STEP, RAG_IRCOT_PARAGRAPHS_PER_STEP |
IRCoT: paragraphs retrieved per step (K). |
ircot_max_steps |
int | 8 |
LASAGNA_IRCOT_MAX_STEPS, RAG_IRCOT_MAX_STEPS |
IRCoT: reasoning steps before the loop stops. |
ircot_max_paragraphs |
int | 15 |
LASAGNA_IRCOT_MAX_PARAGRAPHS, RAG_IRCOT_MAX_PARAGRAPHS |
IRCoT: cap on the paragraphs collected across steps. |
flare_retrieval_threshold |
float | 0.8 |
LASAGNA_FLARE_RETRIEVAL_THRESHOLD, RAG_FLARE_RETRIEVAL_THRESHOLD |
FLARE theta: retrieve when any token of the next sentence is below it. |
flare_mask_threshold |
float | 0.4 |
LASAGNA_FLARE_MASK_THRESHOLD, RAG_FLARE_MASK_THRESHOLD |
FLARE beta: tokens below it are masked out of the retrieval query. |
flare_max_sentences |
int | 8 |
LASAGNA_FLARE_MAX_SENTENCES, RAG_FLARE_MAX_SENTENCES |
FLARE: sentences generated before the loop stops. |
flare_docs_per_retrieval |
int | 2 |
LASAGNA_FLARE_DOCS_PER_RETRIEVAL, RAG_FLARE_DOCS_PER_RETRIEVAL |
FLARE: documents retrieved per retrieval. |
flare_confidence_source |
str | "auto" |
LASAGNA_FLARE_CONFIDENCE_SOURCE, RAG_FLARE_CONFIDENCE_SOURCE |
FLARE: 'auto', 'logprobs' or 'self_reported' confidence. |
adaptive_rag_classifier_model |
str | "" |
LASAGNA_ADAPTIVE_RAG_CLASSIFIER_MODEL, RAG_ADAPTIVE_RAG_CLASSIFIER_MODEL |
Adaptive-RAG: model for the complexity classifier (empty = the loop's). |
adaptive_rag_single_step_docs |
int | 5 |
LASAGNA_ADAPTIVE_RAG_SINGLE_STEP_DOCS, RAG_ADAPTIVE_RAG_SINGLE_STEP_DOCS |
Adaptive-RAG: documents retrieved on the single-step route. |
self_rag_passages |
int | 5 |
LASAGNA_SELF_RAG_PASSAGES, RAG_SELF_RAG_PASSAGES |
Self-RAG: passages retrieved, each answered from and critiqued. |
self_rag_weight_rel |
float | 1.0 |
LASAGNA_SELF_RAG_WEIGHT_REL, RAG_SELF_RAG_WEIGHT_REL |
Self-RAG: weight of the relevance critique (ISREL). |
self_rag_weight_sup |
float | 1.0 |
LASAGNA_SELF_RAG_WEIGHT_SUP, RAG_SELF_RAG_WEIGHT_SUP |
Self-RAG: weight of the support critique (ISSUP). |
self_rag_weight_use |
float | 0.5 |
LASAGNA_SELF_RAG_WEIGHT_USE, RAG_SELF_RAG_WEIGHT_USE |
Self-RAG: weight of the utility critique (ISUSE). |
self_rag_retrieval |
str | "adaptive" |
LASAGNA_SELF_RAG_RETRIEVAL, RAG_SELF_RAG_RETRIEVAL |
Self-RAG: 'adaptive' (the model judges) or 'always' retrieve. |
enable_mmr |
bool | true |
LASAGNA_ENABLE_MMR, RAG_ENABLE_MMR |
Avoids showing repetitive or near-duplicate results, so answers draw on varied sources. |
mmr_lambda |
float, 0.0 to 1.0 | 0.5 |
LASAGNA_MMR_LAMBDA, RAG_MMR_LAMBDA |
LangChain and LlamaIndex default; a pre-MMR filter keeps only relevant items. |
mmr_score_normalization |
str | "sigmoid" |
LASAGNA_MMR_SCORE_NORMALIZATION, RAG_MMR_SCORE_NORMALIZATION |
MMR score normalization strategy. |
Query Enhancement¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
enable_hyde |
bool | false |
LASAGNA_ENABLE_HYDE, RAG_ENABLE_HYDE |
Uses AI to imagine what the ideal answer looks like, then searches for content matching that answer. |
hyde_model |
str | "default" |
LASAGNA_HYDE_MODEL, RAG_HYDE_MODEL |
Which AI model powers the AI-Enhanced Search feature. 'default' uses your main model. |
hyde_n_docs |
int | 3 |
LASAGNA_HYDE_N_DOCS, RAG_HYDE_N_DOCS |
Number of hypothetical documents for multi-HyDE. |
hyde_embedding_strategy |
str | "average" |
LASAGNA_HYDE_EMBEDDING_STRATEGY, RAG_HYDE_EMBEDDING_STRATEGY |
Strategy for combining multi-HyDE embeddings. |
enable_query_expansion |
bool | false |
LASAGNA_ENABLE_QUERY_EXPANSION, RAG_ENABLE_QUERY_EXPANSION |
Automatically rephrase your question in different ways to find more results. |
max_query_variations |
int | 3 |
LASAGNA_MAX_QUERY_VARIATIONS, RAG_MAX_QUERY_VARIATIONS |
How many alternative phrasings to try when Search Variations is enabled. |
enable_query_decomposition |
bool | false |
LASAGNA_ENABLE_QUERY_DECOMPOSITION, RAG_ENABLE_QUERY_DECOMPOSITION |
Split multi-part questions into simpler sub-questions and search each separately. |
enable_query_classification |
bool | true |
LASAGNA_ENABLE_QUERY_CLASSIFICATION, RAG_ENABLE_QUERY_CLASSIFICATION |
Enable adaptive query-type classification. |
agentic_hyde_strategy |
str | "adaptive" |
LASAGNA_AGENTIC_HYDE_STRATEGY, RAG_AGENTIC_HYDE_STRATEGY |
When to use AI-Enhanced Search during multi-step searches. |
enable_contextual_retrieval |
bool | false |
LASAGNA_ENABLE_CONTEXTUAL_RETRIEVAL, RAG_ENABLE_CONTEXTUAL_RETRIEVAL |
Enable Anthropic-style contextual retrieval. |
enable_rag_fusion |
bool | false |
LASAGNA_ENABLE_RAG_FUSION, RAG_ENABLE_RAG_FUSION |
Enable RAG Fusion: multi-query generation + Reciprocal Rank Fusion. |
rag_fusion_n_queries |
int | 3 |
LASAGNA_RAG_FUSION_N_QUERIES, RAG_RAG_FUSION_N_QUERIES |
Number of query variations to generate for RAG Fusion. |
query2doc_format |
str | "dense" |
LASAGNA_QUERY2DOC_FORMAT, RAG_QUERY2DOC_FORMAT |
Query2doc: 'dense' (q [SEP] d') or 'sparse' (q repeated, then d'). |
query2doc_query_repeats |
int | 5 |
LASAGNA_QUERY2DOC_QUERY_REPEATS, RAG_QUERY2DOC_QUERY_REPEATS |
Query2doc: how many times the query precedes its pseudo-document (sparse form). |
query2doc_max_tokens |
int | 128 |
LASAGNA_QUERY2DOC_MAX_TOKENS, RAG_QUERY2DOC_MAX_TOKENS |
Query2doc: token budget for the generated pseudo-document. |
enable_crag |
bool | false |
LASAGNA_ENABLE_CRAG, RAG_ENABLE_CRAG |
Enable Corrective RAG: LLM grades retrieval quality post-search. |
crag_web_search_fallback |
bool | false |
LASAGNA_CRAG_WEB_SEARCH_FALLBACK, RAG_CRAG_WEB_SEARCH_FALLBACK |
Enable web search fallback for Corrective RAG. |
Query Routing (Adaptive-RAG)¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
enable_query_routing |
bool | true |
LASAGNA_ENABLE_QUERY_ROUTING, RAG_ENABLE_QUERY_ROUTING |
Route each query to the fast, standard or comprehensive tier by its estimated complexity. |
routing_strategy |
str: rule_based, adaptive |
"rule_based" |
LASAGNA_ROUTING_STRATEGY, RAG_ROUTING_STRATEGY |
Routing strategy: 'rule_based' (deterministic) or 'adaptive' (confidence-aware). |
routing_default_tier |
str: fast, standard, comprehensive |
"standard" |
LASAGNA_ROUTING_DEFAULT_TIER, RAG_ROUTING_DEFAULT_TIER |
Default routing tier when routing is disabled. |
routing_confidence_threshold |
float, 0.0 to 1.0 | 0.5 |
LASAGNA_ROUTING_CONFIDENCE_THRESHOLD, RAG_ROUTING_CONFIDENCE_THRESHOLD |
Confidence threshold below which the adaptive strategy escalates the tier. |
routing_allow_tier_override |
bool | true |
LASAGNA_ROUTING_ALLOW_TIER_OVERRIDE, RAG_ROUTING_ALLOW_TIER_OVERRIDE |
Allow API callers to force a specific routing tier. |
routing_log_decisions |
bool | true |
LASAGNA_ROUTING_LOG_DECISIONS, RAG_ROUTING_LOG_DECISIONS |
Log routing decisions for observability. |
Citation Tracking¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
citation_format |
str | "stable_id" |
LASAGNA_CITATION_FORMAT, RAG_CITATION_FORMAT |
How citations are identified. |
citation_id_length |
int | 8 |
LASAGNA_CITATION_ID_LENGTH, RAG_CITATION_ID_LENGTH |
Length of stable citation IDs (when using stable_id format). |
verify_citations |
bool | true |
LASAGNA_VERIFY_CITATIONS, RAG_VERIFY_CITATIONS |
Verify that cited chunks actually exist. |
track_citations_db |
bool | true |
LASAGNA_TRACK_CITATIONS_DB, RAG_TRACK_CITATIONS_DB |
Persist citation history to the database. |
show_page_numbers |
bool | true |
LASAGNA_SHOW_PAGE_NUMBERS, RAG_SHOW_PAGE_NUMBERS |
Include page numbers in citations (when available). |
include_source_preview |
bool | true |
LASAGNA_INCLUDE_SOURCE_PREVIEW, RAG_INCLUDE_SOURCE_PREVIEW |
a short excerpt of the source with each citation. |
citation_db_max_age_hours |
int | 168 |
LASAGNA_CITATION_DB_MAX_AGE_HOURS, RAG_CITATION_DB_MAX_AGE_HOURS |
1 week. |
citation_db_max_per_session |
int | 1000 |
LASAGNA_CITATION_DB_MAX_PER_SESSION, RAG_CITATION_DB_MAX_PER_SESSION |
oldest citations beyond this are removed. |
citation_normalize_scores |
bool | true |
LASAGNA_CITATION_NORMALIZE_SCORES, RAG_CITATION_NORMALIZE_SCORES |
scale citation scores to 0-1. |
citation_score_method |
str | "minmax" |
LASAGNA_CITATION_SCORE_METHOD, RAG_CITATION_SCORE_METHOD |
'minmax', 'sigmoid', 'clamp'. |
File Types¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
supported_extensions |
list | [".pdf", ".docx", ".txt", ".md", ".csv", ".json", ".html"... |
LASAGNA_SUPPORTED_EXTENSIONS, RAG_SUPPORTED_EXTENSIONS |
Only formats DocumentProcessor can identify and extract. .doc, .rtf and .epub have no extractor, and .pptx and .xlsx are refused by the upload type check before Docling could convert them, so listing them advertised uploads that always failed. |
Storage¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
upload_dir_name |
str | "rag_uploads" |
LASAGNA_UPLOAD_DIR_NAME, RAG_UPLOAD_DIR_NAME |
folder name for stored uploads. |
db_name |
str | "rag.db" |
LASAGNA_DB_NAME, RAG_DB_NAME |
Unified database (consolidated from rag_metadata.db + rag_citations.db) |
Parallel Upload¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
max_concurrent_uploads |
int, 1 to 20 | 5 |
LASAGNA_MAX_CONCURRENT_UPLOADS, RAG_MAX_CONCURRENT_UPLOADS |
Maximum number of parallel document uploads (1-20). |
OCR¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
enable_ocr |
bool | false |
LASAGNA_ENABLE_OCR, RAG_ENABLE_OCR |
Read text from scanned PDFs and images. Useful for old documents or photos of text. |
ocr_engine |
str | "easyocr" |
LASAGNA_OCR_ENGINE, RAG_OCR_ENGINE |
Which engine reads text from scanned documents and images. |
ocr_languages |
list | ["en"] |
LASAGNA_OCR_LANGUAGES, RAG_OCR_LANGUAGES |
Language codes for OCR text extraction. |
ocr_confidence_threshold |
float | 0.5 |
LASAGNA_OCR_CONFIDENCE_THRESHOLD, RAG_OCR_CONFIDENCE_THRESHOLD |
How confident the OCR must be before accepting text. Lower = more text (possibly noisy), higher = cleaner. |
Processing¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
extract_images |
bool | false |
LASAGNA_EXTRACT_IMAGES, RAG_EXTRACT_IMAGES |
extract images from documents. |
preserve_formatting |
bool | true |
LASAGNA_PRESERVE_FORMATTING, RAG_PRESERVE_FORMATTING |
keep layout such as lists and line breaks in extracted text. |
async_processing |
bool | true |
LASAGNA_ASYNC_PROCESSING, RAG_ASYNC_PROCESSING |
process uploads in the background. |
processing_timeout |
int | 300 |
LASAGNA_PROCESSING_TIMEOUT, RAG_PROCESSING_TIMEOUT |
seconds a document may take to process. |
allow_model_download_in_requests |
bool | false |
LASAGNA_ALLOW_MODEL_DOWNLOAD_IN_REQUESTS, RAG_ALLOW_MODEL_DOWNLOAD_IN_REQUESTS |
Whether a server may download a missing model while it handles a request. |
Docling Document Processing¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
docling_enabled |
bool | true |
LASAGNA_DOCLING_ENABLED, RAG_DOCLING_ENABLED |
Enable Docling for structure-aware document processing. |
docling_mode |
str | "auto" |
LASAGNA_DOCLING_MODE, RAG_DOCLING_MODE |
Docling deployment mode: 'auto', 'local', or 'production'. |
docling_pdf_backend |
str | "docling_parse" |
LASAGNA_DOCLING_PDF_BACKEND, RAG_DOCLING_PDF_BACKEND |
Docling PDF backend: 'docling_parse' or 'pypdfium2'. |
docling_ocr_enabled |
bool | true |
LASAGNA_DOCLING_OCR_ENABLED, RAG_DOCLING_OCR_ENABLED |
Enable OCR within Docling pipeline. |
docling_table_structure |
bool | true |
LASAGNA_DOCLING_TABLE_STRUCTURE, RAG_DOCLING_TABLE_STRUCTURE |
Enable TableFormer table structure extraction. |
docling_max_tokens |
int, 64 to 32768 | 512 |
LASAGNA_DOCLING_MAX_TOKENS, RAG_DOCLING_MAX_TOKENS |
Max tokens per chunk for Docling HybridChunker. |
docling_timeout |
int | 300 |
LASAGNA_DOCLING_TIMEOUT, RAG_DOCLING_TIMEOUT |
Per-document processing timeout in seconds. |
Caching¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
enable_embedding_cache |
bool | true |
LASAGNA_ENABLE_EMBEDDING_CACHE, RAG_ENABLE_EMBEDDING_CACHE |
Cache computed embeddings to avoid recomputation. |
embedding_cache_size |
int | 10000 |
LASAGNA_EMBEDDING_CACHE_SIZE, RAG_EMBEDDING_CACHE_SIZE |
Maximum number of cached embeddings. |
enable_search_cache |
bool | true |
LASAGNA_ENABLE_SEARCH_CACHE, RAG_ENABLE_SEARCH_CACHE |
Cache search results for repeated queries. |
search_cache_ttl |
int | 300 |
LASAGNA_SEARCH_CACHE_TTL, RAG_SEARCH_CACHE_TTL |
How long cached search results remain valid (seconds). |
search_cache_max_size |
int | 1000 |
LASAGNA_SEARCH_CACHE_MAX_SIZE, RAG_SEARCH_CACHE_MAX_SIZE |
Maximum number of cached search results. |
Security Limits¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
max_document_ids_filter |
int | 100 |
LASAGNA_MAX_DOCUMENT_IDS_FILTER, RAG_MAX_DOCUMENT_IDS_FILTER |
Maximum document IDs allowed in filter expressions. |
Observability¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
enable_prometheus |
bool | false |
LASAGNA_ENABLE_PROMETHEUS, RAG_ENABLE_PROMETHEUS |
Enable Prometheus metrics collection. |
enable_tracing |
bool | false |
LASAGNA_ENABLE_TRACING, RAG_ENABLE_TRACING |
Enable OpenTelemetry distributed tracing. |
tracing_exporter |
str | "otlp" |
LASAGNA_TRACING_EXPORTER, RAG_TRACING_EXPORTER |
Tracing exporter: 'otlp', 'jaeger', 'zipkin', or 'console'. |
tracing_endpoint |
str | "http://localhost:4317" |
LASAGNA_TRACING_ENDPOINT, RAG_TRACING_ENDPOINT |
OTLP/Jaeger/Zipkin collector endpoint. |
tracing_service_name |
str | "rag-knowledge" |
LASAGNA_TRACING_SERVICE_NAME, RAG_TRACING_SERVICE_NAME |
Service name reported in traces. |
log_level |
str: TRACE, DEBUG, INFO, SUCCESS, WARNING, ERROR, CRITICAL |
"INFO" |
LASAGNA_LOG_LEVEL, RAG_LOG_LEVEL |
Logging verbosity. |
Multi-Tenancy¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
tenant_isolation |
str: none, partition |
"none" |
LASAGNA_TENANT_ISOLATION, RAG_TENANT_ISOLATION |
Tenant isolation mode: 'none' or 'partition'. |
quota_enabled |
bool | false |
LASAGNA_QUOTA_ENABLED, RAG_QUOTA_ENABLED |
Enable per-tenant resource quotas (documents, storage, rate limits). |
Rate Limiting¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
rate_limiting_enabled |
bool | false |
LASAGNA_RATE_LIMITING_ENABLED, RAG_RATE_LIMITING_ENABLED |
Enable adaptive rate limiting per tenant. |
rate_limiting_strategy |
str | "adaptive" |
LASAGNA_RATE_LIMITING_STRATEGY, RAG_RATE_LIMITING_STRATEGY |
Rate limiting strategy: 'adaptive' or 'fixed'. |
rate_limiting_rpm |
float | 60.0 |
LASAGNA_RATE_LIMITING_RPM, RAG_RATE_LIMITING_RPM |
Base requests per minute per tenant. |
rate_limiting_burst |
float | 10.0 |
LASAGNA_RATE_LIMITING_BURST, RAG_RATE_LIMITING_BURST |
Maximum burst token capacity per tenant. |
rate_limiting_burst_multiplier |
float | 2.0 |
LASAGNA_RATE_LIMITING_BURST_MULTIPLIER, RAG_RATE_LIMITING_BURST_MULTIPLIER |
Capacity multiplier when system is idle (allows bursting). |
rate_limiting_overload_threshold |
float | 0.8 |
LASAGNA_RATE_LIMITING_OVERLOAD_THRESHOLD, RAG_RATE_LIMITING_OVERLOAD_THRESHOLD |
System load score that triggers throttling (0.0 to 1.0). |
rate_limiting_idle_threshold |
float | 0.3 |
LASAGNA_RATE_LIMITING_IDLE_THRESHOLD, RAG_RATE_LIMITING_IDLE_THRESHOLD |
System load score below which bursting is allowed (0.0 to 1.0). |
Database Backend¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
database_backend |
str: sqlite, postgresql |
"sqlite" |
LASAGNA_DATABASE_BACKEND, RAG_DATABASE_BACKEND |
Database backend: 'sqlite' (default) or 'postgresql'. |
database_dsn |
str | "" |
LASAGNA_DATABASE_DSN, RAG_DATABASE_DSN |
PostgreSQL connection string (DSN). Required when database_backend='postgresql'. |
database_pool_min |
int | 2 |
LASAGNA_DATABASE_POOL_MIN, RAG_DATABASE_POOL_MIN |
Minimum database connection pool size (PostgreSQL). |
database_pool_max |
int | 10 |
LASAGNA_DATABASE_POOL_MAX, RAG_DATABASE_POOL_MAX |
Maximum database connection pool size (PostgreSQL). |
Redis / Distributed Cache¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
cache_backend |
str: memory, redis |
"memory" |
LASAGNA_CACHE_BACKEND, RAG_CACHE_BACKEND |
Cache backend: 'memory' (default) or 'redis'. |
redis_url |
str | "redis://localhost:6379" |
LASAGNA_REDIS_URL, RAG_REDIS_URL |
Redis connection URL. |
redis_pool_size |
int | 10 |
LASAGNA_REDIS_POOL_SIZE, RAG_REDIS_POOL_SIZE |
Redis connection pool size. |
Celery / Background Processing¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
celery_enabled |
bool | false |
LASAGNA_CELERY_ENABLED, RAG_CELERY_ENABLED |
Enable Celery for background document processing. |
celery_broker_url |
str | "redis://localhost:6379/0" |
LASAGNA_CELERY_BROKER_URL, RAG_CELERY_BROKER_URL |
Celery broker URL (typically Redis). |
celery_result_backend |
str | "redis://localhost:6379/1" |
LASAGNA_CELERY_RESULT_BACKEND, RAG_CELERY_RESULT_BACKEND |
Celery result backend URL (typically Redis). |
Connection Pooling¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
connection_pool_size |
int, 1 to 500 | 1 |
LASAGNA_CONNECTION_POOL_SIZE, RAG_CONNECTION_POOL_SIZE |
Vector backend connection pool size. 1 = no pooling (default). |
File Storage Backend¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
storage_backend |
str | "local" |
LASAGNA_STORAGE_BACKEND, RAG_STORAGE_BACKEND |
File storage backend: 'local' (default), 's3', or 'fsspec'. |
storage_backend_config |
object | {} |
LASAGNA_STORAGE_BACKEND_CONFIG, RAG_STORAGE_BACKEND_CONFIG |
Backend-specific storage configuration. |
Fast Ingestion (eval-only pipeline tuning)¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
ingest_extract_workers |
int | min(os.cpu_count() or 4, 8) |
LASAGNA_INGEST_EXTRACT_WORKERS, RAG_INGEST_EXTRACT_WORKERS |
Number of parallel workers for text extraction/chunking in fast ingest. |
ingest_embed_batch_size |
int | 64 |
LASAGNA_INGEST_EMBED_BATCH_SIZE, RAG_INGEST_EMBED_BATCH_SIZE |
Cross-document embedding batch size for fast ingest. |
ingest_insert_batch_size |
int | 500 |
LASAGNA_INGEST_INSERT_BATCH_SIZE, RAG_INGEST_INSERT_BATCH_SIZE |
Chunks per vector store insert call in fast ingest. |
Agentic retrieval and document awareness (settings file only)¶
| Setting | Type | Default | Environment variables | Description |
|---|---|---|---|---|
use_agentic_rag |
bool | true |
LASAGNA_USE_AGENTIC_RAG, RAG_USE_AGENTIC_RAG |
Agentic RAG with multi-hop reasoning. |
use_final_search |
bool | false |
LASAGNA_USE_FINAL_SEARCH, RAG_USE_FINAL_SEARCH |
Do final search after refinement for complete citations. |
max_agent_iterations |
int | 3 |
LASAGNA_MAX_AGENT_ITERATIONS, RAG_MAX_AGENT_ITERATIONS |
Maximum number of search iterations for agentic RAG. |
chunk_refinement_method |
str | "auto" |
LASAGNA_CHUNK_REFINEMENT_METHOD, RAG_CHUNK_REFINEMENT_METHOD |
Whether the AI cleans up and highlights the most relevant parts of found content. |
agent_temperature |
float | 0.1 |
LASAGNA_AGENT_TEMPERATURE, RAG_AGENT_TEMPERATURE |
Temperature for agent/refinement model (low for determinism). |
max_query_length |
int | 12 |
LASAGNA_MAX_QUERY_LENGTH, RAG_MAX_QUERY_LENGTH |
Maximum query length in tokens for refinement queries. |
auto_refine_avg_length_threshold |
int | 1000 |
LASAGNA_AUTO_REFINE_AVG_LENGTH_THRESHOLD, RAG_AUTO_REFINE_AVG_LENGTH_THRESHOLD |
Average chunk length threshold to trigger auto-refinement. |
auto_refine_avg_score_threshold |
float | 0.5 |
LASAGNA_AUTO_REFINE_AVG_SCORE_THRESHOLD, RAG_AUTO_REFINE_AVG_SCORE_THRESHOLD |
Average score threshold below which to trigger auto-refinement. |
auto_refine_chunk_count_threshold |
int | 7 |
LASAGNA_AUTO_REFINE_CHUNK_COUNT_THRESHOLD, RAG_AUTO_REFINE_CHUNK_COUNT_THRESHOLD |
Chunk count threshold above which to trigger auto-refinement. |
use_structured_graph |
bool | false |
LASAGNA_USE_STRUCTURED_GRAPH, RAG_USE_STRUCTURED_GRAPH |
Use structured StateGraph instead of flat ReAct agent. |
enable_hallucination_check |
bool | false |
LASAGNA_ENABLE_HALLUCINATION_CHECK, RAG_ENABLE_HALLUCINATION_CHECK |
Enable post-generation hallucination grounding check (ISSUP). |
enable_answer_quality_check |
bool | false |
LASAGNA_ENABLE_ANSWER_QUALITY_CHECK, RAG_ENABLE_ANSWER_QUALITY_CHECK |
Enable post-generation answer quality check (ISUSE). |
max_quality_check_attempts |
int, 1 to 20 | 2 |
LASAGNA_MAX_QUALITY_CHECK_ATTEMPTS, RAG_MAX_QUALITY_CHECK_ATTEMPTS |
Maximum retry attempts for quality gate failures. |
coverage_scorer_mode |
str | "keyword" |
LASAGNA_COVERAGE_SCORER_MODE, RAG_COVERAGE_SCORER_MODE |
Coverage assessment mode: 'keyword' (fast) or 'llm' (accurate). |
final_search_mode |
str | "merge" |
LASAGNA_FINAL_SEARCH_MODE, RAG_FINAL_SEARCH_MODE |
Final search behavior: 'merge' (combine hop + final) or 'replace' (legacy). |
chunk_cite_retrieval |
object | {"strategy": "adaptive", "fixed_size": 5, "threshold_scor... |
LASAGNA_CHUNK_CITE_RETRIEVAL, RAG_CHUNK_CITE_RETRIEVAL |
How many retrieved chunks are kept: a fixed count, or cut at a score gap. |
document_awareness |
object | {"enabled": true, "enrichment_strategy": "first_tokens", ... |
LASAGNA_DOCUMENT_AWARENESS, RAG_DOCUMENT_AWARENESS |
What the agent is told about each document: a preview of its first tokens, an LLM summary, or both. |
agentic_pipeline |
str | none | LASAGNA_AGENTIC_PIPELINE, RAG_AGENTIC_PIPELINE |
Name of the registered agentic pipeline to use. |
refinement_model |
str | none | LASAGNA_REFINEMENT_MODEL, RAG_REFINEMENT_MODEL |
Which AI model refines the search results. A fast, affordable model works well here. |
Variables that are not settings¶
The servers, the MCP server and the vector stores read these from the environment only: not from the settings file, and not per session.
REST API and authentication¶
| Variable | Default | Description |
|---|---|---|
RAG_REQUIRE_AUTH |
false |
When true, only a verified X-Session-Token names a session, and POST /api/v1/sessions needs an X-API-Key. When false, binding beyond loopback is refused at startup unless RAG_BIND_IS_PROTECTED is set. |
RAG_API_KEYS |
unset | Comma-separated keys, each at least 32 characters, that may mint session tokens when RAG_REQUIRE_AUTH is on. Rate limits and quotas are counted per key, over all the sessions it minted. |
RAG_JWT_SECRET |
a random secret per process | Signs session tokens (HMAC-SHA256). Unset, tokens stop working when the process restarts; with RAG_REQUIRE_AUTH on, an unset, placeholder or shorter-than-32-character secret stops the server at startup. |
RAG_SESSION_TOKEN_TTL_SECONDS |
604800 |
How long a session token is valid, in seconds (7 days). |
RAG_ADMIN_TOKEN |
unset | The X-Admin-Token for /api/v1/admin/* and for naming a session in POST /api/v1/sessions. Unset, a placeholder or shorter than 32 characters: the admin routes answer 503. |
RAG_ALLOW_ANONYMOUS_SESSION |
false |
With RAG_REQUIRE_AUTH on, keep the anonymous default session usable. |
RAG_BIND_IS_PROTECTED |
false |
Says that something outside the process (a loopback port mapping, a NetworkPolicy, a firewall) restricts access, so the server may bind beyond loopback with auth off. |
RAG_ALLOW_HEADER_IDENTITY |
false |
Accept the X-User-ID header as the user identity; otherwise it is refused with 401. |
RAG_CORS_ORIGINS |
empty | Comma-separated origins allowed cross-origin requests (REST and MCP over HTTP). Empty allows none; * is refused at startup when RAG_REQUIRE_AUTH is on. |
RAG_ALLOWED_HOSTS |
unset | Extra Host names the REST API and MCP over HTTP answer to with auth off, comma-separated (name, or name:* for any port), such as a container's service name. Otherwise only localhost, 127.0.0.1 and [::1]. |
RAG_FORWARDED_ALLOW_IPS |
127.0.0.1 |
Proxy addresses whose X-Forwarded-For is trusted. The image reads gunicorn's FORWARDED_ALLOW_IPS first. |
RAG_MAX_BATCH_FILES |
20 |
Files in one POST /api/v1/documents/batch; more is refused with 400. |
RAG_MAX_BATCH_BYTES |
209715200 |
Total body of one batch upload (200 MiB); more is refused with 413 before the body is read. |
RAG_SEARCH_TIMEOUT |
120 |
Seconds a REST search may run before it answers 504. |
RAG_MAX_SESSIONS_PER_KEY |
100 |
With RAG_REQUIRE_AUTH on, how many sessions one API key may mint per token lifetime (RAG_SESSION_TOKEN_TTL_SECONDS); one more answers 429. Raise it for an application that makes a session per end user. |
RAG_EMBED_MCP |
false |
Mount the MCP server at /mcp inside the REST process, for single-process deployments such as Milvus Lite. |
RAG_CONFIGURATOR |
false |
Mount the configurator UI at /configurator, with its API routes. |
LASAGNA_LOG_FORMAT |
text |
json writes one JSON object per log line; text shows a request's id before the message. Any other value stops the server at startup. |
PROMETHEUS_MULTIPROC_DIR |
unset | The directory gunicorn workers share for Prometheus metrics (set in the image). |
RAG_WORKER_METRICS_PORT |
unset | The port a Celery worker serves its Prometheus /metrics on, with RAG_ENABLE_PROMETHEUS on (lasagna_ingests_total for the documents it processed). Unset, the worker serves none. Compose and Kubernetes set 9100. |
MCP server¶
| Variable | Default | Description |
|---|---|---|
LASAGNA_MCP_TOOLS |
safe |
safe leaves out the six tools that delete data or reset configuration; all serves every tool. The same as lasagna-mcp --tools. |
LASAGNA_ENABLE_DOCS_API |
false |
Turn on the /api/call tool tester, which calls any tool without authentication. For development only. |
RAG_SESSION_ID |
unset | The session an MCP tool call, or a REST request without X-Session-ID, uses when it names none (else default). lasagna serve -s sets it. |
RAG_MCP_UPLOAD_ROOT |
unset | The directory a networked MCP server may ingest server-side files from; unset, it reads none. |
Vector store connections¶
| Variable | Default | Description |
|---|---|---|
MILVUS_URI |
unset | A Milvus server's address, used when vector_backend_config has no uri. Without one the milvus backend opens Milvus Lite in the data directory. |
MILVUS_TOKEN |
unset | The token for MILVUS_URI. |
QDRANT_URL |
unset | A Qdrant server's address; without one the qdrant backend stores its data in the data directory. |
QDRANT_API_KEY |
unset | The API key for QDRANT_URL. |
WEAVIATE_URL |
unset | A Weaviate server's address. |
WEAVIATE_API_KEY |
unset | The API key for WEAVIATE_URL. |
PINECONE_API_KEY |
unset | The Pinecone API key the pinecone backend needs. |
PGVECTOR_DSN |
postgresql://rag:rag@localhost:5432/rag |
The PostgreSQL DSN of the pgvector backend; RAG_DATABASE_DSN is used when it is unset. |
OPENSEARCH_HOSTS |
http://localhost:9200 |
Comma-separated OpenSearch hosts, with OPENSEARCH_USER and OPENSEARCH_PASSWORD. |
OPENSEARCH_USE_SSL |
false |
Connect to OpenSearch over SSL. |
OPENSEARCH_VERIFY_CERTS |
false |
Verify the OpenSearch server's certificate. |
OPENSEARCH_TIMEOUT |
30 |
Seconds an OpenSearch request may take. |
OPENSEARCH_ENABLE_NEURAL_SPARSE |
false |
Add neural sparse vectors to OpenSearch hybrid search (dense, sparse and BM25). |
Paths and the process¶
| Variable | Default | Description |
|---|---|---|
LASAGNA_DATA_DIR, RAG_DATA_DIR |
~/.lasagna |
Where Lasagna keeps its data. |
LASAGNA_DB_DIR, RAG_DB_DIR |
/dbs | The databases and the local vector stores. |
LASAGNA_UPLOAD_DIR, RAG_UPLOAD_DIR |
/uploads | Stored uploads. |
LASAGNA_SETTINGS_FILE, RAG_SETTINGS_FILE |
the packaged settings.lasagna.toml | The settings file to read instead of the packaged one; a path with no file there stops the process with an error. |
LASAGNA_LLM_CACHE |
on |
0, false, no or off turns the LLM response cache off for every run. |
RAG_STORE_LOCK_TIMEOUT |
300 |
Seconds a process waits for a lock another process holds in a PostgreSQL metadata store (a document's during a reindex, a session's during a profile switch) before the operation fails and says so, with nothing changed. |
LASAGNA_STRICT_PLUGINS |
unset | Set: a plugin that fails to load raises instead of being reported and skipped. |
RAG_LANGFUSE_TRACING |
false |
Send LLM traces to Langfuse (needs the langfuse package and its keys). |
RAG_LLM_CACHE_MAX_SIZE |
50 |
How many LLM clients the process keeps for reuse. |
RAG_CRAG_GRADING_CONCURRENCY |
4 |
Parallel relevance-grading calls in corrective RAG (CRAG). |