Skip to main content

Generic RAG backend environment variables

This reference lists every environment variable of the Generic RAG backend, with its default and behavior. It is for platform engineers who deploy the backend. For registration and background jobs, see Configuration.

Version scope​

Defaults below are checked against backend 0.3.3, in settings.py, the other modules that read the environment, and the Dockerfile. The upstream README marks ELASTICSEARCH_USERNAME and ELASTICSEARCH_PASSWORD optional. In the code, both are required once ELASTICSEARCH_URL is set.

The backend also loads a .env file from its working directory at startup. A variable already set in the environment takes precedence over the file. An invalid value stops the backend at startup, with the validation error in its log.

DIAL Core​

VariableRequiredDefaultDescription
DIAL_URLYes—The DIAL Core URL. The backend reads application properties, files, and models there.
DIAL_API_KEYNo—An API key for background jobs. Without it, indexing runs during the upload request, and channel archives are unavailable.
DIAL_PUBLIC_URLNoDIAL_URLThe DIAL Core URL that the channel API description at /docs shows as its server

File cache​

VariableDefaultDescription
IN_MEMORY_CACHE_ENABLEDtrueCaches the content of files the backend writes to and reads from DIAL Core, such as documents and page images. A file is cached by its URL and ETag.
IN_MEMORY_CACHE_CAPACITY128MiBThe cache size of each process, in bytes or as a size such as 1GiB. A larger cache needs more pod memory.

PostgreSQL​

VariableRequiredDefaultDescription
DB_HOSTYes—The database host
DB_PORTNo5432The database port
DB_NAMEYes—The database name. It needs the vector extension.
DB_USERNAMEYes—The database user. It creates the backend's tables at startup.
DB_PASSWORDOne of these two—The password
DB_MSI_ENABLEDOne of these twofalsetrue signs in with an Azure managed identity token instead of a password. It wins over DB_PASSWORD.
DB_MSI_SCOPENohttps://ossrdbms-aad.database.windows.net/.defaultThe token scope for managed identity sign-in

With managed identity, the backend refreshes the token 2 minutes before it expires.

Elasticsearch​

VariableRequiredDefaultDescription
ELASTICSEARCH_URLNo—Turns on the elastic storage backend. The backend uses the URL's scheme, host, and port, and ignores its path.
ELASTICSEARCH_USERNAMEWith the URL—The user, for basic authentication
ELASTICSEARCH_PASSWORDWith the URL—The password
ELASTICSEARCH_INDEX_PREFIXNo—A prefix for the names of the backend's Elasticsearch indexes

When several Generic RAG deployments share one Elasticsearch, give each a unique ELASTICSEARCH_INDEX_PREFIX, as the upstream README requires. A prefix must be lowercase and at most 64 bytes. It can't contain \ / * ? " < > | , # : or spaces, start with -, _, or +, or be . or ...

The backend checks the connection at startup, up to 5 times. When all attempts fail, it doesn't start.

Chat responses​

VariableDefaultDescription
ENABLE_DEBUG_STAGESfalseShows [DEBUG] stages: the channel and request configuration, each index's results, the raw LLM output, token usage, and stack traces of errors
ENABLE_ANNOTATIONStrueCites documents as annotations, which DIAL Chat 1.x shows on the answer. false cites them as attachments, with [n] markers in the text.
ENABLE_QUOTE_THUMBNAILSfalseAdds thumbnails of image chunks to citation attachments. It has no effect while ENABLE_ANNOTATIONS is true.

Values true, yes, and 1 turn a setting on, and false, no, and 0 turn it off.

MCP​

VariableDefaultDescription
MCP_GET_PAGES_LIMIT10The most pages one get_pages call returns. It must be above 0.

Built-in embeddings​

VariableDefaultDescription
BGE_EMBEDDING_MODEL_PATH/home/appuser/bge-small-en in the imageThe epam/bge-small-en model behind the built-in embeddings endpoint. Outside the image, the default is the model's Hugging Face name.

Logging​

VariableDefaultDescription
LOG_LEVELINFOThe log level
LOG_USE_COLORSfalseColors the log output
DIAL_SDK_LOGWARNINGThe level of the DIAL SDK's own logger

Log lines show the trace and span IDs of the request in brackets.

Observability​

The backend names itself generic-rag in telemetry. It uses the DIAL SDK 0.40.0, whose OTLP exporters use gRPC and read the standard OTEL_EXPORTER_OTLP_* variables.

VariableDefaultDescription
OTEL_TRACES_EXPORTERA value that exports nothingotlp exports traces. When it's unset, the backend sets a value that exports nothing.
OTEL_METRICS_EXPORTERUnsetComma-separated. otlp pushes metrics, and prometheus serves them on OTEL_EXPORTER_PROMETHEUS_PORT.
OTEL_LOGS_EXPORTERUnsetComma-separated. otlp exports log records, and console writes them to stderr as JSON lines.
OTEL_EXPORTER_PROMETHEUS_PORT9464The Prometheus port
OTEL_PYTHON_LOG_CORRELATIONtrue, set by the backendAdds trace context to log records

DIAL SDK​

VariableDefaultDescription
DIAL_SDK_HEADERS_TO_PROXYUnsetComma-separated header names. The DIAL SDK copies these headers of the incoming request into the backend's HTTP calls to DIAL_URL.

Set by the image​

VariableValuePurpose
FASTMCP_LOG_ENABLEDfalseTurns off FastMCP's own logging setup
DO_NOT_TRACKtrueTurns off usage tracking in the unstructured library
NUMBA_CACHE_DIR/tmp/numba_cacheThe cache folder of the numba library

Further reading​