### Quickstart OpenRAG Setup Source: https://github.com/langflow-ai/openrag/blob/main/CONTRIBUTING.md Verify prerequisites, install dependencies, and start OpenRAG with these three commands. ```bash make check_tools make setup make dev ``` -------------------------------- ### Example User Instruction for Interactive Installation Source: https://github.com/langflow-ai/openrag/blob/main/plugins/openrag/skills/install/SKILL.md This is an example of how to instruct a user to perform the interactive installation steps in a separate terminal. ```text The next step requires running an interactive command that I cannot control directly. Please open a NEW terminal window (separate from this agent session) and run: uvx --python 3.13 openrag You will see a menu. Follow these steps: 1. Type '2' and press Enter (Reconfigure) 2. Enter a STRONG OpenSearch Admin password (write it down!) 3. Enter Langflow Admin password (or autogenerate) 4. Press 'N' or skip for other prompts 5. Type '1' and press Enter (Start services) 6. Wait for "Services are running" message Once complete, come back here and confirm: "Configuration and services started successfully" ``` -------------------------------- ### Install Dependencies and Start Dev Server Source: https://github.com/langflow-ai/openrag/blob/main/docs/docs/support/contribute.mdx Install project dependencies and start a local Docusaurus static site with hot reload. The documentation will be served at `http://localhost:3000`. ```bash npm install npm start ``` -------------------------------- ### Python SDK Quick Start Source: https://github.com/langflow-ai/openrag/blob/main/README.md A quick example demonstrating how to use the OpenRAG Python SDK to send a message and receive a response. Ensure you have the SDK installed and an asyncio event loop running. ```python import asyncio from openrag_sdk import OpenRAGClient async def main(): async with OpenRAGClient() as client: response = await client.chat.create(message="What is RAG?") print(response.response) if __name__ == "__main__": asyncio.run(main()) ``` -------------------------------- ### Install and Run OpenRAG via uvx Source: https://context7.com/langflow-ai/openrag/llms.txt Quickstart installation using uvx, which automatically handles Docker dependencies. Follow the TUI prompts to configure passwords and model providers. ```bash mkdir openrag-workspace && cd openrag-workspace uvx --python 3.13 openrag # Follow TUI prompts: set OpenSearch/Langflow passwords, choose model provider ``` -------------------------------- ### Start Podman Machine Source: https://github.com/langflow-ai/openrag/blob/main/kubernetes/operator/README.md Starts the Podman machine. Ensure Podman is installed and configured. ```bash podman machine start ``` -------------------------------- ### Manual Infrastructure Setup Source: https://github.com/langflow-ai/openrag/blob/main/frontend/tests/README.md Manually starts the services for E2E tests if not using the automated script. Ensure your root .env is configured. ```bash make dev-cpu ``` ```bash make docling ``` ```bash make health ``` -------------------------------- ### TypeScript/JavaScript SDK Quick Start Source: https://github.com/langflow-ai/openrag/blob/main/README.md A quick example demonstrating how to use the OpenRAG TypeScript/JavaScript SDK to send a message and receive a response. Ensure you have the SDK installed. ```typescript import { OpenRAGClient } from "openrag-sdk"; const client = new OpenRAGClient(); const response = await client.chat.create({ message: "What is RAG?" }); console.log(response.response); ``` -------------------------------- ### Install OpenRAG MCP with uvx Source: https://github.com/langflow-ai/openrag/blob/main/sdks/mcp/README.md Run the server using uvx for quick setup. Ensure Python 3.10+ and uv are installed. ```bash uvx openrag-mcp ``` -------------------------------- ### Setup E2E Infrastructure Script Source: https://github.com/langflow-ai/openrag/blob/main/frontend/tests/README.md Automates the setup of the full stack required for E2E tests. It starts services and waits for them to be healthy. ```bash ./scripts/setup-e2e.sh ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/langflow-ai/openrag/blob/main/docs/README.md Run this command to install all necessary project dependencies. ```bash npm install ``` -------------------------------- ### Copy Environment Example Source: https://github.com/langflow-ai/openrag/blob/main/docs/docs/get-started/docker.mdx Copy the example environment file to create a new .env file for your configuration. ```bash cp .env.example .env ``` -------------------------------- ### Install Dependencies Source: https://github.com/langflow-ai/openrag/blob/main/docs/docs/get-started/docker.mdx Install the necessary project dependencies using the uv sync command. ```bash uv sync ``` -------------------------------- ### Clone and Setup OpenRAG Project Source: https://github.com/langflow-ai/openrag/blob/main/CONTRIBUTING.md Clone the OpenRAG repository and install project dependencies. ```bash git clone https://github.com/langflow-ai/openrag.git cd openrag make setup ``` -------------------------------- ### Start Local Development Server Source: https://github.com/langflow-ai/openrag/blob/main/docs/README.md Starts a local development server for live previewing changes. Changes are reflected live without requiring a server restart. ```bash npm start ``` -------------------------------- ### Start OpenRAG Development Environment Source: https://github.com/langflow-ai/openrag/blob/main/CONTRIBUTING.md Choose between starting OpenRAG with GPU support or CPU only. ```bash make dev # With GPU support # or make dev-cpu # CPU only ``` -------------------------------- ### Onboarding Source: https://context7.com/langflow-ai/openrag/llms.txt Completes the initial OpenRAG setup by configuring models and optionally ingesting sample data. ```APIDOC ## POST /settings/onboard ### Description Configures the initial OpenRAG setup, including selecting LLM and embedding models, and optionally ingesting sample documentation. ### Method POST ### Endpoint /settings/onboard ### Request Body - **llm_provider** (string) - Required - The provider for the language model (e.g., `openai`). - **llm_model** (string) - Required - The specific language model to use (e.g., `gpt-4o-mini`). - **embedding_provider** (string) - Required - The provider for the embedding model (e.g., `openai`). - **embedding_model** (string) - Required - The specific embedding model to use (e.g., `text-embedding-3-small`). - **openai_api_key** (string) - Required if `llm_provider` is `openai` - Your OpenAI API key. ### Response Example (Success) ```json { "message": "Onboarding configuration updated successfully", "edited": true, "sample_data_ingested": true, "task_id": "task-uuid" } ``` ``` -------------------------------- ### Install Python SDK Source: https://github.com/langflow-ai/openrag/blob/main/plugins/openrag/skills/sdk/SKILL.md Install the OpenRAG Python SDK using pip or uv. ```bash pip install openrag-sdk ``` ```bash uv add openrag-sdk ``` -------------------------------- ### Install OpenRAG with uvx Source: https://github.com/langflow-ai/openrag/blob/main/docs/docs/get-started/quickstart.mdx Install OpenRAG and its dependencies using uvx, which manages environment setup and installs Docker or Podman if needed. This command specifies Python 3.13. ```bash uvx --python 3.13 openrag ``` -------------------------------- ### Install NVIDIA Container Toolkit Source: https://github.com/langflow-ai/openrag/blob/main/docs/docs/support/troubleshoot.mdx Install the NVIDIA Container Toolkit, which includes `libnvidia-container`, `nvidia-container-toolkit-base`, and `nvidia-container-toolkit`. Version 1.14 or later is recommended for full compatibility. ```bash sudo dnf5 install -y nvidia-container-toolkit ``` -------------------------------- ### Install WSL with Ubuntu Source: https://github.com/langflow-ai/openrag/blob/main/docs/docs/get-started/install-windows.mdx Installs the Windows Subsystem for Linux with the Ubuntu distribution using WSL 2. This is the default for new installations. ```powershell wsl --install -d Ubuntu ``` -------------------------------- ### Start OpenRAG Terminal Session with UVX Source: https://github.com/langflow-ai/openrag/blob/main/docs/docs/get-started/tui.mdx Use this command to start the OpenRAG terminal session when installed with uvx. ```bash uvx openrag ``` -------------------------------- ### Install OpenRAG TypeScript SDK Source: https://github.com/langflow-ai/openrag/blob/main/sdks/typescript/README.md Install the SDK using npm, yarn, or pnpm. ```bash npm install openrag-sdk # or yarn add openrag-sdk # or pnpm add openrag-sdk ``` -------------------------------- ### Start Docling Serve Source: https://github.com/langflow-ai/openrag/blob/main/docs/docs/get-started/docker.mdx Starts the Docling serve process on port 5001. This is a required system-level service and must run on the host machine, not within a Docker container. ```bash uv run python scripts/docling_ctl.py start --port 5001 ``` -------------------------------- ### Settings Management Source: https://github.com/langflow-ai/openrag/blob/main/sdks/typescript/README.md Examples for retrieving and updating SDK settings. ```APIDOC ## Settings ### Get Settings Retrieves the current SDK settings. ```typescript const settings = await client.settings.get(); console.log(`LLM Provider: ${settings.agent.llm_provider}`); console.log(`LLM Model: ${settings.agent.llm_model}`); console.log(`Embedding Model: ${settings.knowledge.embedding_model}`); ``` ### Update Settings Updates the SDK settings. Accepts an object with fields like `chunk_size` and `chunk_overlap`. ```typescript await client.settings.update({ chunk_size: 1000, chunk_overlap: 200, }); ``` ``` -------------------------------- ### Install MCP Server Package Source: https://github.com/langflow-ai/openrag/blob/main/plugins/openrag/skills/sdk/SKILL.md Install the openrag-mcp package for Model Context Protocol integration using pip or uvx. ```bash pip install openrag-mcp ``` ```bash uvx openrag-mcp ``` -------------------------------- ### Install Python Certificates on macOS Source: https://github.com/langflow-ai/openrag/blob/main/docs/docs/support/troubleshoot.mdx Run this command on macOS if OpenRAG installation fails with an 'unable to get local issuer certificate' error. ```bash open "/Applications/Python 3.13/Install Certificates.command" ``` -------------------------------- ### Configure MCP Server for Cursor/Claude Desktop Source: https://github.com/langflow-ai/openrag/blob/main/README.md Example JSON configuration for the MCP server. This setup allows AI assistants like Cursor and Claude Desktop to connect to your OpenRAG knowledge base. ```json { "mcpServers": { "openrag": { "command": "uvx", "args": ["openrag-mcp"], "env": { "OPENRAG_URL": "http://localhost:3000", "OPENRAG_API_KEY": "your_api_key_here" } } } } ``` -------------------------------- ### Install TypeScript/JavaScript SDK Source: https://github.com/langflow-ai/openrag/blob/main/plugins/openrag/skills/sdk/SKILL.md Install the OpenRAG SDK for TypeScript/JavaScript using npm, yarn, pnpm, or bun. ```bash npm install openrag-sdk ``` ```bash yarn add openrag-sdk ``` ```bash pnpm add openrag-sdk ``` ```bash bun add openrag-sdk ``` -------------------------------- ### Install OpenRAG TypeScript/JavaScript Package Source: https://github.com/langflow-ai/openrag/blob/main/README.md Install the OpenRAG SDK for TypeScript/JavaScript using npm. Refer to the documentation for detailed installation options. ```bash npm install openrag-sdk ``` -------------------------------- ### Verify Prerequisites with Make Source: https://github.com/langflow-ai/openrag/blob/main/CONTRIBUTING.md Run this command to ensure all necessary tools for OpenRAG development are installed. ```bash make check_tools ``` -------------------------------- ### OpenRAG Configuration Example Source: https://context7.com/langflow-ai/openrag/llms.txt Example environment variables for configuring OpenRAG, including model providers, OpenSearch, and Langflow settings. Ensure to set API keys and passwords appropriately. ```dotenv OPENAI_API_KEY=sk-... LLM_PROVIDER=openai LLM_MODEL=gpt-4o-mini EMBEDDING_PROVIDER=openai EMBEDDING_MODEL=text-embedding-3-small # Alternatively: Anthropic ANTHROPIC_API_KEY=sk-ant-... LLM_PROVIDER=anthropic LLM_MODEL=claude-3-5-sonnet-20241022 # Alternatively: Ollama (local) OLLAMA_ENDPOINT=http://localhost:11434 LLM_PROVIDER=ollama EMBEDDING_PROVIDER=ollama # Alternatively: IBM watsonx.ai WATSONX_API_KEY=... WATSONX_ENDPOINT=https://us-south.ml.cloud.ibm.com WATSONX_PROJECT_ID=... LLM_PROVIDER=watsonx EMBEDDING_PROVIDER=watsonx # OpenSearch (required) OPENSEARCH_PASSWORD=MyStr0ngP@ssword OPENSEARCH_INDEX_NAME=documents # default OPENSEARCH_HOST=localhost # default OPENSEARCH_PORT=9200 # default # Langflow LANGFLOW_SUPERUSER_PASSWORD=... # recommended LANGFLOW_PUBLIC_URL=http://localhost:7860 # Cloud connectors (optional) GOOGLE_OAUTH_CLIENT_ID=... GOOGLE_OAUTH_CLIENT_SECRET=... MICROSOFT_GRAPH_OAUTH_CLIENT_ID=... MICROSOFT_GRAPH_OAUTH_CLIENT_SECRET=... AWS_ACCESS_KEY_ID=... AWS_SECRET_ACCESS_KEY=... # System FRONTEND_PORT=3000 LOG_LEVEL=INFO MAX_WORKERS=4 ``` -------------------------------- ### Start OpenRAG Services Source: https://github.com/langflow-ai/openrag/blob/main/docs/docs/get-started/quickstart.mdx Confirm the prompt to start OpenRAG services. This action pulls and runs necessary container images. ```text Services are running. ``` -------------------------------- ### Install OpenRAG MCP Source: https://github.com/langflow-ai/openrag/blob/main/README.md Install the Model Context Protocol package for OpenRAG using pip. This is required to connect AI assistants to your knowledge base. ```bash pip install openrag-mcp ``` -------------------------------- ### Quick Start with OpenRAGClient Source: https://github.com/langflow-ai/openrag/blob/main/sdks/python/README.md Initialize the OpenRAGClient and perform a simple chat operation. The client automatically discovers API keys and URLs from environment variables. ```python import asyncio from openrag_sdk import OpenRAGClient async def main(): # Client auto-discovers OPENRAG_API_KEY and OPENRAG_URL from environment async with OpenRAGClient() as client: # Simple chat response = await client.chat.create(message="What is RAG?") print(response.response) print(f"Chat ID: {response.chat_id}") asyncio.run(main()) ``` -------------------------------- ### Local Development Workflow Setup Source: https://github.com/langflow-ai/openrag/blob/main/CONTRIBUTING.md Recommended for active development, this workflow runs infrastructure in Docker while backend and frontend run locally for faster iteration and debugging. ```bash # Terminal 1: Start infrastructure (OpenSearch, Langflow, Dashboards) make dev-local-cpu # Terminal 2: Run backend locally make backend # Terminal 3: Run frontend locally make frontend # Terminal 4 (optional): Start docling for document processing make docling ``` -------------------------------- ### Quick Start with OpenRAGClient Source: https://github.com/langflow-ai/openrag/blob/main/sdks/typescript/README.md Initialize the client and perform a simple chat operation. The client auto-discovers API key and URL from environment variables. ```typescript import { OpenRAGClient } from "openrag-sdk"; // Client auto-discovers OPENRAG_API_KEY and OPENRAG_URL from environment const client = new OpenRAGClient(); // Simple chat const response = await client.chat.create({ message: "What is RAG?" }); console.log(response.response); console.log(`Chat ID: ${response.chatId}`); ``` -------------------------------- ### Perform Full Factory Reset Source: https://github.com/langflow-ai/openrag/blob/main/CONTRIBUTING.md Execute a complete reset, deleting all data, containers, and volumes for a fresh start. ```bash make factory-reset ``` -------------------------------- ### Run Continuous Integration Tests Source: https://github.com/langflow-ai/openrag/blob/main/CONTRIBUTING.md Perform full CI tests by starting infrastructure, running tests, and tearing down, or build images locally. ```bash make test-ci ``` ```bash make test-ci-local ``` -------------------------------- ### Clone OpenRAG Repository Source: https://github.com/langflow-ai/openrag/blob/main/docs/docs/get-started/docker.mdx Clone the OpenRAG repository to your local machine to begin the setup process. ```bash git clone https://github.com/langflow-ai/openrag.git ``` -------------------------------- ### Manage Docling Service Source: https://github.com/langflow-ai/openrag/blob/main/CONTRIBUTING.md Start and stop the Docling service, which handles document parsing and OCR. ```bash make docling ``` ```bash make docling-stop ``` -------------------------------- ### Full Docker Stack Management Source: https://github.com/langflow-ai/openrag/blob/main/CONTRIBUTING.md Commands to start, stop, and manage the OpenRAG services using Docker. Best for testing the full system. ```bash make dev # Start with GPU support make dev-cpu # Start with CPU only make stop # Stop and remove all containers ``` -------------------------------- ### Operator Build and Deploy Commands Source: https://github.com/langflow-ai/openrag/blob/main/kubernetes/operator/README.md A sequence of make commands to download dependencies, generate manifests, compile the operator, install the CRD, and deploy the operator to the cluster. ```bash make deps # download controller-gen, kustomize, envtest into ./bin make manifests # regenerate CRD + RBAC YAML (run after editing types) make generate # regenerate DeepCopy methods (run after editing types) make build # compile bin/manager make install # install the CRD into the current cluster make deploy IMG=ghcr.io/langflow-ai/openrag-operator:latest ``` -------------------------------- ### Knowledge Filter Management Source: https://github.com/langflow-ai/openrag/blob/main/sdks/python/README.md Examples of creating, searching, getting, updating, and deleting knowledge filters using the OpenRAG SDK. ```APIDOC ## Create Knowledge Filter ### Description Creates a new knowledge filter with specified parameters. ### Method `client.knowledge_filters.create(payload)` ### Parameters #### Request Body - **name** (string) - Required - The name of the knowledge filter. - **description** (string) - Optional - A description for the knowledge filter. - **queryData** (object) - Required - Configuration for the filter query. - **query** (string) - Required - The search query string. - **filters** (object) - Optional - Additional filtering criteria. - **document_types** (array of strings) - Optional - Specifies allowed document types. - **limit** (integer) - Optional - The maximum number of results to return. - **scoreThreshold** (float) - Optional - The minimum score threshold for results. ### Request Example ```python result = await client.knowledge_filters.create({ "name": "Technical Docs", "description": "Filter for technical documentation", "queryData": { "query": "technical", "filters": { "document_types": ["application/pdf"], }, "limit": 10, "scoreThreshold": 0.5, }, }) filter_id = result.id ``` ## Search Knowledge Filters ### Description Searches for knowledge filters based on a query string. ### Method `client.knowledge_filters.search(query)` ### Parameters #### Query Parameters - **query** (string) - Required - The search term for filters. ### Request Example ```python filters = await client.knowledge_filters.search("Technical") for f in filters: print(f"{f.name}: {f.description}") ``` ## Get Knowledge Filter ### Description Retrieves a specific knowledge filter by its ID. ### Method `client.knowledge_filters.get(filter_id)` ### Parameters #### Path Parameters - **filter_id** (string) - Required - The ID of the filter to retrieve. ### Request Example ```python filter_obj = await client.knowledge_filters.get(filter_id) ``` ## Update Knowledge Filter ### Description Updates an existing knowledge filter. ### Method `client.knowledge_filters.update(filter_id, payload)` ### Parameters #### Path Parameters - **filter_id** (string) - Required - The ID of the filter to update. #### Request Body - **description** (string) - Optional - The new description for the filter. ### Request Example ```python await client.knowledge_filters.update(filter_id, { "description": "Updated description", }) ``` ## Delete Knowledge Filter ### Description Deletes a knowledge filter by its ID. ### Method `client.knowledge_filters.delete(filter_id)` ### Parameters #### Path Parameters - **filter_id** (string) - Required - The ID of the filter to delete. ### Request Example ```python await client.knowledge_filters.delete(filter_id) ``` ``` -------------------------------- ### Onboard with Model Providers Source: https://context7.com/langflow-ai/openrag/llms.txt Complete initial OpenRAG setup by selecting LLM and embedding models. This configures Langflow, initializes the OpenSearch index, and can optionally ingest sample data. ```bash # Onboard with OpenAI curl -X POST http://localhost:3000/settings/onboard \ -H "Content-Type: application/json" \ -d '{ "llm_provider": "openai", "llm_model": "gpt-4o-mini", "embedding_provider": "openai", "embedding_model": "text-embedding-3-small", "openai_api_key": "sk-..." }' ``` -------------------------------- ### Run MCP from Source Source: https://github.com/langflow-ai/openrag/blob/main/sdks/mcp/README.md Navigate to the MCP directory, synchronize dependencies, set environment variables for OpenRAG URL and API key, and then run the MCP server. ```bash cd sdks/mcp uv sync export OPENRAG_URL="http://localhost:3000" export OPENRAG_API_KEY="orag_your_api_key" uv run openrag-mcp ``` -------------------------------- ### Install OpenRAG Python Package Source: https://github.com/langflow-ai/openrag/blob/main/README.md Install the OpenRAG Python package using pip. Refer to the documentation for detailed installation options. ```bash pip install openrag-sdk ``` -------------------------------- ### Build Documentation PDF Source: https://github.com/langflow-ai/openrag/blob/main/docs/README.md Builds the website and generates a PDF documentation file. This command should be run from the 'openrag/docs' directory. ```bash npm run build:pdf ``` -------------------------------- ### Access Backend API Documentation Source: https://github.com/langflow-ai/openrag/blob/main/CONTRIBUTING.md When running the backend locally with `make backend`, access the interactive API documentation at this URL. ```bash make backend ``` -------------------------------- ### Initialize a new uv Python project Source: https://github.com/langflow-ai/openrag/blob/main/docs/docs/get-started/install-uv.mdx Create a new Python project managed by uv, specifying the minimum required Python version. Omit the --python flag if your default Python version meets the requirement. ```bash uv init PROJECT_NAME --python 3.13 ``` -------------------------------- ### Build and Serve Docusaurus Site Source: https://github.com/langflow-ai/openrag/blob/main/docs/VERSIONING_SETUP.md Run these commands to build the Docusaurus site and serve it locally for testing after configuration changes. ```bash npm run build npm run serve ``` -------------------------------- ### Install OpenRAG Plugin Globally Source: https://github.com/langflow-ai/openrag/blob/main/AGENTS.md Use these commands to install the OpenRAG plugin globally for Claude Code. This makes the OpenRAG skills available for use. ```bash /plugin marketplace add langflow-ai/openrag /plugin install openrag@openrag ``` -------------------------------- ### Access Makefile Help System Source: https://github.com/langflow-ai/openrag/blob/main/CONTRIBUTING.md Display help information for various command categories within the Makefile. ```bash make help ``` ```bash make help_dev ``` ```bash make help_docker ``` ```bash make help_test ``` ```bash make help_local ``` ```bash make help_utils ``` -------------------------------- ### Start OpenRAG GUI Terminal Session Source: https://github.com/langflow-ai/openrag/blob/main/docs/docs/get-started/tui.mdx Start the OpenRAG terminal with the --tui flag for a GUI terminal experience, which includes mouse navigation and button-like controls. ```bash uv run openrag --tui ``` -------------------------------- ### Initialize OAuth Flow and Handle Callback Source: https://context7.com/langflow-ai/openrag/llms.txt Initiate OAuth flows for connecting data sources and handle the callback to complete the authentication process. The /auth/me endpoint retrieves user information. ```bash # Start an OAuth flow for Google Drive data source curl -X POST http://localhost:3000/auth/init \ -H "Content-Type: application/json" \ -d '{ "connector_type": "google_drive", "purpose": "data_source", "name": "My Google Drive", "redirect_uri": "http://localhost:3000/auth/callback" }' ``` ```bash # Handle OAuth callback curl -X POST http://localhost:3000/auth/callback \ -H "Content-Type: application/json" \ -d '{ "connection_id": "conn-uuid", "authorization_code": "4/0AX4XfWj...", "state": "..." }' ``` ```bash # Get current user info curl http://localhost:3000/auth/me ``` ```bash # Logout curl -X POST http://localhost:3000/auth/logout ``` -------------------------------- ### Remove Old NVIDIA Container Toolkit Packages Source: https://github.com/langflow-ai/openrag/blob/main/docs/docs/support/troubleshoot.mdx Before installing the new NVIDIA Container Toolkit, remove any existing packages to avoid conflicts. This command does not affect your NVIDIA driver installation. ```bash sudo dnf5 remove -y nvidia-container-toolkit nvidia-container-toolkit-base libnvidia-container* ``` -------------------------------- ### Podman Setup for macOS Source: https://github.com/langflow-ai/openrag/blob/main/CONTRIBUTING.md Configure Podman machine with sufficient memory for OpenRAG on macOS. Stop and remove any existing machine before creating a new one with 8GB RAM and 4 CPUs. ```bash # Stop and remove existing machine (if any) podman machine stop podman machine rm # Create new machine with 8GB RAM and 4 CPUs podman machine init --memory 8192 --cpus 4 podman machine start ``` -------------------------------- ### Settings - Get Source: https://github.com/langflow-ai/openrag/blob/main/sdks/python/README.md Retrieves the current OpenRAG system settings. ```APIDOC ## Settings - Get ### Description Retrieves the current OpenRAG system settings. ### Method `client.settings.get()` ### Response Example ```json { "agent": { "llm_provider": "openai", "llm_model": "gpt-4" }, "knowledge": { "embedding_model": "text-embedding-ada-002" }, "chunk_size": 500, "chunk_overlap": 100 } ``` ``` -------------------------------- ### Chat and Search with Filters Source: https://github.com/langflow-ai/openrag/blob/main/sdks/python/README.md Examples of using knowledge filters in chat and search operations. ```APIDOC ## Use Filter in Chat ### Description Initiates a chat conversation using a specified knowledge filter. ### Method `client.chat.create(message, filter_id)` ### Parameters #### Request Body - **message** (string) - Required - The user's message. - **filter_id** (string) - Required - The ID of the knowledge filter to apply. ### Request Example ```python response = await client.chat.create( message="Explain the API", filter_id=filter_id, ) ``` ## Use Filter in Search ### Description Performs a search query using a specified knowledge filter. ### Method `client.search.query(query, filter_id)` ### Parameters #### Request Body - **query** (string) - Required - The search query. - **filter_id** (string) - Required - The ID of the knowledge filter to apply. ### Request Example ```python results = await client.search.query("API endpoints", filter_id=filter_id) ``` ``` -------------------------------- ### Create Subsequent Docs Version Source: https://github.com/langflow-ai/openrag/blob/main/docs/VERSIONING_SETUP.md Repeat the CLI command to create additional versions (e.g., 2.0.0) from the current documentation. ```bash # Create version 2.0.0 from current docs npm run docusaurus docs:version 2.0.0 ``` -------------------------------- ### Chat - Get Conversation Source: https://github.com/langflow-ai/openrag/blob/main/sdks/python/README.md Retrieves a specific chat conversation, including its messages, by its chat_id. ```APIDOC ## Chat - Get Conversation ### Description Retrieves a specific chat conversation, including its messages, by its chat_id. ### Method `client.chat.get(chat_id: str)` ### Parameters - **chat_id** (str) - Required - The ID of the conversation to retrieve. ### Response Example ```json { "chat_id": "conversation_id_123", "title": "Conversation Title", "messages": [ { "role": "user", "content": "User message content" }, { "role": "assistant", "content": "Assistant response content" } ] } ``` ``` -------------------------------- ### Navigate to Docs Directory Source: https://github.com/langflow-ai/openrag/blob/main/docs/docs/support/contribute.mdx Change to the `/docs` directory in your local OpenRAG repository. If using a development container, run documentation builds from your host terminal. ```bash cd openrag/docs ``` -------------------------------- ### Manage Settings with OpenRAG Python SDK Source: https://github.com/langflow-ai/openrag/blob/main/plugins/openrag/skills/sdk/SKILL.md Demonstrates retrieving current system settings and updating them, including LLM and embedding provider/model configurations, using the Python SDK. Ensure you have the necessary permissions to update settings. ```python async def manage_settings(): async with OpenRAGClient() as client: # Get settings settings = await client.settings.get() print(f"LLM Provider: {settings.agent.llm_provider}") print(f"LLM Model: {settings.agent.llm_model}") print(f"Embedding Model: {settings.knowledge.embedding_model}") # Update settings await client.settings.update({ "llm_provider": "openai", "llm_model": "gpt-4o", "embedding_provider": "openai", "embedding_model": "text-embedding-3-small" }) asyncio.run(manage_settings()) ``` -------------------------------- ### Deploy Website Using SSH Source: https://github.com/langflow-ai/openrag/blob/main/docs/README.md Deploys the website using SSH. Ensure SSH is configured for your deployment environment. ```bash USE_SSH=true npm run deploy ``` -------------------------------- ### Get current user info Source: https://context7.com/langflow-ai/openrag/llms.txt Retrieves information about the currently authenticated user and the OpenRAG version. ```APIDOC ## GET /auth/me ### Description Returns details about the current user, including their ID, name, email, and the OpenRAG version. ### Method GET ### Endpoint /auth/me ### Response Example (Success) ```json { "user_id": "user123", "name": "Jane Doe", "email": "jane@example.com", "version": "0.3.2" } ``` ``` -------------------------------- ### Verify OpenRAG Container Status Source: https://github.com/langflow-ai/openrag/blob/main/plugins/openrag/skills/install/SKILL.md After installation, check if the OpenRAG container is running using this Docker command. ```bash docker ps --filter "name=openrag" ``` -------------------------------- ### Run Backend and Integration Tests Source: https://github.com/langflow-ai/openrag/blob/main/CONTRIBUTING.md Execute backend tests, integration tests, or SDK tests. Linting checks are also available. ```bash make test ``` ```bash make test-integration ``` ```bash make test-sdk ``` ```bash make lint ``` -------------------------------- ### TypeScript/JavaScript SDK Usage Source: https://context7.com/langflow-ai/openrag/llms.txt Examples of using the OpenRAG SDK in TypeScript/JavaScript for chat, search, and document ingestion. ```APIDOC ## TypeScript/JavaScript SDK ### Description This section demonstrates how to use the `openrag-sdk` in TypeScript/JavaScript for various OpenRAG functionalities. ### Methods - `client.chat.create({ message: string, chatId?: string })`: For sending messages and managing chat conversations. - `client.search.query({ query: string, limit?: number, scoreThreshold?: number })`: To perform semantic searches. - `client.documents.ingest({ file: ReadableStream, filename: string })`: To upload and ingest documents. - `client.tasks.get(taskId: string)`: To check the status of ingestion tasks. ### Example Usage ```typescript import { OpenRAGClient } from "openrag-sdk"; const client = new OpenRAGClient({ baseUrl: "http://localhost:3000", apiKey: process.env.OPENRAG_API_KEY, }); // Chat const response = await client.chat.create({ message: "Summarize the onboarding docs" }); console.log(response.response); // Multi-turn const followup = await client.chat.create({ message: "Which step is most important?", chatId: response.chatId, }); console.log(followup.response); // Semantic search const searchResults = await client.search.query({ query: "data retention policy", limit: 5, scoreThreshold: 0.5, }); for (const r of searchResults.results) { console.log(`[${r.score}] ${r.filename}: ${r.text.slice(0, 80)}`); } // Ingest a document (Node.js) import fs from "fs"; const fileStream = fs.createReadStream("/path/to/document.pdf"); const task = await client.documents.ingest({ file: fileStream, filename: "document.pdf" }); // Poll task let taskStatus = await client.tasks.get(task.taskId); while (!["completed", "failed"].includes(taskStatus.status)) { await new Promise((r) => setTimeout(r, 2000)); taskStatus = await client.tasks.get(task.taskId); } console.log("Final status:", taskStatus.status); ``` ```