Configuration Reference¶
Every field below is generated directly from the pydantic models in
apps/chainlit/config/schema.py, so this page never drifts from the code.
Precedence
For each value: explicit environment variable → YAML value → default.
Secrets and infrastructure (LITELLM_API_KEY, QDRANT_URL, …) are left
null in YAML and supplied via environment variables. See .env.example.
Relative paths resolve against the config file's own directory.
Interface language¶
The interface is German or English, and the browser decides. Chainlit resolves
its own labels from navigator.language and ships no language picker, so the app's
own surfaces — welcome screen, starter questions, document-watcher badge, evaluation
badge and panel — follow that same signal instead of adding a second one that could
disagree with it. Anything that is not German gets English.
To pin one language for everyone, set it in .chainlit/config.toml:
[UI]
language = "de-DE"
Both badges honour that too. They read it from their status endpoints, because a
static file under public/ cannot read the config itself.
Two things this deliberately does not cover:
- The answer language is separate.
language:in yourrag.config.yamldecides what the assistant writes. Thepapersexample pins German because citations and follow-up questions are parsed with German markers, so an English interface can still return a German answer. - Judge reasons stay English. The per-claim explanations in the evaluation panel come from RAGAS's own English prompts.
de-DE, but not de-AT
Chainlit ships a de-DE catalogue and no plain de, so a browser reporting
de-AT or de-CH gets English Chainlit labels while the app's own strings go
German. Setting [UI] language removes the split.
Adding a third language means translating the string tables in
public/eval-badge.js, public/ingest-status.js and eval_app/static/index.html,
and adding a chainlit_<locale>.md welcome screen. Chat messages, the settings panel
and the citation panels are German-only for now; see TODO.md.
config.schema.RagConfig ¶
Bases: BaseModel
Top-level configuration for a RAG instance.
config.schema.ModelsConfig ¶
Bases: BaseModel
Chat and embedding model selection (all routed through LiteLLM).
The defaults are deliberately open-weight models, so a fresh instance
never depends on a proprietary vendor. The exact strings are gateway-specific
— query GET /v1/models and use whatever your gateway advertises.
chat_model
class-attribute
instance-attribute
¶
chat_model = 'gpt-oss-120b'
LiteLLM provider/model string for the chat model. Default is OpenAI's
Apache-2.0 open-weight release, not the hosted GPT API.
fallback_chat_model
class-attribute
instance-attribute
¶
fallback_chat_model = None
Model to retry a chat call on when chat_model fails, via LiteLLM
fallbacks=. Covers an outage of one model group on the gateway: without
it a single unavailable model takes down answering and the startup prompt
generation, which then silently serves the bundled default prompt. Leave
null to disable. Not applied to embeddings (a different vector space) or
to the evaluation judge (deliberately pinned, so scores stay comparable).
embed_model
class-attribute
instance-attribute
¶
embed_model = 'octen-embedding-8b'
LiteLLM provider/model string for embeddings.
selectable_chat_models
class-attribute
instance-attribute
¶
selectable_chat_models = Field(default_factory=list)
Chat models offered in the settings-panel model selector. Merged with
whatever the gateway advertises via /v1/models and the active
chat_model. Use this when the gateway does not enumerate its models.
litellm_base_url
class-attribute
instance-attribute
¶
litellm_base_url = None
LiteLLM gateway base URL (env LITELLM_BASE_URL overrides).
litellm_api_key
class-attribute
instance-attribute
¶
litellm_api_key = None
LiteLLM gateway API key (env LITELLM_API_KEY overrides).
config.schema.VectorStoreConfig ¶
Bases: BaseModel
Vector database connection and collection.
url
class-attribute
instance-attribute
¶
url = 'http://localhost:6333'
Qdrant URL (env QDRANT_URL overrides).
api_key
class-attribute
instance-attribute
¶
api_key = None
Qdrant API key (env QDRANT_API_KEY overrides).
collection
class-attribute
instance-attribute
¶
collection = 'documents'
Collection name (env QDRANT_COLLECTION overrides).
config.schema.ChunkingConfig ¶
Bases: BaseModel
How parsed sections are split into chunks before embedding.
strategy
class-attribute
instance-attribute
¶
strategy = 'fixed_size'
fixed_size = sliding window; heading = one chunk per parsed
section (with an oversize guard); passthrough = one chunk per section,
never split (for structured JSON/CSV records); semantic = split each
section at embedding-similarity breakpoints (embeds sentences at ingest —
not free); docling_hybrid = Docling's native token-aware chunker
(PDF only; serializes tables/figures itself, sizes by the embed tokenizer).
semantic_breakpoint_percentile
class-attribute
instance-attribute
¶
semantic_breakpoint_percentile = Field(default=95.0, ge=0.0, le=100.0)
semantic only: consecutive-sentence distances above this percentile
start a new chunk. Lower = more, smaller chunks.
hybrid_max_tokens
class-attribute
instance-attribute
¶
hybrid_max_tokens = Field(default=None, gt=0)
docling_hybrid only: token cap per chunk. None uses the
tokenizer's model default.
config.schema.DataSourceConfig ¶
Bases: BaseModel
One corpus to ingest: where it is, its format, how to parse and chunk it.
parser_name
class-attribute
instance-attribute
¶
parser_name = None
Registered parser name — required when format == 'custom'.
chunking
class-attribute
instance-attribute
¶
chunking = None
Per-source override of the global chunking config.
field_mapping
class-attribute
instance-attribute
¶
field_mapping = None
Required for json/csv formats.
extra_metadata
class-attribute
instance-attribute
¶
extra_metadata = Field(default_factory=dict)
Static metadata merged into every chunk from this source.
config.schema.FieldMapping ¶
Bases: BaseModel
Declarative mapping from JSON/CSV records to chunk text + metadata.
record_path
class-attribute
instance-attribute
¶
record_path = None
Dotted path to the list of records (flat JSON). Omit for top-level lists.
text_template
class-attribute
instance-attribute
¶
text_template = None
f-string over a record's fields to build the chunk text.
text_fields
class-attribute
instance-attribute
¶
text_fields = None
Alternative to text_template: join these fields with newlines.
metadata
class-attribute
instance-attribute
¶
metadata = Field(default_factory=dict)
payload_key -> value spec (see :class:RecordSpec).
record_specs
class-attribute
instance-attribute
¶
record_specs = None
For nested/multi-record JSON — overrides the flat fields above.
config.schema.RecordSpec ¶
Bases: BaseModel
A nested-iteration record producer for the JSON field-mapping DSL.
config.schema.IterStep ¶
Bases: BaseModel
One level of descent for the nested-JSON record_specs DSL.
path
instance-attribute
¶
path
A key to descend into, or several sibling list-keys to iterate together
(e.g. [basis, standard, erhoeht]).
as_
class-attribute
instance-attribute
¶
as_ = Field(default=None, alias='as')
Bind the current element under this name for later {name.field} refs.
object
class-attribute
instance-attribute
¶
object = False
Descend into an object without iterating (single dict, not a list).
bind_key_as
class-attribute
instance-attribute
¶
bind_key_as = None
When path is a list of sibling keys, capture which key we came
through under this name (referenced as @name).
config.schema.PdfOptions ¶
Bases: BaseModel
PDF/Docling extraction options for a data source.
docling_json_dir
class-attribute
instance-attribute
¶
docling_json_dir = None
Folder of converted documents, one Docling JSON per PDF, same file stem.
Reading these skips Docling entirely. A PDF under path that has no file
here yet is converted on the next ingest, with this source's options, and
saved here with a .stamp (Docling version, settings, PDF checksum); it is
converted again when the stamp stops matching and only read otherwise. Files
exported by hand (docling --to json) have no stamp and are left alone;
delete one to reconvert that document.
ocr
class-attribute
instance-attribute
¶
ocr = False
Read text off the page as an image. Only needed for scans: PDFs that
already carry a text layer are read correctly with ocr: false, and OCR
makes ingestion much slower.
The shipped Docker image contains no OCR engine, deliberately, to keep it
small. Turning this on there fails immediately with an explanation. To use it,
build a derived image that installs tesseract-ocr plus the language data
you need, or run outside Docker with a tesseract on your PATH.
ocr_engine
class-attribute
instance-attribute
¶
ocr_engine = 'tesseract'
tesseract needs the binary on the PATH. mac uses the OCR built into
macOS and needs nothing installed, but only works outside Docker.
ocr_lang
class-attribute
instance-attribute
¶
ocr_lang = Field(default_factory=lambda: ['eng', 'deu'])
Language codes passed to the OCR engine. For tesseract each one needs
its own package (e.g. tesseract-ocr-deu).
include_tables
class-attribute
instance-attribute
¶
include_tables = True
Serialize each table (as a Markdown grid) into the section it appears in,
so table content is retrievable. Ignored by docling_hybrid (that chunker
serializes tables itself). Applies to the heading/fixed_size/
semantic reconstruction path.
config.schema.RetrievalConfig ¶
Bases: BaseModel
Retrieval knobs and which payload fields are indexed/filterable.
max_top_k
class-attribute
instance-attribute
¶
max_top_k = None
Upper bound the model may request. Defaults to top_k when unset.
score_threshold
class-attribute
instance-attribute
¶
score_threshold = Field(default=0.0, ge=0.0)
Minimum cosine similarity for a hit. With hybrid on this bounds the
dense leg only — the lexical leg has no comparable score, so a chunk that
matches lexically can enter the fused results below this similarity.
hybrid
class-attribute
instance-attribute
¶
hybrid = False
Search dense and sparse (lexical) vectors and fuse the two rankings.
Helps where embeddings are weakest: standard numbers, compound technical
terms, proper names. Ingest always writes the sparse vector, whether this is on
or off, so it is a pure query-time switch: no re-ingest either way, and one
collection can serve a dense-vs-hybrid comparison. Off here as the schema
default; the bundled examples/papers instance turns it on.
fusion
class-attribute
instance-attribute
¶
fusion = 'rrf'
hybrid only. rrf fuses on rank position, dbsf on
distribution-normalized scores. RRF is the safer default; DBSF can win when
one of the two retrievers is clearly stronger. Measure before switching.
prefetch_limit
class-attribute
instance-attribute
¶
prefetch_limit = Field(default=30, ge=1)
hybrid only: candidates each leg retrieves before fusion. Must be at
least max_top_k (enforced when hybrid is on) — below it, two legs
returning the same candidates can fuse to fewer than top_k results.
payload_indexes
class-attribute
instance-attribute
¶
payload_indexes = Field(default_factory=list)
Metadata fields to build Qdrant keyword indexes on.
filterable_fields
class-attribute
instance-attribute
¶
filterable_fields = Field(default_factory=list)
Metadata fields retrieve() and profiles are allowed to filter on.
config.schema.CitationConfig ¶
Bases: BaseModel
How sources are rendered as citations and served to the UI.
segments
class-attribute
instance-attribute
¶
segments = Field(default_factory=lambda: ['{title}', '{source_file}', 'p. {page}'])
Ordered format-string segments; a segment is emitted only if every
{field} it references resolves to a non-empty value.
token_word
class-attribute
instance-attribute
¶
token_word = 'Source'
In-text citation token label; drives the clickable-citation regexes.
extra_fields
class-attribute
instance-attribute
¶
extra_fields = Field(default_factory=list)
Optional metadata keys exposed to citation segments (e.g. domain fields).
map_path
class-attribute
instance-attribute
¶
map_path = None
Optional bibliographic citation map JSON (env CITATION_MAP_PATH overrides).
source_pdf_fallback
class-attribute
instance-attribute
¶
source_pdf_fallback = None
Fallback served filename for chunks without a resolvable source file.
labels
class-attribute
instance-attribute
¶
labels = Field(default_factory=dict)
UI label overrides (file/page/section/open/source/…).
config.schema.FilenameRule ¶
Bases: BaseModel
One declarative rule mapping stored source metadata to a served file.
config.schema.SourcesConfig ¶
Bases: BaseModel
Where served source files live and which types are served.
data_dir
class-attribute
instance-attribute
¶
data_dir = 'data'
Primary directory of served source files (env DATA_RAW_DIR overrides).
Not the only one served: the /sources routes also serve from every
data_sources[].path, so a corpus assembled from several folders has all of
its citations clickable without listing those paths a second time here. This
one is searched first, so it wins a duplicate filename, and it stays the anchor
for <data_dir>/figures and <data_dir>/descriptions.
served_extensions
class-attribute
instance-attribute
¶
served_extensions = Field(default_factory=lambda: ['.pdf', '.txt', '.md'])
File types the /sources/... links may serve. A citation pointing at
anything else returns 404, so add an extension here before expecting the app to
open that kind of file.
filename_map
class-attribute
instance-attribute
¶
filename_map = Field(default_factory=list)
Declarative rules for mapping stored names to served files.
config.schema.PromptConfig ¶
Bases: BaseModel
System prompt and starter questions.
system_prompt_path
class-attribute
instance-attribute
¶
system_prompt_path = None
Path to a markdown system prompt (env SYSTEM_PROMPT_PATH overrides).
starter_questions
class-attribute
instance-attribute
¶
starter_questions = Field(default_factory=list)
Questions offered on the welcome screen. Either one list, or one list per
interface language ({de: [...], en: [...]}) for an instance whose users do not
all read the same one. Resolve with settings.starter_questions(language).
auto_generate
class-attribute
instance-attribute
¶
auto_generate = True
When no system prompt is configured/loaded, generate one at startup with
the chat model, grounded in template_path and a sample of the indexed
chunks. Cached as .generated_system_prompt.<collection>.md next to the
config (set env REGENERATE_SYSTEM_PROMPT=true to force a rebuild).
template_path
class-attribute
instance-attribute
¶
template_path = None
Structural template for auto-generation (default: repo-root system.md,
else the bundled config/prompts/default_system.md).
sample_size
class-attribute
instance-attribute
¶
sample_size = Field(default=40, ge=1)
How many indexed chunks to sample when auto-generating the prompt.
config.schema.ToolConfig ¶
Bases: BaseModel
The retrieval (search) tool exposed to the model.
config.schema.ToolsConfig ¶
Bases: BaseModel
Which pluggable agentic-RAG tools are exposed to the model.
enabled lists registry ids from the tools/ package (order = schema
order). Defaults to ["search"] so instances that only declare the legacy
tool: block behave exactly as before. The search tool takes its name
and descriptions from tool:; other tools' descriptions come from their
language-aware defaults unless overridden in descriptions.
descriptions
class-attribute
instance-attribute
¶
descriptions = Field(default_factory=dict)
tool_id -> OpenAI function description override (search uses tool:).
fetch_max_chunks
class-attribute
instance-attribute
¶
fetch_max_chunks = Field(default=200, ge=1)
Whole-document chunk cap for fetch_document. Bounds the Qdrant scroll —
it does not bound what reaches the model; max_context_chars does.
max_context_chars
class-attribute
instance-attribute
¶
max_context_chars = Field(default=120000, ge=1000)
Character budget for one rendered tool context, enforced by dropping whole chunks from the tail — never by cutting inside a chunk.
Sized from the model's context window, not from the corpus: ~30k tokens at the
conventional chars/4, roughly a quarter of a 128k window, leaving room for the
system prompt, the conversation so far and the answer. That is deliberately
above the largest real document this corpus produces (~99,000 chars for a
102-chunk paper), so fetch_document keeps its contract of returning a whole
document. It bounds the case no window could take: fetch_max_chunks (200) x
the chunker's ceiling (6000) is 1.2M chars, ~300k tokens.
Lower it if your gateway serves a smaller window. Nothing can detect this — the gateway advertises no context length for any model — so this is the one knob that has to be set by hand for a 32k deployment.
Cutting inside a chunk is what this replaces: a fixed 1200-char cut made 37% of the corpus searchable but never deliverable, and a term at offset 2312 was invisible even though search had ranked its chunk first.
expand_window
class-attribute
instance-attribute
¶
expand_window = Field(default=1, ge=0)
Default neighbor window for expand_context.
config.schema.ImagesConfig ¶
Bases: BaseModel
How PDF figures are handled at ingest and query time.
none — figures dropped (default; today's behavior).
describe— at ingest, render each figure and have vision_model write a
description, stored as a searchable/citable figure chunk (works
with any chat model).
attach — same ingest as describe, plus at query time the figure pixels are
fed to a vision-capable chat model.
Figure images are persisted (and rendered as UI thumbnails when cited) in both
describe and attach. Switching none→describe/attach needs a
re-ingest; describe↔attach does not.
vision_model
class-attribute
instance-attribute
¶
vision_model = 'gemma-4-31b'
Vision-language model (via the gateway) used to describe figures, and the
expected chat model for attach.
images_scale
class-attribute
instance-attribute
¶
images_scale = Field(default=2.0, gt=0)
Docling figure render scale (2.0 = higher-res crops).
inline_figures
class-attribute
instance-attribute
¶
inline_figures = True
Render a marked figure as a markdown image directly ABOVE the paragraph that
describes it. build_context advertises a per-figure marker token, the model
copies it on its own line, and the answer post-processing swaps it for
. Every retrieved figure the model did NOT mark keeps
the legacy behavior (a cl.Image thumbnail below the answer) — never both.
Inert when mode == "none".
figure_marker_prompt
class-attribute
instance-attribute
¶
figure_marker_prompt = 'Zu jeder Abbildung im Kontext steht eine Zeile "Abbildungs-Marker: {{ABB:...}}". Wenn du eine Abbildung beschreibst, setze deren Marker unverändert in eine eigene Zeile direkt VOR den Absatz, der die Abbildung beschreibt. Kopiere ihn exakt inklusive der geschweiften Klammern (hier ausdrücklich erlaubt, abweichend von der Klammer-Regel für Zitate). Verwende jeden Marker höchstens einmal, erfinde keine Marker und schreibe niemals selbst Bild-Links oder Markdown-Bilder.'
Ephemeral per-request system message teaching the marker protocol. Used
VERBATIM — never .format() it, that would collapse {{ to {.
inline_figure_caption
class-attribute
instance-attribute
¶
inline_figure_caption = False
Also emit the figure caption as an italic line under the inlined image.
show_unmarked_figures
class-attribute
instance-attribute
¶
show_unmarked_figures = True
Whether retrieved figures the answer does NOT reference are still shown as
thumbnails below the message. false = only figures the model actually
marked appear (cleaner, but nothing is shown if it forgets the marker).
With inline_figures: false every figure counts as unmarked, so false
here hides figure thumbnails entirely (descriptions stay searchable).
max_attach_images
class-attribute
instance-attribute
¶
max_attach_images = Field(default=3, ge=1)
attach only: cap on figure images fed to the vision call per answer.
attach_image_max_px
class-attribute
instance-attribute
¶
attach_image_max_px = Field(default=768, ge=64)
attach only: downscale each figure so its longest side ≤ this (JPEG)
before sending to the vision model (keeps the request under the gateway size
limit).
describe_image_max_px
class-attribute
instance-attribute
¶
describe_image_max_px = Field(default=1536, ge=64)
Ingest only: same treatment for the describe call, which used to send
raw full-res PNG and lost oversized figures to HTTP 413. Larger than
attach_image_max_px on purpose: describing a dense chart benefits from
detail the answer-time path does not need, and most of the size reduction
comes from JPEG rather than from downscaling.
figure_store_dir
class-attribute
instance-attribute
¶
figure_store_dir = None
Where figure PNGs are saved. None → <sources.data_dir>/figures.
vision_capable_models
class-attribute
instance-attribute
¶
vision_capable_models = Field(default_factory=lambda: ['gemma-4-31b'])
Chat models allowed to receive figure pixels in attach mode (the gateway
exposes no per-model capability flag, so this list is authoritative).
config.schema.EvaluationConfig ¶
Bases: BaseModel
Automatic answer-quality scoring (off by default).
Scoring does NOT run in this process. It runs in the separate eval_app
service, which owns the metric library and the eval database; this app only
POSTs (question, answer, contexts) after an answer is sent and renders the
numbers that come back. Two reasons: the metric library drags in a dependency
chain that has no business in the Chainlit image, and a judge call must never
sit between the user and their answer.
The two live metrics are reference-free — they need no ground-truth answer, so they
work on real chats — but each costs a judge call, and relevance
additionally costs one embedding call. That is why this is opt-in.
Treat the numbers as deltas, not absolutes: a faithfulness of 0.87 means little on its own, while 0.87 → 0.71 after a chunking change means something.
enabled
class-attribute
instance-attribute
¶
enabled = False
Master switch. While false, nothing is imported, posted or rendered, and the app behaves exactly as it does without this section.
metrics
class-attribute
instance-attribute
¶
metrics = Field(default_factory=lambda: ['faithfulness', 'relevance'])
Which scores to compute. faithfulness = are the answer's claims actually
supported by the retrieved chunks (catches hallucination); relevance = does
the answer address the question that was asked.
judge_model
class-attribute
instance-attribute
¶
judge_model = None
Model that grades the answer. None → models.chat_model. Judging a
model with itself inflates the scores, so prefer naming a different model here
if anyone is going to read the absolute values.
show_badge
class-attribute
instance-attribute
¶
show_badge = True
Show the running conversation score in a badge above the chatbox. false
still records everything for the dashboard, which is what you want when you would
rather not put a number in front of workshop participants.
gold_min_faithfulness
class-attribute
instance-attribute
¶
gold_min_faithfulness = 0.9
An answer scoring at least this on faithfulness (and clearing
gold_min_relevance) makes the badge offer to save the conversation as a gold
reference — a yellow ! appears on the badge, the save action sits in its
panel. null turns the suggestion off entirely.
gold_min_relevance
class-attribute
instance-attribute
¶
gold_min_relevance = 0.8
The relevance half of the gold suggestion threshold. Set lower than faithfulness by default because relevance is the noisier judge metric.
service_url
class-attribute
instance-attribute
¶
service_url = 'http://eval:8001'
Base URL of the eval_app service. The default resolves on the compose
network; running locally with uv run it is http://localhost:8001.
config.schema.ProfileConfig ¶
Bases: BaseModel
An optional persona/role that scopes prompt and retrieval.
retrieval_filters
class-attribute
instance-attribute
¶
retrieval_filters = Field(default_factory=dict)
Metadata field -> value(s) to scope retrieval for this profile.
config.schema.AppConfig ¶
Bases: BaseModel
Runtime/behavioral knobs (streaming, personalization).
show_settings
class-attribute
instance-attribute
¶
show_settings = True
Whether the Chainlit settings panel is shown (even without profiles).
config.schema.UiTextConfig ¶
Bases: BaseModel
Neutral UI/prompt strings (overridable per language).