Skip to main content

RAG & Content Extraction

Content extraction engines, document processing, embeddings, reranking, query generation and cloud document sources for retrieval-augmented generation.

These variables are set on the Hrida.ai container. Variables marked ConfigVar are saved to the database on first start — see how ConfigVar works before changing them later.

RAG Content Extraction Engine​

CONTENT_EXTRACTION_ENGINE​

  • Type: str
  • Options:
    • Leave empty to use default
    • external - Use external loader
    • tika - Use a local Apache Tika server
    • docling - Use Docling engine
    • document_intelligence - Use Document Intelligence engine
    • mistral_ocr - Use Mistral OCR engine
    • datalab_marker - Use Datalab Marker engine
    • mineru - Use MinerU engine
    • paddleocr_vl - Use a PaddleOCR-vl server (requires PADDLEOCR_VL_TOKEN; see below)
  • Description: Sets the content extraction engine to use for document ingestion.
  • Persistence: This environment variable is a ConfigVar variable.

MISTRAL_OCR_API_KEY​

  • Type: str
  • Default: None
  • Description: Specifies the Mistral OCR API key to use.
  • Persistence: This environment variable is a ConfigVar variable.

MISTRAL_OCR_API_BASE_URL​

  • Type: str
  • Default: https://api.mistral.ai/v1
  • Description: Configures custom Mistral OCR API endpoints for flexible deployment options, allowing users to point to self-hosted or alternative Mistral OCR instances.
  • Persistence: This environment variable is a ConfigVar variable.

EXTERNAL_DOCUMENT_LOADER_URL​

  • Type: str
  • Default: None
  • Description: Sets the URL for the external document loader service.
  • Persistence: This environment variable is a ConfigVar variable.

EXTERNAL_DOCUMENT_LOADER_API_KEY​

  • Type: str
  • Default: None
  • Description: Sets the API key for authenticating with the external document loader service.
  • Persistence: This environment variable is a ConfigVar variable.

TIKA_SERVER_URL​

  • Type: str
  • Default: http://localhost:9998
  • Description: Sets the URL for the Apache Tika server.
  • Persistence: This environment variable is a ConfigVar variable.

DOCLING_SERVER_URL​

  • Type: str
  • Default: http://docling:5001
  • Description: Specifies the URL for the Docling server. Requires Docling version 2.0.0 or later for full compatibility with the new parameter-based configuration system.
  • Persistence: This environment variable is a ConfigVar variable.
warning

Docling 2.0.0+ Required

The Docling integration has been refactored to use server-side parameter passing. If you are using Docling:

  1. Upgrade to Docling server version 2.0.0 or later
  2. Migrate all individual DOCLING_* configuration variables to the DOCLING_PARAMS JSON object
  3. Remove all deprecated DOCLING_* environment variables from your configuration
  4. Add DOCLING_API_KEY if your server requires authentication

The old individual environment variables (DOCLING_OCR_ENGINE, DOCLING_OCR_LANG, etc.) are no longer supported and will be ignored.

DOCLING_API_KEY​

  • Type: str
  • Default: None
  • Description: Sets the API key for authenticating with the Docling server. Required when the Docling server has authentication enabled.
  • Persistence: This environment variable is a ConfigVar variable.

DOCLING_PARAMS​

  • Type: str (JSON)

  • Default: {}

  • Description: Specifies all Docling processing parameters in JSON format. This is the primary configuration method for Docling processing options. All previously individual Docling settings are now configured through this single JSON object.

    Supported Parameters:

    • do_ocr (bool): Enable OCR processing.
    • force_ocr (bool): Force OCR even when text layer exists.
    • ocr_engine (str): OCR engine to use. Options: tesseract, easyocr, ocrmac, rapidocr, tesserocr.
    • ocr_lang (list[str]): OCR language codes. Note: Format depends on engine (e.g., ["eng", "fra"] for Tesseract; ["en", "fr"] for EasyOCR).
    • pdf_backend (str): PDF processing backend. Options: dlparse_v1, dlparse_v2, dlparse_v4, pypdfium2.
    • table_mode (str): Table extraction mode. Options: fast, accurate.
    • pipeline (str): Processing pipeline to use. Options: fast, standard.
    • do_picture_description (bool): Enable image description generation.
    • picture_description_mode (str): Mode for picture descriptions. Options: local, api.
    • picture_description_local (str): Local model configuration object for picture descriptions.
    • picture_description_api (str): API endpoint configuration object for picture descriptions.
    • vlm_pipeline_model_api (str): Vision-language model API configuration. (e.g., openai://gpt-4o).
  • Example:

json
{
  "do_ocr": true,
  "ocr_engine": "tesseract",
  "ocr_lang": ["eng", "fra", "deu", "spa"],
  "force_ocr": false,
  "pdf_backend": "dlparse_v4",
  "table_mode": "accurate",
  "do_picture_description": true,
  "picture_description_mode": "api",
  "vlm_pipeline_model_api": "openai://gpt-4o"
}
tip

dlparse vs dbparse: Note that the backend names use dlparse (Deep Learning Parse), not dbparse. For modern Docling (v2+), dlparse_v4 is generally recommended for the best balance of features.

  • Persistence: This environment variable is a ConfigVar variable.
info

Migration from Individual Docling Variables

If you were previously using individual DOCLING_* environment variables (such as DOCLING_OCR_ENGINE, DOCLING_OCR_LANG, etc.), these are now deprecated. You must migrate to using DOCLING_PARAMS as a single JSON configuration object.

Example Migration:

bash
# Old configuration (deprecated)
DOCLING_OCR_ENGINE=tesseract
DOCLING_OCR_LANG=eng,fra
DOCLING_DO_OCR=true

# New configuration (required)
DOCLING_PARAMS='{"do_ocr": true, "ocr_engine": "tesseract", "ocr_lang": "eng,fra"}'
warning

When setting this environment variable in a .env file, ensure proper JSON formatting and escape quotes as needed:

DOCLING_PARAMS="{\"do_ocr\": true, \"ocr_engine\": \"tesseract\", \"ocr_lang\": \"eng,fra,deu,spa\"}"

MINERU_API_TIMEOUT​

  • Type: str
  • Default: 300
  • Description: Sets the timeout in seconds for MinerU API requests during document processing.
  • Persistence: This environment variable is a ConfigVar variable.

PADDLEOCR_VL_BASE_URL​

  • Type: str
  • Default: http://localhost:8080
  • Description: Base URL of the PaddleOCR-vl server used when CONTENT_EXTRACTION_ENGINE=paddleocr_vl. Documents and images are POSTed to {base_url}/layout-parsing and the response's layoutParsingResults[].markdown.text is ingested page-by-page.
  • Persistence: This environment variable is a ConfigVar variable.

PADDLEOCR_VL_TOKEN​

  • Type: str
  • Default: "" (empty)
  • Description: Authentication token for the PaddleOCR-vl server. Sent as Authorization: token {'<value>'} on every layout-parsing request. The PaddleOCR-vl engine is skipped at runtime if this value is empty — the loader falls back to the default PyPDFLoader for the current document even when CONTENT_EXTRACTION_ENGINE=paddleocr_vl is set. Set this to activate the engine.
  • Persistence: This environment variable is a ConfigVar variable.
Supported file types

PaddleOCR-vl handles both documents and images. Extensions treated as images and dispatched with fileType=1: png, jpg, jpeg, bmp, tiff, webp. Everything else is dispatched with fileType=0 (document, e.g. PDFs). Output is per-page Markdown, so downstream chunking behaves the same as other engines.

Retrieval Augmented Generation (RAG)​

Core Configuration​

RAG_EMBEDDING_ENGINE​

  • Type: str
  • Options:
    • Leave empty for Default (SentenceTransformers) - Uses SentenceTransformers for embeddings.
    • ollama - Uses the Ollama API for embeddings.
    • openai - Uses the OpenAI API for embeddings.
    • azure_openai - Uses Azure OpenAI Services for embeddings.
  • Description: Selects an embedding engine to use for RAG.
  • Persistence: This environment variable is a ConfigVar variable.

RAG_EMBEDDING_MODEL​

  • Type: str
  • Default: sentence-transformers/all-MiniLM-L6-v2
  • Description: Sets a model for embeddings. Locally, a Sentence-Transformer model is used.
  • Persistence: This environment variable is a ConfigVar variable.

RAG_TOP_K​

  • Type: int
  • Default: 3
  • Description: Sets the default number of results to consider for the embedding when using RAG.
  • Persistence: This environment variable is a ConfigVar variable.

RAG_TOP_K_RERANKER​

  • Type: int
  • Default: 3
  • Description: Sets the default number of results to consider for the reranker when using RAG.
  • Persistence: This environment variable is a ConfigVar variable.

RAG_RELEVANCE_THRESHOLD​

  • Type: float
  • Default: 0.0
  • Description: Sets the relevance threshold to consider for documents when used with reranking.
  • Persistence: This environment variable is a ConfigVar variable.
  • Type: bool
  • Default: False
  • Description: Enables hybrid search (BM25 + vector retrieval), with optional reranking if a reranking model is configured. Applies to both the standard RAG retrieval pipeline and the native knowledge tools used in agentic mode.
  • Persistence: This environment variable is a ConfigVar variable.

RAG_HYBRID_BM25_WEIGHT​

  • Type: float
  • Default: 0.5
  • Description: Sets the weight given to the keyword search (BM25) during hybrid search. 1 means only keyword search, 0 means only vector search.
  • Persistence: This environment variable is a ConfigVar variable.

ENABLE_RAG_HYBRID_SEARCH_ENRICHED_TEXTS​

  • Type: bool
  • Default: False
  • Description: Enhances BM25 hybrid search by enriching indexed text with document metadata including filenames, titles, sections, and snippets. This improves keyword recall for metadata-based queries, allowing searches to match on document names and structural elements in addition to content.
  • Persistence: This environment variable is a ConfigVar variable.
info

Enabling this feature increases the text volume indexed by BM25, which may impact storage requirements and indexing performance. However, it significantly improves search results when users query based on document names, titles, or structural elements rather than just content.

RAG_TEMPLATE​

  • Type: str
  • Default: The value of DEFAULT_RAG_TEMPLATE environment variable.

DEFAULT_RAG_TEMPLATE:


### Task:
Respond to the user query using the provided context, incorporating inline citations in the format [id] **only when the <source> tag includes an explicit id attribute** (e.g., <source id="1">).

### Guidelines:
- If you don't know the answer, clearly state that.
- If uncertain, ask the user for clarification.
- Respond in the same language as the user's query.
- If the context is unreadable or of poor quality, inform the user and provide the best possible answer.
- If the answer isn't present in the context but you possess the knowledge, explain this to the user and provide the answer using your own understanding.
- **Only include inline citations using [id] (e.g., [1], [2]) when the <source> tag includes an id attribute.**
- Do not cite if the <source> tag does not contain an id attribute.
- Do not use XML tags in your response.
- Ensure citations are concise and directly related to the information provided.

### Example of Citation:
If the user asks about a specific topic and the information is found in a source with a provided id attribute, the response should include the citation like in the following example:
* "According to the study, the proposed method increases efficiency by 20% [1]."

### Output:
Provide a clear and direct response to the user's query, including inline citations in the format [id] only when the <source> tag with id attribute is present in the context.

<context>
{{CONTEXT}}
</context>

<user_query>
{{QUERY}}
</user_query>
  • Description: Template to use when injecting RAG documents into chat completion.
  • Persistence: This environment variable is a ConfigVar variable.

Document Processing​

CHUNK_SIZE​

  • Type: int
  • Default: 1000
  • Description: Sets the document chunk size for embeddings.
  • Persistence: This environment variable is a ConfigVar variable.

CHUNK_OVERLAP​

  • Type: int
  • Default: 100
  • Description: Specifies how much overlap there should be between chunks.
  • Persistence: This environment variable is a ConfigVar variable.

CHUNK_MIN_SIZE_TARGET​

  • Type: int
  • Default: 0
  • Description: Chunks smaller than this threshold will be intelligently merged with neighboring chunks when possible. This helps prevent tiny, low-quality fragments that can hurt retrieval performance and waste embedding resources. This feature only works when ENABLE_MARKDOWN_HEADER_TEXT_SPLITTER is enabled. Set to 0 to disable merging. For more information on the benefits and configuration, see the RAG guide.
  • Persistence: This environment variable is a ConfigVar variable.

RAG_TEXT_SPLITTER​

  • Type: str
  • Options:
    • character
    • token
  • Default: character
  • Description: Sets the text splitter for RAG models. Use character for RecursiveCharacterTextSplitter or token for TokenTextSplitter (Tiktoken-based).
  • Persistence: This environment variable is a ConfigVar variable.

ENABLE_MARKDOWN_HEADER_TEXT_SPLITTER​

  • Type: bool
  • Default: True
  • Description: Enables markdown header text splitting as a preprocessing step before character or token splitting. When enabled, documents are first split by markdown headers (h1-h6), then the resulting chunks are further processed by the configured text splitter (RAG_TEXT_SPLITTER). This helps preserve document structure and context across chunks.
  • Persistence: This environment variable is a ConfigVar variable.
info

Migration from markdown_header TEXT_SPLITTER

The markdown_header option has been removed from RAG_TEXT_SPLITTER. Markdown header splitting is now a preprocessing step controlled by ENABLE_MARKDOWN_HEADER_TEXT_SPLITTER. If you were using RAG_TEXT_SPLITTER=markdown_header, switch to character or token and ensure ENABLE_MARKDOWN_HEADER_TEXT_SPLITTER is enabled (it is enabled by default).

TIKTOKEN_CACHE_DIR​

  • Type: str
  • Default: {CACHE_DIR}/tiktoken
  • Description: Sets the directory for TikToken cache.

TIKTOKEN_ENCODING_NAME​

  • Type: str
  • Default: cl100k_base
  • Description: Sets the encoding name for TikToken.
  • Persistence: This environment variable is a ConfigVar variable.

PDF_EXTRACT_IMAGES​

  • Type: bool
  • Default: False
  • Description: Extracts images from PDFs using OCR when loading documents.
  • Persistence: This environment variable is a ConfigVar variable.

PDF_LOADER_MODE​

  • Type: str
  • Options:
    • page - Creates one document per page (default).
    • single - Combines all pages into one document for better chunking across page boundaries.
  • Default: page
  • Description: Controls how PDFs are loaded and split into documents when using the default content extraction engine (PyPDFLoader). Page mode creates one document per page, while single mode combines all pages into one document, which can improve chunking quality when content spans across page boundaries. This setting has no effect when using external content extraction engines like Tika, Docling, Document Intelligence, MinerU, or Mistral OCR, as those engines have their own document handling logic.
  • Persistence: This environment variable is a ConfigVar variable.

RAG_FILE_MAX_SIZE​

  • Type: int
  • Description: Sets the maximum size of a file in megabytes that can be uploaded for document ingestion.
  • Persistence: This environment variable is a ConfigVar variable.

RAG_FILE_MAX_COUNT​

  • Type: int
  • Description: Sets the maximum number of files that can be uploaded at once for document ingestion.
  • Persistence: This environment variable is a ConfigVar variable.

RAG_ALLOWED_FILE_EXTENSIONS​

  • Type: list of str
  • Default: [] (which means all supported file types are allowed)
  • Description: Specifies which file extensions are permitted for upload.
json
["pdf,docx,txt"]
  • Persistence: This environment variable is a ConfigVar variable.
info

When configuring RAG_FILE_MAX_SIZE and RAG_FILE_MAX_COUNT, ensure that the values are reasonable to prevent excessive file uploads and potential performance issues.

Embedding Engine Configuration​

General Embedding Settings​

RAG_EMBEDDING_BATCH_SIZE​

  • Type: int
  • Default: 1
  • Description: Controls how many text chunks are embedded in a single API request when using external embedding providers (Ollama, OpenAI, or Azure OpenAI). Higher values (20-100+; max 16000 (not recommended)) may process documents faster by sending less, but larger API requests. Some external APIs do not support batching or sending more than 1 chunk per request. In such casey you must leave this at 1. Default is 1 (safest option if the API does not support batching / more than 1 chunk per request). This setting only applies to external embedding engines, not the default SentenceTransformers engine.
  • Persistence: This environment variable is a ConfigVar variable.
info

Check if your API and embedding model supports batched processing. Only increase this variable's value if it does - otherwise you might run into unexpected issues.

ENABLE_ASYNC_EMBEDDING​

  • Type: bool
  • Default: true
  • Description: Runs embedding tasks asynchronously (parallelized) for maximum performance. Only works for Ollama, OpenAI and Azure OpenAI, does not affect sentence transformer setups.
  • Persistence: This environment variable is a ConfigVar variable.
tip

It may be needed to increase the value of THREAD_POOL_SIZE if many other users are simultaneously using your Hrida.ai instance while having async embeddings turned on to prevent

warning

Enabling this will potentially send thousands of requests per minute. If you are embedding locally, ensure that you can handle this amount of requests, otherwise turn this off to return to sequential embedding (slower but will always work). If you are embedding externally via API, ensure your rate limits are high enough to handle parallel embedding. (Usually, OpenAI can handle thousands of embedding requests per minute, even on the lowest API tier).

RAG_EMBEDDING_CONCURRENT_REQUESTS​

  • Type: int
  • Default: 0
  • Description: Limits the number of concurrent embedding API requests when async embedding is enabled. Uses an asyncio semaphore to throttle parallel requests. Set to 0 for unlimited concurrency (default behavior), or set to a positive integer to cap simultaneous requests. Useful for respecting rate limits on external embedding APIs or reducing load on local embedding servers.
  • Persistence: This environment variable is a ConfigVar variable.
tip

If you are hitting rate limits from your embedding provider (e.g., 429 errors), set this to a value that keeps you within your API tier's rate limit (e.g., 5 or 10). This is especially helpful when uploading large documents that generate many embedding batches.

RAG_EMBEDDING_TIMEOUT​

  • Type: int (seconds)
  • Default: None (no timeout)
  • Description: Sets an optional timeout in seconds for embedding operations during document upload. When set, embedding requests that exceed this duration will be aborted with a timeout error. When unset (default), embedding operations run without a time limit. This setting is primarily relevant for deployments using the default SentenceTransformers embedding engine, where embeddings run locally and can take longer on slower hardware. External embedding engines (Ollama, OpenAI, Azure OpenAI) have their own timeout mechanisms and are generally not affected by this setting.
info

This variable was introduced alongside a fix for uvicorn worker death during document uploads. Previously, local embedding operations could block the worker thread long enough to trigger uvicorn's health check timeout (default: 5 seconds), causing the worker process to be killed. The underlying fix uses run_coroutine_threadsafe to keep the main event loop responsive to health checks regardless of this timeout setting. The timeout is purely a safety net for aborting abnormally long embedding operations — it does not affect worker health check behavior.

RAG_EMBEDDING_CONTENT_PREFIX​

  • Type: str
  • Default: None
  • Description: Sets the prefix string prepended to document content before generating embeddings. Some embedding models (e.g., nomic-embed-text) require task-specific prefixes to differentiate between content being stored vs. queries being searched. For nomic-embed-text, set this to search_document: . Only needed if your embedding model's documentation specifies a content/document prefix.

RAG_EMBEDDING_QUERY_PREFIX​

  • Type: str
  • Default: None
  • Description: Sets the prefix string prepended to user queries before generating embeddings for retrieval. This is the counterpart to RAG_EMBEDDING_CONTENT_PREFIX. For nomic-embed-text, set this to search_query: . Only needed if your embedding model's documentation specifies a query prefix.

RAG_EMBEDDING_PREFIX_FIELD_NAME​

  • Type: str
  • Default: None
  • Description: Specifies the JSON field name used to pass the prefix to the embedding API request body. When set along with a prefix value, the prefix is sent as a separate field in the API request rather than being prepended to the text. Required for embedding APIs that accept the prefix as a dedicated parameter instead of inline text.

OpenAI Embeddings​

RAG_OPENAI_API_BASE_URL​

  • Type: str
  • Default: ${OPENAI_API_BASE_URL}
  • Description: Sets the OpenAI base API URL to use for RAG embeddings.
  • Persistence: This environment variable is a ConfigVar variable.

RAG_OPENAI_API_KEY​

  • Type: str
  • Default: ${OPENAI_API_KEY}
  • Description: Sets the OpenAI API key to use for RAG embeddings.
  • Persistence: This environment variable is a ConfigVar variable.

RAG_EMBEDDING_OPENAI_BATCH_SIZE​

  • Type: int
  • Default: 1
  • Description: Sets the batch size for OpenAI embeddings.

Azure OpenAI Embeddings​

RAG_AZURE_OPENAI_BASE_URL​

  • Type: str
  • Default: None
  • Description: Sets the base URL for Azure OpenAI Services when using Azure OpenAI for RAG embeddings. Should be in the format https://{your-resource-name}.openai.azure.com.
  • Persistence: This environment variable is a ConfigVar variable.

RAG_AZURE_OPENAI_API_KEY​

  • Type: str
  • Default: None
  • Description: Sets the API key for Azure OpenAI Services when using Azure OpenAI for RAG embeddings.
  • Persistence: This environment variable is a ConfigVar variable.

RAG_AZURE_OPENAI_API_VERSION​

  • Type: str
  • Default: None
  • Description: Sets the API version for Azure OpenAI Services when using Azure OpenAI for RAG embeddings. Common values include 2023-05-15, 2023-12-01-preview, or 2024-02-01.
  • Persistence: This environment variable is a ConfigVar variable.

Ollama Embeddings​

RAG_OLLAMA_BASE_URL​

  • Type: str
  • Description: Sets the base URL for Ollama API used in RAG models.
  • Persistence: This environment variable is a ConfigVar variable.

RAG_OLLAMA_API_KEY​

  • Type: str
  • Description: Sets the API key for Ollama API used in RAG models.
  • Persistence: This environment variable is a ConfigVar variable.

Reranking​

RAG_RERANKING_ENGINE​

  • Type: str
  • Options: external, or empty for local Sentence-Transformer CrossEncoder
  • Default: Empty string (local reranking)
  • Description: Specifies the reranking engine to use. Set to external to use an external reranker API (requires RAG_EXTERNAL_RERANKER_URL). Leave empty to use a local Sentence-Transformer CrossEncoder model.
  • Persistence: This environment variable is a ConfigVar variable.

RAG_RERANKING_MODEL​

  • Type: str
  • Description: Sets a model for reranking results. Locally, a Sentence-Transformer model is used.
  • Persistence: This environment variable is a ConfigVar variable.

RAG_RERANKING_BATCH_SIZE​

  • Type: int
  • Default: 32
  • Description: Controls how many query–document pairs are scored in a single batch during local reranking. Higher values use more memory but can be faster on GPUs with sufficient VRAM. This applies to the local ColBERT/CrossEncoder reranking model's predict() call.
  • Persistence: This environment variable is a ConfigVar variable.

SENTENCE_TRANSFORMERS_CROSS_ENCODER_SIGMOID_ACTIVATION_FUNCTION​

  • Type: bool
  • Default: True
  • Description: When enabled (default), applies sigmoid normalization to local CrossEncoder reranking scores to ensure they fall within the 0-1 range. This allows the relevance threshold setting to work correctly with models like MS MARCO that output raw logits.

RAG_EXTERNAL_RERANKER_TIMEOUT​

  • Type: str
  • Default: Empty string (' ')
  • Description: Sets the timeout in seconds for external reranker API requests during RAG document retrieval. Leave empty to use default timeout behavior.
  • Persistence: This environment variable is a ConfigVar variable.

RAG_EXTERNAL_RERANKER_URL​

  • Type: str
  • Default: Empty string (' ')
  • Description: Sets the full URL for the external reranking API.
  • Persistence: This environment variable is a ConfigVar variable.
warning

You MUST provide the full URL, including the endpoint path (e.g., https://api.yourprovider.com/v1/rerank). The system does not automatically append /v1/rerank or any other path to the base URL you provide.

RAG_EXTERNAL_RERANKER_API_KEY​

  • Type: str
  • Default: Empty string (' ')
  • Description: Sets the API key for the external reranking API.
  • Persistence: This environment variable is a ConfigVar variable.

Query Generation​

ENABLE_RETRIEVAL_QUERY_GENERATION​

  • Type: bool
  • Default: True
  • Description: Enables or disables retrieval query generation.
  • Persistence: This environment variable is a ConfigVar variable.

ENABLE_QUERIES_CACHE​

  • Type: bool
  • Default: False
  • Description: Enables request-scoped caching of LLM-generated search queries. When enabled, queries generated for web search are cached and automatically reused for file/knowledge base retrieval within the same request. This eliminates duplicate LLM calls when both web search and RAG are active, reducing token usage and latency while maintaining search quality. It is highly recommended to enable this especially in larger setups.

QUERY_GENERATION_PROMPT_TEMPLATE​

  • Type: str
  • Default: The value of DEFAULT_QUERY_GENERATION_PROMPT_TEMPLATE environment variable.

DEFAULT_QUERY_GENERATION_PROMPT_TEMPLATE:


### Task:
Analyze the chat history to determine the necessity of generating search queries, in the given language. By default, **prioritize generating 1-3 broad and relevant search queries** unless it is absolutely certain that no additional information is required. The aim is to retrieve comprehensive, updated, and valuable information even with minimal uncertainty. If no search is unequivocally needed, return an empty list.

### Guidelines:
- Respond **EXCLUSIVELY** with a JSON object. Any form of extra commentary, explanation, or additional text is strictly prohibited.
- When generating search queries, respond in the format: { "queries": ["query1", "query2"] }, ensuring each query is distinct, concise, and relevant to the topic.
- If and only if it is entirely certain that no useful results can be retrieved by a search, return: { "queries": [] }.
- Err on the side of suggesting search queries if there is **any chance** they might provide useful or updated information.
- Be concise and focused on composing high-quality search queries, avoiding unnecessary elaboration, commentary, or assumptions.
- Today's date is: {{CURRENT_DATE}}.
- Always prioritize providing actionable and broad queries that maximize informational coverage.

### Output:
Strictly return in JSON format:
{
"queries": ["query1", "query2"]
}

### Chat History:
<chat_history>
{{MESSAGES:END:6}}
</chat_history>
  • Description: Sets the prompt template for query generation.
  • Persistence: This environment variable is a ConfigVar variable.

Document Intelligence (Azure)​

DOCUMENT_INTELLIGENCE_ENDPOINT​

  • Type: str
  • Default: None
  • Description: Specifies the endpoint for document intelligence.
  • Persistence: This environment variable is a ConfigVar variable.

DOCUMENT_INTELLIGENCE_KEY​

  • Type: str
  • Default: None
  • Description: Specifies the key for document intelligence.
  • Persistence: This environment variable is a ConfigVar variable.

DOCUMENT_INTELLIGENCE_MODEL​

  • Type: str
  • Default: None
  • Description: Specifies the model for document intelligence.
  • Persistence: This environment variable is a ConfigVar variable.

Advanced Settings​

BYPASS_EMBEDDING_AND_RETRIEVAL​

  • Type: bool
  • Default: False
  • Description: Bypasses the embedding and retrieval process.
  • Persistence: This environment variable is a ConfigVar variable.

RAG_FULL_CONTEXT​

  • Type: bool
  • Default: False
  • Description: Specifies whether to use the full context for RAG.
  • Persistence: This environment variable is a ConfigVar variable.

RAG_SYSTEM_CONTEXT​

  • Type: bool
  • Default: False
  • Description: When enabled, injects RAG context into the system message instead of the user message. This is highly recommended for optimizing performance when using models that support KV prefix caching or Prompt Caching. This includes local engines (like Ollama, llama.cpp, or vLLM) and cloud providers / Model-as-a-Service providers (like OpenAI and Vertex AI). By placing the context in the system message, it remains at a stable position at the start of the conversation, allowing the cache to persist across multiple turns. When disabled (default), context is injected into the user message, which shifts position each turn and invalidates the cache.

ENABLE_RAG_LOCAL_WEB_FETCH​

  • Type: bool
  • Default: False
  • Description: Controls whether outbound fetches can access URLs that resolve to private/local network IP addresses. It started as a RAG web-fetch guard, but the same SSRF gate now also covers other caller-influenced fetch surfaces, including user and automation webhooks, retrieval, remote image loading and OAuth profile-picture fetches.
  • Persistence: This environment variable is a ConfigVar variable.

When disabled (default), Hrida.ai blocks web fetch requests to URLs that resolve to private IP addresses, including:

  • IPv4 private ranges (10.x.x.x, 172.16.x.x-172.31.x.x, 192.168.x.x, 127.x.x.x)
  • IPv6 private ranges

This is a Server-Side Request Forgery (SSRF) protection. Without this safeguard, a malicious user could provide URLs that appear external but resolve to internal addresses, potentially exposing internal services, cloud metadata endpoints, or other sensitive resources.

warning

Only enable this setting if you need to fetch content from internal network resources (e.g., an internal wiki or intranet) and you trust all users with access to your Hrida.ai instance. Enabling this in a multi-tenant or public-facing deployment introduces significant security risk.

Google Drive​

ENABLE_GOOGLE_DRIVE_INTEGRATION​

  • Type: bool
  • Default: False
  • Description: Enables or disables Google Drive integration. If set to true, and GOOGLE_DRIVE_CLIENT_ID & GOOGLE_DRIVE_API_KEY are both configured, Google Drive will appear as an upload option in the chat UI.
  • Persistence: This environment variable is a ConfigVar variable.
info

When enabling ENABLE_GOOGLE_DRIVE_INTEGRATION, ensure that you have configured GOOGLE_DRIVE_CLIENT_ID and GOOGLE_DRIVE_API_KEY correctly, and have reviewed Google's terms of service and usage guidelines.

GOOGLE_DRIVE_CLIENT_ID​

  • Type: str
  • Description: Sets the client ID for Google Drive (client must be configured with Drive API and Picker API enabled).
  • Persistence: This environment variable is a ConfigVar variable.

GOOGLE_DRIVE_API_KEY​

  • Type: str
  • Description: Sets the API key for Google Drive integration.
  • Persistence: This environment variable is a ConfigVar variable.

OneDrive​

info

For a step-by-step setup guide, check out our tutorial: Configuring OneDrive & SharePoint Integration.

ENABLE_ONEDRIVE_INTEGRATION​

  • Type: bool
  • Default: False
  • Description: Enables or disables the Microsoft OneDrive integration feature globally.
  • Persistence: This environment variable is a ConfigVar variable.
warning

Configuring OneDrive integration is a multi-step process that requires creating and correctly configuring an Azure App Registration. The authentication flow also depends on a browser pop-up window. Please ensure that your browser's pop-up blocker is disabled for your Hrida.ai domain to allow the authentication and file selection window to appear.

ENABLE_ONEDRIVE_PERSONAL​

  • Type: bool
  • Default: True
  • Description: Controls whether the "Personal OneDrive" option appears in the attachment menu. The option is only shown when ONEDRIVE_CLIENT_ID_PERSONAL (or the legacy ONEDRIVE_CLIENT_ID) is configured — without a client ID, the option stays hidden even if this variable is True.
  • Persistence: This environment variable is a ConfigVar variable.

ENABLE_ONEDRIVE_BUSINESS​

  • Type: bool
  • Default: True
  • Description: Controls whether the "Work/School OneDrive" option appears in the attachment menu. The option is only shown when ONEDRIVE_CLIENT_ID_BUSINESS (or the legacy ONEDRIVE_CLIENT_ID) is configured — without a client ID, the option stays hidden even if this variable is True.
  • Persistence: This environment variable is a ConfigVar variable.

ONEDRIVE_CLIENT_ID​

  • Type: str
  • Default: None
  • Description: Generic environment variable for the OneDrive Client ID. You should rather use the specific ONEDRIVE_CLIENT_ID_PERSONAL or ONEDRIVE_CLIENT_ID_BUSINESS variables. This exists as a legacy option for backwards compatibility.

ONEDRIVE_CLIENT_ID_PERSONAL​

  • Type: str
  • Default: None
  • Description: Specifies the Application (client) ID for the Personal OneDrive integration. This requires a separate Azure App Registration configured to support personal Microsoft accounts. Do not put the business OneDrive client ID here!

ONEDRIVE_CLIENT_ID_BUSINESS​

  • Type: str
  • Default: None
  • Description: Specifies the Application (client) ID for the Work/School (Business) OneDrive integration. This requires a separate Azure App Registration configured to support personal Microsoft accounts. Do not put the personal OneDrive client ID here!
info

This Client ID (also known as Application ID) is obtained from an Azure App Registration within your Microsoft Entra ID (formerly Azure AD) tenant. When configuring the App Registration in Azure, the Redirect URI must be set to the URL of your Hrida.ai instance and configured as a Single-page application (SPA) type for the authentication to succeed.

ONEDRIVE_SHAREPOINT_URL​

  • Type: str
  • Default: None
  • Description: Specifies the root SharePoint site URL for the work/school integration, e.g., https://companyname.sharepoint.com.
  • Persistence: This environment variable is a ConfigVar variable.
info

This variable is essential for the work/school integration. It should point to the root SharePoint site associated with your tenant, enabling access to SharePoint document libraries.

ONEDRIVE_SHAREPOINT_TENANT_ID​

  • Type: str
  • Default: None
  • Description: Specifies the Directory (tenant) ID for the work/school integration. This is obtained from your business-focused Azure App Registration.
  • Persistence: This environment variable is a ConfigVar variable.
info

This Tenant ID (also known as Directory ID) is required for the work/school integration. You can find this value on the main overview page of your Azure App Registration in the Microsoft Entra ID portal.

Hrida.ai is proprietary software of Zlabs Innovation. See the license for terms. © 2026 Zlabs Innovation.