Skip to content
GitHub

Configuration

Configuration section: ai.rag (in application.yaml) or env prefix LEX_AI_RAG__.

The provider’s config_key = "ai.rag" — a nested dot-separated key. The orchestrator reads ai.rag: from YAML and coerces it into RAGConfig.


Top-level configuration. Full example:

ai.rag:
enabled: true
vector_store_type: pgvector
vector_dimension: 1536
collection_name: docs
top_k: 5
similarity_threshold: 0.7
use_hybrid_search: true
embedding_provider: openai
embedding_model: text-embedding-3-small
enable_citations: true
citation_style: numbered
chunk_size: 512
chunk_overlap: 50
chunking_strategy: recursive
enable_query_expansion: true
enable_hyde: false
synthesis_strategy: hybrid
enable_hallucination_detection: true
enable_caching: true
cache_ttl: 3600

Env-var override form (nested keys use __):

Terminal window
export LEX_AI_RAG__VECTOR_STORE_TYPE=qdrant
export LEX_AI_RAG__TOP_K=10
export LEX_AI_RAG__EMBEDDING_MODEL=text-embedding-3-large
KeyTypeDefaultEnv VarDescription
enabledboolTrueLEX_AI_RAG__ENABLEDEnable the RAG pipeline
persist_directorystr | NoneNoneLEX_AI_RAG__PERSIST_DIRECTORYLocal directory for file-based stores (Chroma)
vector_store_typestr"pgvector"LEX_AI_RAG__VECTOR_STORE_TYPEBackend: pgvector, chroma, qdrant, mock
vector_dimensionint1536LEX_AI_RAG__VECTOR_DIMENSIONEmbedding dimension (1536 for ada-002)
collection_namestr"default"LEX_AI_RAG__COLLECTION_NAMECollection/index name
top_kint5LEX_AI_RAG__TOP_KNumber of documents to retrieve
similarity_thresholdfloat0.7LEX_AI_RAG__SIMILARITY_THRESHOLDMinimum similarity score (0–1)
use_hybrid_searchboolTrueLEX_AI_RAG__USE_HYBRID_SEARCHEnable hybrid (semantic + keyword)
embedding_providerstr"openai"LEX_AI_RAG__EMBEDDING_PROVIDERProvider: openai, cohere, etc.
embedding_modelstr | NoneNoneLEX_AI_RAG__EMBEDDING_MODELMust be set explicitly
enable_citationsboolTrueLEX_AI_RAG__ENABLE_CITATIONSInclude source citations in responses
citation_stylestr"inline"LEX_AI_RAG__CITATION_STYLEinline, footnote, numbered
min_citation_confidencefloat0.6LEX_AI_RAG__MIN_CITATION_CONFIDENCEMin confidence for citations (0–1)
chunk_sizeint512LEX_AI_RAG__CHUNK_SIZEText chunk size in tokens
chunk_overlapint50LEX_AI_RAG__CHUNK_OVERLAPOverlap between consecutive chunks
chunking_strategystr"recursive"LEX_AI_RAG__CHUNKING_STRATEGYrecursive, semantic, token
enable_query_expansionboolTrueLEX_AI_RAG__ENABLE_QUERY_EXPANSIONEnable query expansion
enable_hydeboolFalseLEX_AI_RAG__ENABLE_HYDEEnable HyDE
synthesis_strategystr"hybrid"LEX_AI_RAG__SYNTHESIS_STRATEGYdirect, extractive, abstractive, hybrid
enable_hallucination_detectionboolTrueLEX_AI_RAG__ENABLE_HALLUCINATION_DETECTIONCheck for hallucinations
enable_cachingboolTrueLEX_AI_RAG__ENABLE_CACHINGCache RAG query results
cache_ttlint3600LEX_AI_RAG__CACHE_TTLCache TTL in seconds

from lexigram.ai.rag.config import PipelineConfig
config = PipelineConfig(
name="my-pipeline",
stages=["RETRIEVAL", "SYNTHESIS", "QUALITY_ASSURANCE"],
max_retries=3,
require_citations=True,
auto_evaluate_every_n=100,
)
KeyTypeDefaultDescription
namestr"default-rag-pipeline"Pipeline identifier
stageslist[PipelineStageType][RETRIEVAL, SYNTHESIS, QUALITY_ASSURANCE]Ordered pipeline stages
max_retriesint3Retries per stage on transient failure
retry_delayfloat1.0Delay between retries (seconds)
default_error_strategystr"graceful"graceful, fail_fast, skip
require_citationsboolFalseRaise MissingCitationsError if no citations
auto_evaluate_every_nint | NoneNoneAuto-evaluation frequency

Sub-configs (ingestion, query_processing, retrieval, context_optimization, synthesis, quality_assurance, post_processing) each expose their own fields. See lexigram.ai.rag.config for the full schema.


All keys map from env vars using LEX_AI_RAG__ prefix with __ as nested delimiter:

LEX_AI_RAG__ENABLED=true
LEX_AI_RAG__VECTOR_STORE_TYPE=qdrant
LEX_AI_RAG__EMBEDDING_MODEL=text-embedding-3-small
LEX_AI_RAG__CHUNK_SIZE=1024
LEX_AI_RAG__USE_HYBRID_SEARCH=false