OpenRAG Documentation

repository·main·Indexed 26 days ago

https://github.com/langflow-ai/openrag

OpenRAG is a Retrieval-Augmented Generation (RAG) platform for intelligent document search and AI-powered conversations, utilizing Langflow for orchestration, OpenSearch for enterprise search, and Docling for document parsing. It provides Python and TypeScript/JavaScript SDKs, a built-in Model Context Protocol (MCP) server, and a Kubernetes operator for deployment via Helm or kubectl. Version 0.5.0.

Tokens
57.1K
Snippets
116
Records
306
Agent score
88%

What's inside OpenRAG

  1. Overview of OpenRAG

    main

    OpenRAG is an open-source platform designed for building agentic Retrieval-Augmented Generation (RAG) systems. It integrates orchestration tools, databases, and LLM providers into a single platform.

    OpenRAG is built by combining three core technologies:

    • Langflow: Used for building and deploying AI agents and MCP servers. OpenRAG provides full access to Langflow features via an embedded visual editor, allowing you to customize flows, change language models, or replace components.
    • OpenSearch: Serves as the underlying database for storing documents and vector embeddings, providing hybrid search capabilities.
    • Docling: Handles document parsing and chunking for documents stored in the OpenSearch knowledge base.
  2. Understand the OpenRAG Environment Variable Override System

    main

    The OpenRAG operator uses a three-level priority system to manage environment variables for Langflow, Backend, and Frontend components. When multiple values are defined for the same variable, the system resolves them based on the following priority (highest to lowest):

    1. CR Spec Env Vars (Highest): Defined directly in the OpenRAG Custom Resource spec.
    2. Operator Environment (Medium): Set in the operator's own deployment using component-specific prefixes.
    3. Hardcoded Defaults (Lowest): Built-in defaults within the operator code.

    This hierarchy allows you to set organization-wide defaults via the operator deployment while still allowing individual OpenRAG instances to have unique configurations via their CR spec.

  3. Understand the OpenRAG OpenSearch Agent flow

    main

    The OpenRAG Chat feature uses the OpenRAG OpenSearch Agent flow to process queries. This flow consists of eight interconnected components that manage message ingestion, knowledge retrieval, and response generation. You can inspect and modify this flow in Langflow to customize agent behavior.

    Core Components:

    • Chat Input: Receives chat messages and passes them to the Agent.
    • Agent: The central orchestrator. It uses Agent Instructions (prompt) and a connected Language Model to make decisions and call tools.
    • Language Model: Provides the reasoning engine. Changing this model can affect response style and reasoning depth.
    • MCP Tools: Allows the agent to access Model Context Protocol (MCP) servers. For example, it can use the OpenSearch URL Ingestion flow to fetch and store content from URLs provided in chat.
    • OpenSearch: A tool that allows the agent to search your OpenRAG knowledge base.
    • Embedding Model: Generates embeddings from chat input for similarity search. Critical: This model must match the embedding model used during document ingestion to ensure retrieval quality.
    • Text Input: Uses the OPENRAG-QUERY-FILTER global variable to apply knowledge filters to the search.
    • Chat Output: Returns the final generated response to the user.
  4. Understand OpenRAG Architecture

    main

    OpenRAG uses a lightweight, container-based architecture to orchestrate its components. The architecture consists of:

    • OpenRAG backend: The central orchestration service that coordinates all other components.
    • Langflow container: Runs a Langflow instance providing the visual editor for flow creation and connects to OpenSearch for data retrieval.
    • Docling Serve: A local document processing service managed by the OpenRAG backend.
    • OpenSearch container: Used for document and vector data storage.
    • OpenRAG frontend: The user interface for interacting with the platform.
    • External connectors: OAuth-authorized connectors that allow the backend to load documents from third-party cloud storage services into the OpenSearch knowledge base.
  5. Understand the OpenSearch Ingestion flow

    main

    The OpenSearch Ingestion flow runs in the background when you upload documents locally or via cloud storage connectors. It is responsible for processing documents and storing them in your knowledge base.

    By default, the flow uses Docling Serve to import and process documents. You can inspect and customize this flow in Langflow to change knowledge ingestion settings.

  6. Configure cloud storage connectors in OpenRAG

    main

    OpenRAG supports cloud storage connectors for AWS S3, Google Drive, Microsoft OneDrive, and Microsoft Sharepoint. To use these, you must register an OAuth application with your cloud provider to obtain a client ID and secret key, then add these credentials to your OpenRAG configuration.

    Supported Services:

    • AWS S3
    • Google Drive
    • Microsoft OneDrive
    • Microsoft Sharepoint

    Note on Google OAuth: Providing Google OAuth credentials also enables OAuth mode for OpenRAG and your OpenSearch knowledge base.

  7. Install OpenRAG using uvx

    main

    You can install OpenRAG and its dependencies (including Docker or Podman) using uvx. This method automatically manages the environment and dependencies.

    1. Create and enter a workspace directory:
      mkdir openrag-workspace
      cd openrag-workspace
    2. Run the installation command:
      uvx --python 3.13 openrag
    3. Follow the terminal prompts:
      • Provide or autogenerate passwords for OpenSearch and Langflow Admin.
      • For most other configuration prompts, press N to use default values.
      • When asked Start services now?, press Y.
    4. Once services are running, if the app doesn't open automatically, select Open OpenRAG in browser in the terminal.
    5. During onboarding, select OpenAI as the model provider and enter your OpenAI API key.
    mkdir openrag-workspace
    cd openrag-workspace
    uvx --python 3.13 openrag
  8. Inspect and modify OpenRAG flows using Langflow

    main

    OpenRAG includes a built-in Langflow instance to manage functional application workflows called flows. You can view and modify these flows using the embedded Langflow visual editor.

    Accessing the Editor

    1. Click Settings in the OpenRAG interface to manage cloud storage connectors, model providers, and common parameters for the Agent and Knowledge Ingestion flows.
    2. Click Edit in Langflow to launch the visual editor.
    3. To edit any flow, you must first unlock the flow within the Langflow editor.

    Best Practices

    • Built-in Flows: OpenRAG includes the OpenRAG OpenSearch Agent flow (powers Chat), OpenSearch Ingestion flows (processes documents), and OpenRAG OpenSearch Nudges flow (contextual suggestions).
    • Backups: If you are editing flows other than the Agent or Knowledge Ingestion flows, it is highly recommended to export the flows before editing so you can revert them if necessary.
  9. Create and submit documentation Pull Requests

    main

    When contributing documentation, follow these requirements:

    1. File Location: Work with .mdx files in openrag/docs/docs. Navigation is managed in openrag/docs/sidebars.js.
    2. Linking: Use slug for cross-referencing. For a page with slug: /cool-page, link using [Cool page](/cool-page).
    3. Validation: Run npm run build locally to check for broken links before submitting.
    4. PR Format:
      • Title: Use the format Docs: <summary of change> (e.g., Docs: fix broken link on contributing page).
      • Description: Explain why and how changes were made. Use Closes #NUMBER if the PR resolves an issue.
      • Labels: Add the documentation label to your PR.
    5. AI Disclosure: If significant portions of the documentation were generated by AI, disclose this in the PR description.
  10. Deploy OpenRAG with Docker or Podman

    main

    Use Docker or Podman to manage self-hosted OpenRAG services when terminal interaction is unavailable or when you prefer not to use the OpenRAG TUI. This method deploys the Backend, Frontend, Langflow, OpenSearch, and OpenSearch Dashboards as containers. Note that docling serve must be run as a separate native service on the host machine and cannot run inside a container.

    Prerequisites

    Ensure you have the following installed and configured:

    • Windows (if applicable)
    • Python
    • uv
    • Docker or Podman
    • Model providers (e.g., OpenAI, Anthropic, Ollama, or Watsonx)
    • GPU (optional, for acceleration)