Skip to main content

Configuration

Ragpi uses the following environment variables to configure its behavior. These settings control everything from API access and provider configurations to database connections and document processing.

Application Configuration

VariableDescriptionDefaultNotes
PROJECT_NAMEName of the projectthe current projectUsed to scope and focus the AI assistant's responses
PROJECT_DESCRIPTIONDescription of the projectdetermined by the available sourcesDefines the project's scope for the AI assistant
RAGPI_VERSIONAPI version of Ragpiv0.2.xUsed in the OpenAPI spec and in docker-compose.prod.yml to specify the Ragpi image version
API_NAMEName of the API serviceRagpiUsed in the OpenAPI spec
API_SUMMARYSummary of the API serviceRagpi is an AI assistant specialized in retrieving and synthesizing technical information to provide relevant answers to queries.Used in the OpenAPI spec
API_KEYSList of API keys for access (comma-separated)NoneIf not set, the API will be accessible without authentication. To enable API key authentication, set this to a comma-separated list of self-generated API keys (e.g., key1,key2,key3).
WORKERS_ENABLEDEnable/disable background workersTrueWhen disabled, endpoints requiring Celery workers will return a 503
TASK_RETENTION_DAYSNumber of days to retain task history7-
LOG_LEVELLogging levelINFOOptions: DEBUG, INFO, WARNING, ERROR, CRITICAL
USER_AGENTUser agent string for HTTP requestsRagpi-
MAX_CONCURRENT_REQUESTSMaximum number of concurrent requests10-

Provider Configuration

VariableDescriptionDefaultNotes
CHAT_PROVIDERChat service provider. Options: openai, ollamaopenai-
EMBEDDING_PROVIDEREmbedding service provider. Options: openai, ollamaopenai-
OPENAI_API_KEYAPI key for OpenAI servicesNoneRequired if using OpenAI as provider
OLLAMA_BASE_URLBase URL for Ollama providerNoneRequired if using Ollama as provider
DEEPSEEK_API_KEYAPI key for DeepSeek servicesNoneOptional
CHAT_OPENAI_COMPATIBLE_BASE_URLBase URL for OpenAI-compatible chat modelsNoneOptional
CHAT_OPENAI_COMPATIBLE_API_KEYAPI key for OpenAI-compatible chat modelsNoneOptional
EMBEDDING_OPENAI_COMPATIBLE_BASE_URLBase URL for OpenAI-compatible embedding modelsNoneOptional
EMBEDDING_OPENAI_COMPATIBLE_API_KEYAPI key for OpenAI-compatible embedding modelsNoneOptional

Database Configuration

VariableDescriptionDefaultNotes
REDIS_URLRedis connection URLredis://localhost:6379Required
POSTGRES_URLPostgreSQL database URLpostgresql://localhost:5432/ragpiRequired if using postgres backend
DOCUMENT_STORE_BACKENDDocument store backend (postgres, redis)postgres-
DOCUMENT_STORE_NAMESPACENamespace for document storagedocument_storeWhen using postgres, this is the table name; when using redis, it is the key prefix.
SOURCE_METADATA_BACKENDMetadata storage backend (postgres, redis)postgres-
SOURCE_METADATA_NAMESPACENamespace for metadata storagesource_metadataWhen using postgres, this is the table name; when using redis, it is the key prefix.

Chat Settings

VariableDescriptionDefault
BASE_SYSTEM_PROMPTDefault system prompt for the AI assistantSee below
CHAT_HISTORY_LIMITMaximum number of messages retained in the chat history and sent to the model.20
MAX_CHAT_ITERATIONSMaximum steps allowed for generating a response5
RETRIEVAL_TOP_KNumber of top retrieval results10

Model Settings

VariableDescriptionDefaultNotes
DEFAULT_CHAT_MODELDefault model for chat interactionsgpt-4oOnly models that support tool/function callings are supported.
EMBEDDING_MODELModel used for embeddingstext-embedding-3-small-
EMBEDDING_DIMENSIONSDimensions for embedding vectors1536Must match dimensions of selected embedding model

Document Processing

VariableDescriptionDefault
DOCUMENT_UUID_NAMESPACEUUID namespace for document IDsee747eb2-fd0f-4650-9785-a2e9ae036ff2
CHUNK_SIZESize of document chunks for processing (in tokens)512
CHUNK_OVERLAPOverlap size between document chunks (in tokens)50
DOCUMENT_SYNC_BATCH_SIZENumber of documents processed per batch during sync500

GitHub

VariableDescriptionDefault
GITHUB_TOKENGitHub token for accessing repositoriesNone
GITHUB_API_VERSIONGitHub API version2022-11-28

Discord Configuration

VariableDescriptionDefaultNotes
DISCORD_TOKENThe discord bot token for authenticating with DiscordNoneRequired
DISCORD_CHANNEL_IDSComma-separated list of Discord channel IDs to listen onNoneRequired
RAGPI_BASE_URLBase URL for Ragpi. All chat requests will be sent to this endpointNoneRequired
RAGPI_API_KEYAPI key for authenticating with Ragpi endpointsNoneIf provided, sets the x-api-key header on requests to Ragpi.
DISCORD_SOURCESComma-separated list of sources to pass to Ragpi for context retrievalNoneIf not set, will use all sources.
DISCORD_CHAT_MODELName of the chat model to useNoneIf not set, Ragpi's default model will be used.
DISCORD_REQUIRE_MENTIONWhether the bot requires a direct mention to respondtrueAccepts true, True, or TRUE for enabled; anything else is treated as disabled.

OpenTelemetry Settings

VariableDescriptionDefaultNotes
OTEL_ENABLEDEnable/disable OpenTelemetryFalse-
OTEL_SERVICE_NAMEService name for OpenTelemetryragpi-
OTEL_EXPORTER_OTLP_ENDPOINTOpenTelemetry collector endpointNoneRequired when OpenTelemetry is enabled

When enabled, Ragpi provides basic tracing capabilities through OpenTelemetry instrumentation using the http/protobuf protocol. This includes automatic tracing of FastAPI endpoints and LLM API calls, with spans exported to the endpoint specified in OTEL_EXPORTER_OTLP_ENDPOINT.

Default System Prompt

The default value for BASE_SYSTEM_PROMPT is:

You are an AI assistant specialized in retrieving and synthesizing technical information to provide relevant answers to queries.