Skip to main content

Environment variables

OpenRAG recognizes environment variables from the following sources:

Configure environment variables

Environment variables are set in a .env file in the root of your OpenRAG project directory.

For an example .env file, see .env.example in the OpenRAG repository.

The Docker Compose files are populated with values from your .env, so you don't need to edit the Docker Compose files manually.

Environment variables always take precedence over other variables.

Set environment variables

After you start OpenRAG, you must stop and restart OpenRAG containers to apply any changes you make to the .env file.

To set mutable environment variables, do the following:

  1. Stop OpenRAG with the TUI or Docker Compose.

  2. Set the values in the .env file:

    LOG_LEVEL=DEBUG
    LOG_FORMAT=json
    SERVICE_NAME=openrag-dev
  3. Start OpenRAG with the TUI or Docker Compose.

Certain environment variables that you set during application onboarding, such as provider API keys and provider endpoints, require resetting the containers after modifying the .env file.

To change immutable variables with TUI-managed containers, you must reinstall OpenRAG and either delete or modify the .env file before you repeat the setup and onboarding process in the TUI.

To change immutable variables with self-managed containers, do the following:

  1. Stop OpenRAG with Docker Compose.

  2. Remove the containers:

    docker-compose down
  3. Update the values in your .env file.

  4. Start OpenRAG with Docker Compose:

    docker-compose up -d
  5. Repeat application onboarding. The values in your .env file are automatically populated.

Supported environment variables

All OpenRAG configuration can be controlled through environment variables.

AI provider settings

Configure which models and providers OpenRAG uses to generate text and embeddings. These are initially set during application onboarding. Some values are immutable and can only be changed by recreating the OpenRAG containers, as explained in Set environment variables.

VariableDefaultDescription
EMBEDDING_MODELtext-embedding-3-smallEmbedding model for generating vector embeddings for documents in the knowledge base and similarity search queries. Can be changed after application onboarding. Accepts one or more models.
LLM_MODELgpt-4o-miniLanguage model for language processing and text generation in the Chat feature.
MODEL_PROVIDERopenaiModel provider, such as OpenAI or IBM watsonx.ai.
OPENAI_API_KEYNot setOptional OpenAI API key for the default model. For other providers, use PROVIDER_API_KEY.
PROVIDER_API_KEYNot setAPI key for the model provider.
PROVIDER_ENDPOINTNot setCustom provider endpoint for the IBM and Ollama model providers. Leave unset for other model providers.
PROVIDER_PROJECT_IDNot setProject ID for the IBM watsonx.ai model provider only. Leave unset for other model providers.

Document processing

Control how OpenRAG processes and ingests documents into your knowledge base.

VariableDefaultDescription
CHUNK_OVERLAP200Overlap between chunks.
CHUNK_SIZE1000Text chunk size for document processing.
DISABLE_INGEST_WITH_LANGFLOWfalseDisable Langflow ingestion pipeline.
DOCLING_OCR_ENGINESet by OSOCR engine for document processing. For macOS, ocrmac. For any other OS, easyocr.
OCR_ENABLEDfalseEnable OCR for image processing.
OPENRAG_DOCUMENTS_PATHS./openrag-documentsDocument paths for ingestion.
PICTURE_DESCRIPTIONS_ENABLEDfalseEnable picture descriptions.

Langflow settings

Configure Langflow authentication.

VariableDefaultDescription
LANGFLOW_AUTO_LOGINFalseEnable auto-login for Langflow.
LANGFLOW_CHAT_FLOW_IDBuilt-in flow IDThis value is automatically set to the ID of the chat flow. The default value is found in .env.example. Only change this value if you explicitly don't want to use this built-in flow.
LANGFLOW_ENABLE_SUPERUSER_CLIFalseEnable superuser privileges for Langflow CLI commands.
LANGFLOW_INGEST_FLOW_IDBuilt-in flow IDThis value is automatically set to the ID of the ingestion flow. The default value is found in .env.example. Only change this value if you explicitly don't want to use this built-in flow.
LANGFLOW_KEYAutomatically generatedExplicit Langflow API key.
LANGFLOW_NEW_USER_IS_ACTIVEFalseWhether new Langflow users are active by default.
LANGFLOW_PUBLIC_URLhttp://localhost:7860Public URL for the Langflow instance.
LANGFLOW_SECRET_KEYNot setSecret key for Langflow internal operations.
LANGFLOW_SUPERUSERNone, must be explicitly setLangflow admin username. Required.
LANGFLOW_SUPERUSER_PASSWORDNone, must be explicitly setLangflow admin password. Required.
LANGFLOW_URLhttp://localhost:7860URL for the Langflow instance.
NUDGES_FLOW_IDBuilt-in flow IDThis value is automatically set to the ID of the nudges flow. The default value is found in .env.example. Only change this value if you explicitly don't want to use this built-in flow.
SYSTEM_PROMPTYou are a helpful AI assistant with access to a knowledge base. Answer questions based on the provided context.System prompt instructions for the agent driving the Chat flow.

OAuth provider settings

Configure OAuth providers and external service integrations.

VariableDefaultDescription
AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY-AWS integrations.
GOOGLE_OAUTH_CLIENT_ID / GOOGLE_OAUTH_CLIENT_SECRET-Google OAuth authentication.
MICROSOFT_GRAPH_OAUTH_CLIENT_ID / MICROSOFT_GRAPH_OAUTH_CLIENT_SECRET-Microsoft OAuth.
WEBHOOK_BASE_URL-Base URL for webhook endpoints.

OpenSearch settings

Configure OpenSearch database authentication.

VariableDefaultDescription
OPENSEARCH_HOSTlocalhostOpenSearch host.
OPENSEARCH_PASSWORD-Password for OpenSearch admin user. Required.
OPENSEARCH_PORT9200OpenSearch port.
OPENSEARCH_USERNAMEadminOpenSearch username.

System settings

Configure general system components, session management, and logging.

VariableDefaultDescription
LANGFLOW_KEY_RETRIES15Number of retries for Langflow key generation.
LANGFLOW_KEY_RETRY_DELAY2.0Delay between retries in seconds.
LANGFLOW_VERSIONOPENRAG_VERSIONLangflow Docker image version. By default, OpenRAG uses the OPENRAG_VERSION for the Langflow Docker image version.
LOG_FORMATDisabledSet to json to enabled JSON-formatted log output.
LOG_LEVELINFOLogging level (DEBUG, INFO, WARNING, ERROR).
MAX_WORKERS1Maximum number of workers for document processing.
OPENRAG_VERSIONlatestThe version of the OpenRAG Docker images to run. For more information, see Upgrade OpenRAG
SERVICE_NAMEopenragService name for logging.
SESSION_SECRETAutomatically generatedSession management.

Langflow runtime overrides

You can modify flow settings at runtime without permanently changing the flow's configuration.

Runtime overrides are implemented through tweaks, which are one-time parameter modifications that are passed to specific Langflow components during flow execution.

For more information on tweaks, see the Langflow documentation on Input schema (tweaks).

Default values and fallbacks

If a variable isn't set by environment variables or a configuration file, OpenRAG can use a default value if one is defined in the codebase. Default values can be found in the OpenRAG repository: