[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"similar-Bessouat40--RAGLight":3,"tool-Bessouat40--RAGLight":61},[4,18,26,36,44,53],{"id":5,"name":6,"github_repo":7,"description_zh":8,"stars":9,"difficulty_score":10,"last_commit_at":11,"category_tags":12,"status":17},4358,"openclaw","openclaw\u002Fopenclaw","OpenClaw 是一款专为个人打造的本地化 AI 助手，旨在让你在自己的设备上拥有完全可控的智能伙伴。它打破了传统 AI 助手局限于特定网页或应用的束缚，能够直接接入你日常使用的各类通讯渠道，包括微信、WhatsApp、Telegram、Discord、iMessage 等数十种平台。无论你在哪个聊天软件中发送消息，OpenClaw 都能即时响应，甚至支持在 macOS、iOS 和 Android 设备上进行语音交互，并提供实时的画布渲染功能供你操控。\n\n这款工具主要解决了用户对数据隐私、响应速度以及“始终在线”体验的需求。通过将 AI 部署在本地，用户无需依赖云端服务即可享受快速、私密的智能辅助，真正实现了“你的数据，你做主”。其独特的技术亮点在于强大的网关架构，将控制平面与核心助手分离，确保跨平台通信的流畅性与扩展性。\n\nOpenClaw 非常适合希望构建个性化工作流的技术爱好者、开发者，以及注重隐私保护且不愿被单一生态绑定的普通用户。只要具备基础的终端操作能力（支持 macOS、Linux 及 Windows WSL2），即可通过简单的命令行引导完成部署。如果你渴望拥有一个懂你",349277,3,"2026-04-06T06:32:30",[13,14,15,16],"Agent","开发框架","图像","数据工具","ready",{"id":19,"name":20,"github_repo":21,"description_zh":22,"stars":23,"difficulty_score":10,"last_commit_at":24,"category_tags":25,"status":17},3808,"stable-diffusion-webui","AUTOMATIC1111\u002Fstable-diffusion-webui","stable-diffusion-webui 是一个基于 Gradio 构建的网页版操作界面，旨在让用户能够轻松地在本地运行和使用强大的 Stable Diffusion 图像生成模型。它解决了原始模型依赖命令行、操作门槛高且功能分散的痛点，将复杂的 AI 绘图流程整合进一个直观易用的图形化平台。\n\n无论是希望快速上手的普通创作者、需要精细控制画面细节的设计师，还是想要深入探索模型潜力的开发者与研究人员，都能从中获益。其核心亮点在于极高的功能丰富度：不仅支持文生图、图生图、局部重绘（Inpainting）和外绘（Outpainting）等基础模式，还独创了注意力机制调整、提示词矩阵、负向提示词以及“高清修复”等高级功能。此外，它内置了 GFPGAN 和 CodeFormer 等人脸修复工具，支持多种神经网络放大算法，并允许用户通过插件系统无限扩展能力。即使是显存有限的设备，stable-diffusion-webui 也提供了相应的优化选项，让高质量的 AI 艺术创作变得触手可及。",162132,"2026-04-05T11:01:52",[14,15,13],{"id":27,"name":28,"github_repo":29,"description_zh":30,"stars":31,"difficulty_score":32,"last_commit_at":33,"category_tags":34,"status":17},1381,"everything-claude-code","affaan-m\u002Feverything-claude-code","everything-claude-code 是一套专为 AI 编程助手（如 Claude Code、Codex、Cursor 等）打造的高性能优化系统。它不仅仅是一组配置文件，而是一个经过长期实战打磨的完整框架，旨在解决 AI 代理在实际开发中面临的效率低下、记忆丢失、安全隐患及缺乏持续学习能力等核心痛点。\n\n通过引入技能模块化、直觉增强、记忆持久化机制以及内置的安全扫描功能，everything-claude-code 能显著提升 AI 在复杂任务中的表现，帮助开发者构建更稳定、更智能的生产级 AI 代理。其独特的“研究优先”开发理念和针对 Token 消耗的优化策略，使得模型响应更快、成本更低，同时有效防御潜在的攻击向量。\n\n这套工具特别适合软件开发者、AI 研究人员以及希望深度定制 AI 工作流的技术团队使用。无论您是在构建大型代码库，还是需要 AI 协助进行安全审计与自动化测试，everything-claude-code 都能提供强大的底层支持。作为一个曾荣获 Anthropic 黑客大奖的开源项目，它融合了多语言支持与丰富的实战钩子（hooks），让 AI 真正成长为懂上",146793,2,"2026-04-08T23:32:35",[14,13,35],"语言模型",{"id":37,"name":38,"github_repo":39,"description_zh":40,"stars":41,"difficulty_score":32,"last_commit_at":42,"category_tags":43,"status":17},2271,"ComfyUI","Comfy-Org\u002FComfyUI","ComfyUI 是一款功能强大且高度模块化的视觉 AI 引擎，专为设计和执行复杂的 Stable Diffusion 图像生成流程而打造。它摒弃了传统的代码编写模式，采用直观的节点式流程图界面，让用户通过连接不同的功能模块即可构建个性化的生成管线。\n\n这一设计巧妙解决了高级 AI 绘图工作流配置复杂、灵活性不足的痛点。用户无需具备编程背景，也能自由组合模型、调整参数并实时预览效果，轻松实现从基础文生图到多步骤高清修复等各类复杂任务。ComfyUI 拥有极佳的兼容性，不仅支持 Windows、macOS 和 Linux 全平台，还广泛适配 NVIDIA、AMD、Intel 及苹果 Silicon 等多种硬件架构，并率先支持 SDXL、Flux、SD3 等前沿模型。\n\n无论是希望深入探索算法潜力的研究人员和开发者，还是追求极致创作自由度的设计师与资深 AI 绘画爱好者，ComfyUI 都能提供强大的支持。其独特的模块化架构允许社区不断扩展新功能，使其成为当前最灵活、生态最丰富的开源扩散模型工具之一，帮助用户将创意高效转化为现实。",108111,"2026-04-08T11:23:26",[14,15,13],{"id":45,"name":46,"github_repo":47,"description_zh":48,"stars":49,"difficulty_score":32,"last_commit_at":50,"category_tags":51,"status":17},4721,"markitdown","microsoft\u002Fmarkitdown","MarkItDown 是一款由微软 AutoGen 团队打造的轻量级 Python 工具，专为将各类文件高效转换为 Markdown 格式而设计。它支持 PDF、Word、Excel、PPT、图片（含 OCR）、音频（含语音转录）、HTML 乃至 YouTube 链接等多种格式的解析，能够精准提取文档中的标题、列表、表格和链接等关键结构信息。\n\n在人工智能应用日益普及的今天，大语言模型（LLM）虽擅长处理文本，却难以直接读取复杂的二进制办公文档。MarkItDown 恰好解决了这一痛点，它将非结构化或半结构化的文件转化为模型“原生理解”且 Token 效率极高的 Markdown 格式，成为连接本地文件与 AI 分析 pipeline 的理想桥梁。此外，它还提供了 MCP（模型上下文协议）服务器，可无缝集成到 Claude Desktop 等 LLM 应用中。\n\n这款工具特别适合开发者、数据科学家及 AI 研究人员使用，尤其是那些需要构建文档检索增强生成（RAG）系统、进行批量文本分析或希望让 AI 助手直接“阅读”本地文件的用户。虽然生成的内容也具备一定可读性，但其核心优势在于为机器",93400,"2026-04-06T19:52:38",[52,14],"插件",{"id":54,"name":55,"github_repo":56,"description_zh":57,"stars":58,"difficulty_score":10,"last_commit_at":59,"category_tags":60,"status":17},4487,"LLMs-from-scratch","rasbt\u002FLLMs-from-scratch","LLMs-from-scratch 是一个基于 PyTorch 的开源教育项目，旨在引导用户从零开始一步步构建一个类似 ChatGPT 的大型语言模型（LLM）。它不仅是同名技术著作的官方代码库，更提供了一套完整的实践方案，涵盖模型开发、预训练及微调的全过程。\n\n该项目主要解决了大模型领域“黑盒化”的学习痛点。许多开发者虽能调用现成模型，却难以深入理解其内部架构与训练机制。通过亲手编写每一行核心代码，用户能够透彻掌握 Transformer 架构、注意力机制等关键原理，从而真正理解大模型是如何“思考”的。此外，项目还包含了加载大型预训练权重进行微调的代码，帮助用户将理论知识延伸至实际应用。\n\nLLMs-from-scratch 特别适合希望深入底层原理的 AI 开发者、研究人员以及计算机专业的学生。对于不满足于仅使用 API，而是渴望探究模型构建细节的技术人员而言，这是极佳的学习资源。其独特的技术亮点在于“循序渐进”的教学设计：将复杂的系统工程拆解为清晰的步骤，配合详细的图表与示例，让构建一个虽小但功能完备的大模型变得触手可及。无论你是想夯实理论基础，还是为未来研发更大规模的模型做准备",90106,"2026-04-06T11:19:32",[35,15,13,14],{"id":62,"github_repo":63,"name":64,"description_en":65,"description_zh":66,"ai_summary_zh":66,"readme_en":67,"readme_zh":68,"quickstart_zh":69,"use_case_zh":70,"hero_image_url":71,"owner_login":72,"owner_name":73,"owner_avatar_url":74,"owner_bio":75,"owner_company":73,"owner_location":76,"owner_email":73,"owner_twitter":73,"owner_website":77,"owner_url":78,"languages":79,"stars":88,"forks":89,"last_commit_at":90,"license":91,"difficulty_score":32,"env_os":92,"env_gpu":93,"env_ram":94,"env_deps":95,"category_tags":103,"github_topics":105,"view_count":32,"oss_zip_url":73,"oss_zip_packed_at":73,"status":17,"created_at":125,"updated_at":126,"faqs":127,"releases":128},5799,"Bessouat40\u002FRAGLight","RAGLight","RAGLight is a modular framework for Retrieval-Augmented Generation (RAG). It makes it easy to plug in different LLMs, embeddings, and vector stores, and now includes seamless MCP integration to connect external tools and data sources.","RAGLight 是一款轻量级且模块化的 Python 库，专为构建检索增强生成（RAG）应用而设计。它通过将文档检索与自然语言推理相结合，有效解决了大语言模型在处理私有数据时容易产生的“幻觉”及知识滞后问题，让 AI 回答更精准、更有依据。\n\n这款工具特别适合开发者和技术研究人员使用，帮助他们快速搭建上下文感知的智能问答系统或知识库应用。RAGLight 的核心优势在于其极高的灵活性与兼容性：用户无需绑定特定厂商，即可自由切换 Ollama、OpenAI、Gemini、AWS Bedrock 等多种大模型，并随意组合不同的嵌入模型与向量数据库。\n\n除了基础的 RAG 流程，RAGLight 还具备多项独特亮点。它支持混合搜索（结合关键词 BM25 与语义向量搜索），显著提升了检索准确率；内置“代理式 RAG\"能力，可自主优化查询策略；更率先集成了 MCP（模型上下文协议），能无缝连接外部工具与数据源，扩展 AI 的行动边界。无论是通过命令行即时对话，还是部署为 REST API 服务，RAGLight 都提供了简洁高效的实现路径，是打造定制化 AI 解决方案的理想选择。","# RAGLight\n\n![License](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002FBessouat40\u002FRAGLight)\n[![Downloads](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FBessouat40_RAGLight_readme_638ed81512e6.png)](https:\u002F\u002Fpepy.tech\u002Fprojects\u002Fraglight)\n[![Run Test](https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\u002Factions\u002Fworkflows\u002Ftest.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\u002Factions\u002Fworkflows\u002Ftest.yml)\n\n\u003Cdiv align=\"center\">\n    \u003Cimg alt=\"RAGLight\" height=\"200px\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FBessouat40_RAGLight_readme_d4032dc61b0f.png\">\n\u003C\u002Fdiv>\n\n**RAGLight** is a lightweight and modular Python library for implementing **Retrieval-Augmented Generation (RAG)**. It enhances the capabilities of Large Language Models (LLMs) by combining document retrieval with natural language inference.\n\nDesigned for simplicity and flexibility, RAGLight provides modular components to easily integrate various LLMs, embeddings, and vector stores, making it an ideal tool for building context-aware AI solutions.\n\n---\n\n## 📚 Table of Contents\n\n- [Requirements](#⚠️-requirements)\n\n- [Features](#features)\n\n- [Import library](#import-library-🛠️)\n\n- [Chat with Your Documents Instantly With CLI](#chat-with-your-documents-instantly-with-cli-💬)\n  - [Ignore Folders Feature](#ignore-folders-feature-🚫)\n  - [Ignore Folders in Configuration Classes](#ignore-folders-in-configuration-classes-🚫)\n\n- [Deploy as a REST API (raglight serve)](#deploy-as-a-rest-api-raglight-serve-🌐)\n  - [Start the server](#start-the-server)\n  - [Launch the Chat UI](#launch-the-chat-ui-💬)\n  - [Endpoints](#endpoints)\n  - [Configuration via environment variables](#configuration-via-environment-variables)\n  - [Deploy with Docker Compose](#deploy-with-docker-compose)\n\n- [Environment Variables](#environment-variables)\n\n- [Providers and Databases](#providers-and-databases)\n  - [LLM](#llm)\n  - [Embeddings](#embeddings)\n  - [Vector Store](#vector-store)\n\n- [Quick Start](#quick-start-🚀)\n  - [Knowledge Base](#knowledge-base)\n  - [RAG](#rag)\n  - [Agentic RAG](#agentic-rag)\n  - [MCP Integration](#mcp-integration)\n  - [Use Custom Pipeline](#use-custom-pipeline)\n  - [Override Default Processors](#override-default-processors)\n  - [Hybrid Search](#hybrid-search-bm25--semantic--rrf-)\n  - [Qdrant Vector Store](#qdrant-vector-store-️)\n  - [Query Reformulation](#query-reformulation-✍️)\n  - [Streaming Output](#streaming-output-⚡)\n  - [Conversation History](#conversation-history-💬)\n  - [AWS Bedrock](#aws-bedrock-☁️)\n  - [Observability with Langfuse](#observability-with-langfuse)\n\n- [Use RAGLight with Docker](#use-raglight-with-docker)\n  - [Build your image](#build-your-image)\n  - [Run your image](#run-your-image)\n\n---\n\n> ## ⚠️ Requirements\n>\n> Actually RAGLight supports :\n>\n> - Ollama\n> - Google Gemini\n> - LMStudio\n> - vLLM\n> - OpenAI API\n> - Mistral API\n> - AWS Bedrock\n>\n> If you use LMStudio, you need to have the model you want to use loaded in LMStudio.\n> If you use AWS Bedrock, configure your AWS credentials (env vars, `~\u002F.aws\u002Fcredentials`, or IAM role) — no extra install needed.\n\n## Features\n\n- **Embeddings Model Integration**: Plug in your preferred embedding models (e.g., HuggingFace **all-MiniLM-L6-v2**) for compact and efficient vector embeddings.\n- **LLM Agnostic**: Seamlessly integrates with different LLMs from different providers (Ollama, LMStudio, Mistral, OpenAI, Google Gemini, AWS Bedrock).\n- **RAG Pipeline**: Combines document retrieval and language generation in a unified workflow.\n- **Agentic RAG Pipeline**: Use Agent to improve your RAG performances.\n- 🔌 **MCP Integration**: Add external tool capabilities (e.g. code execution, database access) via MCP servers.\n- **Flexible Document Support**: Ingest and index various document types (e.g., PDF, TXT, DOCX, Python, Javascript, ...).\n- **Extensible Architecture**: Easily swap vector stores, embedding models, or LLMs to suit your needs.\n- 🔍 **Hybrid Search (BM25 + Semantic + RRF)**: Combine keyword-based BM25 retrieval with dense vector search using Reciprocal Rank Fusion for best-of-both-worlds results.\n- ✍️ **Query Reformulation**: Automatically rewrites follow-up questions into standalone queries using conversation history, improving retrieval accuracy in multi-turn conversations.\n- 💬 **Conversation History**: Full multi-turn history supported across all providers (Ollama, OpenAI, Mistral, LMStudio, Gemini, Bedrock) with optional `max_history` cap.\n- ⚡ **Streaming Output**: Token-by-token streaming via `generate_streaming()` on all providers — drop-in alongside `generate()` with no extra configuration.\n- ☁️ **AWS Bedrock**: Use Claude, Titan, Llama and other Bedrock models for both LLM inference and embeddings.\n- 📊 **Langfuse Observability (v3+)**: Trace every RAG call end-to-end — retrieve, rerank, and generate — directly in your Langfuse dashboard.\n\n---\n\n## Import library 🛠️\n\nInstall the base library:\n\n```bash\npip install raglight\n```\n\nRAGLight uses **optional extras** for vector store backends, so you only install what you need:\n\n| Extra                | Package installed | Notes                                                 |\n| -------------------- | ----------------- | ----------------------------------------------------- |\n| `raglight[chroma]`   | `chromadb`        | Requires a C++ compiler on Windows                    |\n| `raglight[qdrant]`   | `qdrant-client`   | Pure Python — works on Windows without a C++ compiler |\n| `raglight[langfuse]` | `langfuse`        | Observability tracing                                 |\n\n```bash\npip install \"raglight[qdrant]\"           # Qdrant only (Windows-friendly)\npip install \"raglight[chroma]\"           # ChromaDB only\npip install \"raglight[chroma,qdrant]\"    # both\npip install \"raglight[qdrant,langfuse]\"  # Qdrant + observability\n```\n\n---\n\n## Chat with Your Documents Instantly With CLI 💬\n\nFor the quickest and easiest way to get started, RAGLight provides an interactive command-line wizard. It will guide you through every step, from selecting your documents to chatting with them, without writing a single line of Python.\nPrerequisite: Ensure you have a local LLM service like Ollama running.\n\nJust run this one command in your terminal:\n\n```bash\nraglight chat\n```\n\nYou can also launch the Agentic RAG wizard with:\n\n```bash\nraglight agentic-chat\n```\n\nThe wizard will guide you through the setup process. Here is what it looks like:\n\n\u003Cdiv align=\"center\">\n    \u003Cimg alt=\"RAGLight\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FBessouat40_RAGLight_readme_b05550b22284.png\">\n\u003C\u002Fdiv>\n\nThe wizard will ask you for:\n\n- 📂 Data Source: The path to your local folder containing the documents.\n- 🚫 Ignore Folders: Configure which folders to exclude during indexing (e.g., `.venv`, `node_modules`, `__pycache__`).\n- 💾 Vector Database: Where to store the indexed data and what to name it.\n- 🧠 Embeddings Model: Which model to use for understanding your documents.\n- 🤖 Language Model (LLM): Which LLM to use for generating answers.\n\nAfter configuration, it will automatically index your documents and start a chat session.\n\n### Ignore Folders Feature 🚫\n\nRAGLight automatically excludes common directories that shouldn't be indexed, such as:\n\n- Virtual environments (`.venv`, `venv`, `env`)\n- Node.js dependencies (`node_modules`)\n- Python cache files (`__pycache__`)\n- Build artifacts (`build`, `dist`, `target`)\n- IDE files (`.vscode`, `.idea`)\n- And many more...\n\nYou can customize this list during the CLI setup or use the default configuration. This ensures that only relevant code and documentation are indexed, improving performance and reducing noise in your search results.\n\n### Ignore Folders in Configuration Classes 🚫\n\nThe ignore folders feature is also available in all configuration classes, allowing you to specify which directories to exclude during indexing:\n\n- **RAGConfig**: Use `ignore_folders` parameter to exclude folders during RAG pipeline indexing\n- **AgenticRAGConfig**: Use `ignore_folders` parameter to exclude folders during AgenticRAG pipeline indexing\n- **VectorStoreConfig**: Use `ignore_folders` parameter to exclude folders during vector store operations\n\nAll configuration classes use `Settings.DEFAULT_IGNORE_FOLDERS` as the default value, but you can override this with your custom list:\n\n```python\n# Example: Custom ignore folders for any configuration\ncustom_ignore_folders = [\n    \".venv\",\n    \"venv\",\n    \"node_modules\",\n    \"__pycache__\",\n    \".git\",\n    \"build\",\n    \"dist\",\n    \"temp_files\",  # Your custom folders\n    \"cache\"\n]\n\n# Use in any configuration class\nconfig = RAGConfig(\n    llm=Settings.DEFAULT_LLM,\n    provider=Settings.OLLAMA,\n    ignore_folders=custom_ignore_folders  # Override default\n)\n```\n\nSee the complete example in [examples\u002Fignore_folders_config_example.py](examples\u002Fignore_folders_config_example.py) for all configuration types.\n\n---\n\n## Deploy as a REST API (raglight serve) 🌐\n\n`raglight serve` starts a **FastAPI** server configured entirely via environment variables — no Python code required.\n\n### Start the server\n\n```bash\nraglight serve\n```\n\nOptions :\n\n```\n--host      Host to bind (default: 0.0.0.0)\n--port      Port to listen on (default: 8000)\n--reload    Enable auto-reload for development (default: false)\n--workers   Number of worker processes (default: 1)\n--ui        Launch the Streamlit chat UI alongside the API (default: false)\n--ui-port   Port for the Streamlit UI (default: 8501)\n```\n\nExample :\n\n```bash\nRAGLIGHT_LLM_MODEL=mistral-small-latest \\\nRAGLIGHT_LLM_PROVIDER=Mistral \\\nraglight serve --port 8080\n```\n\nLangfuse tracing example:\n\n```bash\nLANGFUSE_HOST=http:\u002F\u002Flocalhost:3000 \\\nLANGFUSE_PUBLIC_KEY=pk-lf-... \\\nLANGFUSE_SECRET_KEY=sk-lf-... \\\nraglight serve\n```\n\n> Langfuse tracing is enabled automatically when `LANGFUSE_HOST` (or `LANGFUSE_BASE_URL`),\n> `LANGFUSE_PUBLIC_KEY` and `LANGFUSE_SECRET_KEY` are all set in the environment.\n> Requires `pip install \"raglight[langfuse]\"`.\n\n### Launch the Chat UI 💬\n\nAdd `--ui` to start a **Streamlit chat interface** alongside the REST API — no extra setup required:\n\n```bash\nraglight serve --ui\n```\n\n| Address                 | Service                      |\n| ----------------------- | ---------------------------- |\n| `http:\u002F\u002Flocalhost:8000` | REST API + Swagger (`\u002Fdocs`) |\n| `http:\u002F\u002Flocalhost:8501` | Streamlit chat UI            |\n\nThe UI lets you:\n\n- **Chat** with your documents — full conversation history, markdown rendering\n- **Upload files** directly from the browser (PDF, TXT, code…)\n- **Ingest a directory** by providing a path on the server machine\n- **Switch LLM on the fly** — the sidebar's ⚙️ Model settings panel lets you change provider, model, and API base URL without restarting the server (`AWSBedrock` and `GoogleGemini` included)\n\nUse `--ui-port` to change the Streamlit port:\n\n```bash\nraglight serve --ui --port 8000 --ui-port 3000\n```\n\nBoth processes share the same configuration (env vars) and are terminated together when you stop the server.\n\n### Endpoints\n\n| Method | Path             | Body                                                                                      | Response                                                             |\n| ------ | ---------------- | ----------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |\n| `GET`  | `\u002Fhealth`        | —                                                                                         | `{\"status\": \"ok\"}`                                                   |\n| `POST` | `\u002Fgenerate`      | `{\"question\": \"...\"}`                                                                     | `{\"answer\": \"...\"}`                                                  |\n| `POST` | `\u002Fingest`        | `{\"data_path\": \"...\", \"file_paths\": [...], \"github_url\": \"...\", \"github_branch\": \"main\"}` | `{\"message\": \"...\"}`                                                 |\n| `POST` | `\u002Fingest\u002Fupload` | `multipart\u002Fform-data` — field `files` (one or more files)                                 | `{\"message\": \"...\"}`                                                 |\n| `GET`  | `\u002Fcollections`   | —                                                                                         | `{\"collections\": [...]}`                                             |\n| `GET`  | `\u002Fconfig`        | —                                                                                         | `{\"llm_provider\": \"...\", \"llm_model\": \"...\", \"llm_api_base\": \"...\"}` |\n| `POST` | `\u002Fconfig`        | `{\"llm_provider\": \"...\", \"llm_model\": \"...\", \"llm_api_base\": \"...\"}`                      | `{\"llm_provider\": \"...\", \"llm_model\": \"...\", \"llm_api_base\": \"...\"}` |\n\nThe interactive API documentation (Swagger UI) is automatically available at `http:\u002F\u002Flocalhost:8000\u002Fdocs`.\n\n#### Examples with curl\n\n```bash\n# Health check\ncurl http:\u002F\u002Flocalhost:8000\u002Fhealth\n\n# Ask a question\ncurl -X POST http:\u002F\u002Flocalhost:8000\u002Fgenerate \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"question\": \"What is RAGLight?\"}'\n\n# Ingest a local folder\ncurl -X POST http:\u002F\u002Flocalhost:8000\u002Fingest \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"data_path\": \".\u002Fmy_documents\"}'\n\n# Ingest a GitHub repository\ncurl -X POST http:\u002F\u002Flocalhost:8000\u002Fingest \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"github_url\": \"https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\", \"github_branch\": \"main\"}'\n\n# Upload files directly (multipart)\ncurl -X POST http:\u002F\u002Flocalhost:8000\u002Fingest\u002Fupload \\\n  -F \"files=@.\u002Frapport.pdf\" \\\n  -F \"files=@.\u002Fnotes.txt\"\n\n# List collections\ncurl http:\u002F\u002Flocalhost:8000\u002Fcollections\n```\n\n### Configuration via environment variables\n\nAll server settings are read from `RAGLIGHT_*` environment variables. Copy `examples\u002Fserve_example\u002F.env.example` to `.env` and adjust the values.\n\n| Variable                       | Default                  | Description                                                                |\n| ------------------------------ | ------------------------ | -------------------------------------------------------------------------- |\n| `RAGLIGHT_LLM_MODEL`           | `llama3`                 | LLM model name                                                             |\n| `RAGLIGHT_LLM_PROVIDER`        | `Ollama`                 | LLM provider (`Ollama`, `Mistral`, `OpenAI`, `LmStudio`, `GoogleGemini`)   |\n| `RAGLIGHT_LLM_API_BASE`        | `http:\u002F\u002Flocalhost:11434` | LLM API base URL                                                           |\n| `RAGLIGHT_EMBEDDINGS_MODEL`    | `all-MiniLM-L6-v2`       | Embeddings model name                                                      |\n| `RAGLIGHT_EMBEDDINGS_PROVIDER` | `HuggingFace`            | Embeddings provider (`HuggingFace`, `Ollama`, `OpenAI`, `GoogleGemini`)    |\n| `RAGLIGHT_EMBEDDINGS_API_BASE` | `http:\u002F\u002Flocalhost:11434` | Embeddings API base URL                                                    |\n| `RAGLIGHT_DB`                  | `Chroma`                 | Vector store backend (`Chroma` or `Qdrant`)                                |\n| `RAGLIGHT_PERSIST_DIR`         | `.\u002Fraglight_db`          | Local persistence directory (used when `RAGLIGHT_DB_HOST` is not set)      |\n| `RAGLIGHT_COLLECTION`          | `default`                | Collection name                                                            |\n| `RAGLIGHT_K`                   | `5`                      | Number of documents retrieved per query                                    |\n| `RAGLIGHT_SYSTEM_PROMPT`       | _(default prompt)_       | Custom system prompt for the LLM                                           |\n| `RAGLIGHT_DB_HOST`             | —                        | Remote vector store host (leave unset for local on-disk storage)           |\n| `RAGLIGHT_DB_PORT`             | —                        | Remote vector store port                                                   |\n| `RAGLIGHT_API_TIMEOUT`         | `300`                    | Request timeout in seconds for the Streamlit UI (increase for slow models) |\n\n### Deploy with Docker Compose\n\nThe quickest way to deploy in production :\n\n```bash\ncd examples\u002Fserve_example\ncp .env.example .env   # edit values as needed\ndocker-compose up\n```\n\nThe `docker-compose.yml` uses `extra_hosts: host.docker.internal:host-gateway` so the container can reach an Ollama instance running on the host machine.\n\n---\n\n## Environment Variables\n\nYou can set several environment variables to change **RAGLight** settings :\n\n**Provider credentials & URLs**\n\n- `MISTRAL_API_KEY` if you want to use Mistral API\n- `OLLAMA_CLIENT_URL` if you have a custom Ollama URL\n- `LMSTUDIO_CLIENT` if you have a custom LMStudio URL\n- `OPENAI_CLIENT_URL` if you have a custom OpenAI URL or vLLM URL\n- `OPENAI_API_KEY` if you need an OpenAI key\n- `GEMINI_API_KEY` if you need a Google Gemini API key\n- `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_DEFAULT_REGION` for AWS Bedrock (alternatively use `~\u002F.aws\u002Fcredentials` or an IAM role)\n\n**REST API server (`raglight serve`)**\n\nSee the full list in the [Configuration via environment variables](#configuration-via-environment-variables) section above.\n\n## Providers and databases\n\n### LLM\n\nFor your LLM inference, you can use these providers :\n\n- LMStudio (`Settings.LMSTUDIO`)\n- Ollama (`Settings.OLLAMA`)\n- Mistral API (`Settings.MISTRAL`)\n- vLLM (`Settings.VLLM`)\n- OpenAI (`Settings.OPENAI`)\n- Google Gemini (`Settings.GOOGLE_GEMINI`)\n- AWS Bedrock (`Settings.AWS_BEDROCK`)\n\n### Embeddings\n\nFor embeddings models, you can use these providers :\n\n- Huggingface (`Settings.HUGGINGFACE`)\n- Ollama (`Settings.OLLAMA`)\n- vLLM (`Settings.VLLM`)\n- OpenAI (`Settings.OPENAI`)\n- Google Gemini (`Settings.GOOGLE_GEMINI`)\n- AWS Bedrock (`Settings.AWS_BEDROCK`)\n\n### Vector Store\n\nFor your vector store, you can use :\n\n| Provider | Constant          | Extra              | Windows (no C++)             |\n| -------- | ----------------- | ------------------ | ---------------------------- |\n| ChromaDB | `Settings.CHROMA` | `raglight[chroma]` | No — requires a C++ compiler |\n| Qdrant   | `Settings.QDRANT` | `raglight[qdrant]` | Yes — pure Python client     |\n\nBoth support local (on-disk) and remote (HTTP) modes.\n\n## Quick Start 🚀\n\n### Knowledge Base\n\nKnowledge Base is a way to define data you want to ingest inside your vector store during the initialization of your RAG.\nIt's the data ingest when you call `build` function :\n\n```python\nfrom raglight import RAGPipeline\npipeline = RAGPipeline(knowledge_base=[\n    FolderSource(path=\"\u003Cpath to your folder with pdf>\u002Fknowledge_base\"),\n    GitHubSource(url=\"https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\")\n    ],\n    model_name=\"llama3\",\n    provider=Settings.OLLAMA,\n    k=5)\n\npipeline.build()\n```\n\nYou can define two different knowledge base :\n\n1. Folder Knowledge Base\n\nAll files\u002Ffolders into this directory will be ingested inside the vector store :\n\n```python\nfrom raglight import FolderSource\nFolderSource(path=\"\u003Cpath to your folder with pdf>\u002Fknowledge_base\"),\n```\n\n2. Github Knowledge Base\n\nYou can declare Github Repositories you want to store into your vector store :\n\n```python\nfrom raglight import GitHubSource\nGitHubSource(url=\"https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\")\n```\n\n### RAG\n\nYou can setup easily your RAG with RAGLight :\n\n```python\nfrom raglight.rag.simple_rag_api import RAGPipeline\nfrom raglight.models.data_source_model import FolderSource, GitHubSource\nfrom raglight.config.settings import Settings\nfrom raglight.config.rag_config import RAGConfig\nfrom raglight.config.vector_store_config import VectorStoreConfig\n\nSettings.setup_logging()\n\nknowledge_base=[\n    FolderSource(path=\"\u003Cpath to your folder with pdf>\u002Fknowledge_base\"),\n    GitHubSource(url=\"https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\")\n    ]\n\nvector_store_config = VectorStoreConfig(\n    embedding_model = Settings.DEFAULT_EMBEDDINGS_MODEL,\n    api_base = Settings.DEFAULT_OLLAMA_CLIENT,\n    provider=Settings.HUGGINGFACE,\n    database=Settings.CHROMA,\n    persist_directory = '.\u002FdefaultDb',\n    collection_name = Settings.DEFAULT_COLLECTION_NAME\n)\n\nconfig = RAGConfig(\n        llm = Settings.DEFAULT_LLM,\n        provider = Settings.OLLAMA,\n        # k = Settings.DEFAULT_K,\n        # cross_encoder_model = Settings.DEFAULT_CROSS_ENCODER_MODEL,\n        # system_prompt = Settings.DEFAULT_SYSTEM_PROMPT,\n        # knowledge_base = knowledge_base\n    )\n\npipeline = RAGPipeline(config, vector_store_config)\n\npipeline.build()\n\nresponse = pipeline.generate(\"How can I create an easy RAGPipeline using raglight framework ? Give me python implementation\")\nprint(response)\n```\n\nYou just have to fill the model you want to use.\n\n> ⚠️\n> By default, LLM Provider will be Ollama\n\n### Agentic RAG\n\nThis pipeline extends the Retrieval-Augmented Generation (RAG) concept by incorporating\nan additional Agent. This agent can retrieve data from your vector store.\n\nYou can modify several parameters in your config :\n\n- `provider` : Your LLM Provider (Ollama, LMStudio, Mistral)\n- `model` : The model you want to use\n- `k` : The number of document you'll retrieve\n- `max_steps` : Max reflexion steps used by your Agent\n- `api_key` : Your Mistral API key\n- `api_base` : Your API URL (Ollama URL, LM Studio URL, ...)\n- `num_ctx` : Your context max_length\n- `verbosity_level` : Your logs' verbosity level\n- `ignore_folders` : List of folders to exclude during indexing (e.g., [\".venv\", \"node_modules\", \"**pycache**\"])\n\n```python\nfrom raglight.config.settings import Settings\nfrom raglight.rag.simple_agentic_rag_api import AgenticRAGPipeline\nfrom raglight.config.agentic_rag_config import AgenticRAGConfig\nfrom raglight.config.vector_store_config import VectorStoreConfig\nfrom raglight.config.settings import Settings\nfrom dotenv import load_dotenv\n\nload_dotenv()\nSettings.setup_logging()\n\npersist_directory = '.\u002FdefaultDb'\nmodel_embeddings = Settings.DEFAULT_EMBEDDINGS_MODEL\ncollection_name = Settings.DEFAULT_COLLECTION_NAME\n\nvector_store_config = VectorStoreConfig(\n    embedding_model = model_embeddings,\n    api_base = Settings.DEFAULT_OLLAMA_CLIENT,\n    database=Settings.CHROMA,\n    persist_directory = persist_directory,\n    # host='localhost',\n    # port='8001',\n    provider = Settings.HUGGINGFACE,\n    collection_name = collection_name\n)\n\n# Custom ignore folders - you can override the default list\ncustom_ignore_folders = [\n    \".venv\",\n    \"venv\",\n    \"node_modules\",\n    \"__pycache__\",\n    \".git\",\n    \"build\",\n    \"dist\",\n    \"my_custom_folder_to_ignore\"  # Add your custom folders here\n]\n\nconfig = AgenticRAGConfig(\n            provider = Settings.MISTRAL,\n            model = \"mistral-large-2411\",\n            k = 10,\n            system_prompt = Settings.DEFAULT_AGENT_PROMPT,\n            max_steps = 4,\n            api_key = Settings.MISTRAL_API_KEY, # os.environ.get('MISTRAL_API_KEY')\n            ignore_folders = custom_ignore_folders,  # Use custom ignore folders\n            # api_base = ... # If you have a custom client URL\n            # num_ctx = ... # Max context length\n            # verbosity_level = ... # Default = 2\n            # knowledge_base = knowledge_base\n        )\n\nagenticRag = AgenticRAGPipeline(config, vector_store_config)\nagenticRag.build()\n\nresponse = agenticRag.generate(\"Please implement for me AgenticRAGPipeline inspired by RAGPipeline and AgenticRAG and RAG\")\n\nprint('response : ', response)\n```\n\n### MCP Integration\n\nRAGLight supports MCP Server integration to enhance the reasoning capabilities of your agent. MCP allows the agent to interact with external tools (e.g., code execution environments, database tools, or search agents) via a standardized server interface.\n\nTo use MCP, simply pass a mcp_config parameter to your AgenticRAGConfig, where each config defines the url (and optionally transport) of the MCP server.\n\nJust add this parameter to your AgenticRAGPipeline :\n\n```python\nconfig = AgenticRAGConfig(\n    provider = Settings.OPENAI,\n    model = \"gpt-4o\",\n    k = 10,\n    mcp_config = [\n        {\"url\": \"http:\u002F\u002F127.0.0.1:8001\u002Fsse\"}  # Your MCP server URL\n    ],\n    ...\n)\n```\n\n> 📚 Documentation: Learn how to configure and launch an MCP server using [MCPClient.server_parameters](https:\u002F\u002Fhuggingface.co\u002Fdocs\u002Fsmolagents\u002Fen\u002Freference\u002Ftools#smolagents.MCPClient.server_parameters)\n\n### Use Custom Pipeline\n\n**1. Configure Your Pipeline**\n\nYou can also setup your own Pipeline :\n\n```python\nfrom raglight.rag.builder import Builder\nfrom raglight.config.settings import Settings\n\nrag = Builder() \\\n    .with_embeddings(Settings.HUGGINGFACE, model_name=model_embeddings) \\\n    .with_vector_store(Settings.CHROMA, persist_directory=persist_directory, collection_name=collection_name) \\\n    .with_llm(Settings.OLLAMA, model_name=model_name, system_prompt_file=system_prompt_directory, provider=Settings.LMStudio) \\\n    .build_rag(k = 5)\n```\n\n**2. Ingest Documents Inside Your Vector Store**\n\nThen you can ingest data into your vector store.\n\n1. You can use default pipeline that'll ingest no code data :\n\n```python\nrag.vector_store.ingest(data_path='.\u002Fdata')\n```\n\n2. Or you can use code pipeline :\n\n```python\nrag.vector_store.ingest(repos_path=['.\u002Frepository1', '.\u002Frepository2'])\n```\n\nThis pipeline will ingest code embeddings into your collection : **collection_name**.\nBut this pipeline will also extract all signatures from your code base and ingest it into : **collection_name_classes**.\n\nYou have access to two different functions inside `VectorStore` class : `similarity_search` and `similarity_search_class` to search into different collection.\n\n**3. Query the Pipeline**\n\nRetrieve and generate answers using the RAG pipeline:\n\n```python\nresponse = rag.generate(\"How can I optimize my marathon training?\")\nprint(response)\n```\n\n> ### ✚ More Examples\n>\n> You can find more examples for all these use cases in the [examples](https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\u002Fblob\u002Fmain\u002Fexamples) directory.\n\n### Override Default Processors\n\nRAGLight ships with built-in document processors based on file extension:\n\n- `pdf` → `PDFProcessor`\n- `py`, `js`, `ts`, `java`, `cpp`, `cs` → `CodeProcessor`\n- `txt`, `md`, `html` → `TextProcessor`\n\nYou can override these defaults using the `custom_processors` argument when building your vector store. This is especially useful if you want to handle certain file types with a custom logic, such as using a **Vision-Language Model (VLM)** for PDFs with diagrams and images. RAGLight provides a VLM based Processor too.\n\n#### Register the Custom Processor in the Builder\n\n```python\nfrom raglight.document_processing.vlm_pdf_processor import VlmPDFProcessor\nfrom raglight.llm.ollama_model import OllamaModel\nfrom raglight.rag.builder import Builder\nfrom raglight.config.settings import Settings\n\nfrom dotenv import load_dotenv\nimport os\n\nload_dotenv()\nSettings.setup_logging()\n\npersist_directory = '.\u002FdefaultDb'\nmodel_embeddings = Settings.DEFAULT_EMBEDDINGS_MODEL\ncollection_name = Settings.DEFAULT_COLLECTION_NAME\ndata_path = os.environ.get('DATA_PATH')\n\n# Vision-Language Model (example with Ollama)\nvlm = OllamaModel(\n    model_name=\"ministral-3:3b\",\n    system_prompt=\"You are a technical documentation visual assistant.\",\n)\n\ncustom_processors = {\n    \"pdf\": VlmPDFProcessor(vlm),  # Override default PDF processor\n}\n\nvector_store = Builder() \\\n    .with_embeddings(Settings.HUGGINGFACE, model_name=model_embeddings) \\\n    .with_vector_store(\n        Settings.CHROMA,\n        persist_directory=persist_directory,\n        collection_name=collection_name,\n        custom_processors=custom_processors,\n    ) \\\n    .build_vector_store()\n\nvector_store.ingest(data_path=data_path)\n```\n\nWith this setup, all `.pdf` files will be processed by your custom `VlmPDFProcessor`, while other file types keep using the default processors.\n\n### Hybrid Search (BM25 + Semantic + RRF) 🔍\n\nRAGLight supports three retrieval strategies, configurable via the `search_type` parameter. Both **Chroma** and **Qdrant** backends are supported.\n\n| Mode         | Description                                              |\n| ------------ | -------------------------------------------------------- |\n| `\"semantic\"` | Dense vector similarity search (default)                 |\n| `\"bm25\"`     | Keyword-based BM25 search                                |\n| `\"hybrid\"`   | BM25 + semantic merged with Reciprocal Rank Fusion (RRF) |\n\n#### With the Builder API\n\n```python\nfrom raglight.rag.builder import Builder\nfrom raglight.config.settings import Settings\n\n# Works with Settings.CHROMA or Settings.QDRANT\nrag = (\n    Builder()\n    .with_embeddings(Settings.HUGGINGFACE, model_name=\"all-MiniLM-L6-v2\")\n    .with_vector_store(\n        Settings.QDRANT,                     # or Settings.CHROMA\n        persist_directory=\".\u002FmyDb\",\n        collection_name=\"my_collection\",\n        search_type=Settings.SEARCH_HYBRID,  # \"semantic\" | \"bm25\" | \"hybrid\"\n        alpha=0.5,                           # weight between semantic and BM25 in RRF\n    )\n    .with_llm(Settings.OLLAMA, model_name=\"llama3.1:8b\")\n    .build_rag(k=5)\n)\n\nrag.vector_store.ingest(data_path=\".\u002Fdocs\")\nresponse = rag.generate(\"What is Reciprocal Rank Fusion?\")\nprint(response)\n```\n\n#### With the high-level RAGPipeline API\n\n```python\nfrom raglight.rag.simple_rag_api import RAGPipeline\nfrom raglight.config.rag_config import RAGConfig\nfrom raglight.config.vector_store_config import VectorStoreConfig\nfrom raglight.config.settings import Settings\nfrom raglight.models.data_source_model import FolderSource\n\nvector_store_config = VectorStoreConfig(\n    embedding_model=Settings.DEFAULT_EMBEDDINGS_MODEL,\n    provider=Settings.HUGGINGFACE,\n    database=Settings.CHROMA,\n    persist_directory=\".\u002FmyDb\",\n    collection_name=\"my_collection\",\n    search_type=Settings.SEARCH_HYBRID,   # or SEARCH_SEMANTIC \u002F SEARCH_BM25\n    hybrid_alpha=0.5,\n)\n\nconfig = RAGConfig(\n    llm=\"llama3.1:8b\",\n    provider=Settings.OLLAMA,\n    k=5,\n    knowledge_base=[FolderSource(path=\".\u002Fdocs\")],\n)\n\npipeline = RAGPipeline(config, vector_store_config)\npipeline.build()\nresponse = pipeline.generate(\"Explain the retrieval pipeline\")\nprint(response)\n```\n\n> **How RRF works**: each search mode returns its own ranked list of documents. RRF assigns a score of `1 \u002F (k + rank)` to each document per list and sums them — documents appearing high in both lists are promoted, while documents unique to one list are kept but ranked lower. This gives the hybrid mode better recall and precision than either mode alone.\n\n> See the full working example in [examples\u002Fhybrid_search_example.py](examples\u002Fhybrid_search_example.py).\n\n---\n\n### Qdrant Vector Store 🗄️\n\nQdrant is a pure-Python alternative to ChromaDB — **no C++ compiler required**, making it the recommended choice on Windows.\n\n```bash\npip install \"raglight[qdrant]\"\n```\n\n#### Local mode (on-disk, no server)\n\n```python\nimport uuid\nfrom raglight.rag.builder import Builder\nfrom raglight.config.settings import Settings\n\nrag = (\n    Builder()\n    .with_embeddings(Settings.HUGGINGFACE, model_name=\"all-MiniLM-L6-v2\")\n    .with_vector_store(\n        Settings.QDRANT,\n        persist_directory=\".\u002FqdrantDb\",\n        collection_name=str(uuid.uuid4()),\n    )\n    .with_llm(Settings.OLLAMA, model_name=\"llama3.1:8b\")\n    .build_rag(k=5)\n)\n\nrag.vector_store.ingest(data_path=\".\u002Fdocs\")\nresponse = rag.generate(\"What is RAGLight?\")\nprint(response)\n```\n\n#### Remote mode (Qdrant server)\n\nStart a Qdrant server with Docker:\n\n```bash\ndocker run -p 6333:6333 qdrant\u002Fqdrant\n```\n\nThen point the builder to it:\n\n```python\nrag = (\n    Builder()\n    .with_embeddings(Settings.HUGGINGFACE, model_name=\"all-MiniLM-L6-v2\")\n    .with_vector_store(\n        Settings.QDRANT,\n        host=\"localhost\",\n        port=6333,\n        collection_name=\"my_collection\",\n    )\n    .with_llm(Settings.OLLAMA, model_name=\"llama3.1:8b\")\n    .build_rag(k=5)\n)\n```\n\n> See the full working example in [examples\u002Fqdrant_example.py](examples\u002Fqdrant_example.py).\n\n---\n\n### Query Reformulation ✍️\n\nRAGLight automatically rewrites follow-up questions into standalone queries before retrieval. This dramatically improves accuracy in multi-turn conversations where the user's question references previous context (e.g. _\"and for Python?\"_ → _\"How do I do X in Python?\"_).\n\nReformulation is **enabled by default**. The current LLM is used to rewrite the question; if there is no conversation history yet, the question is passed through unchanged.\n\n#### With the high-level RAGPipeline API\n\n```python\nfrom raglight.config.rag_config import RAGConfig\nfrom raglight.config.settings import Settings\n\n# Enabled by default\nconfig = RAGConfig(\n    llm=Settings.DEFAULT_LLM,\n    provider=Settings.OLLAMA,\n)\n\n# Disable if needed\nconfig = RAGConfig(\n    llm=Settings.DEFAULT_LLM,\n    provider=Settings.OLLAMA,\n    reformulation=False,\n)\n```\n\n#### With the Builder API\n\n```python\nfrom raglight.rag.builder import Builder\nfrom raglight.config.settings import Settings\n\nrag = (\n    Builder()\n    .with_embeddings(Settings.HUGGINGFACE, model_name=\"all-MiniLM-L6-v2\")\n    .with_vector_store(Settings.CHROMA, persist_directory=\".\u002FmyDb\", collection_name=\"my_collection\")\n    .with_llm(Settings.OLLAMA, model_name=\"llama3.1:8b\")\n    .build_rag(k=5, reformulation=True)  # True by default\n)\n```\n\nThe reformulated question is logged at `INFO` level so you can inspect what the LLM produced.\n\n**Pipeline with reformulation enabled:**\n\n```\nreformulate → retrieve → [rerank?] → generate\n```\n\n---\n\n### Streaming Output ⚡\n\nAll providers support token-by-token streaming via `generate_streaming()`. It runs the full pipeline (reformulation → retrieval → reranking) and yields answer chunks as they arrive from the LLM.\n\n#### With RAGPipeline\n\n```python\npipeline = RAGPipeline(config, vector_store_config)\npipeline.build()\n\nfor chunk in pipeline.generate_streaming(\"How does RAGLight work?\"):\n    print(chunk, end=\"\", flush=True)\nprint()\n```\n\n#### With the Builder API\n\n```python\nrag = (\n    Builder()\n    .with_embeddings(Settings.HUGGINGFACE, model_name=\"all-MiniLM-L6-v2\")\n    .with_vector_store(Settings.CHROMA, persist_directory=\".\u002FmyDb\", collection_name=\"col\")\n    .with_llm(Settings.OLLAMA, model_name=\"llama3.1:8b\")\n    .build_rag(k=5)\n)\n\nfor chunk in rag.generate_streaming(\"Explain the retrieval pipeline\"):\n    print(chunk, end=\"\", flush=True)\nprint()\n```\n\nStreaming is supported by all providers: **Ollama**, **OpenAI**, **vLLM**, **LMStudio**, **Mistral**, **Google Gemini**, and **AWS Bedrock**. Conversation history is updated automatically at the end of the stream.\n\n---\n\n### Conversation History 💬\n\nRAGLight automatically maintains conversation history across `generate()` calls. Each turn appends a `user` and an `assistant` message passed to the LLM on the next call — enabling genuine multi-turn conversations across **all providers**.\n\nBy default, history is capped at **20 messages** (~10 turns). Use `max_history` to adjust this limit, or pass `None` for unlimited history:\n\n```python\n# Via RAGConfig (high-level API)\nconfig = RAGConfig(\n    llm=Settings.DEFAULT_LLM,\n    provider=Settings.OLLAMA,\n    max_history=20,  # keep last 20 messages (~10 turns)\n)\n\n# Via Builder\nrag = (\n    Builder()\n    .with_embeddings(Settings.HUGGINGFACE, model_name=\"all-MiniLM-L6-v2\")\n    .with_vector_store(Settings.CHROMA, persist_directory=\".\u002FmyDb\", collection_name=\"col\")\n    .with_llm(Settings.OLLAMA, model_name=\"llama3.1:8b\")\n    .build_rag(k=5, max_history=20)\n)\n```\n\n> **Tip**: set `max_history` to roughly 2× the number of turns you want to retain (each turn = 2 messages).\n\n---\n\n### AWS Bedrock ☁️\n\nRAGLight supports AWS Bedrock for both LLM inference and embeddings. Authentication relies on the standard boto3 credential chain (env vars, `~\u002F.aws\u002Fcredentials`, or IAM role).\n\n**AWS credentials (one of):**\n\n- Environment variables: `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_DEFAULT_REGION`\n- AWS credentials file: `~\u002F.aws\u002Fcredentials`\n- IAM role (EC2 \u002F ECS \u002F Lambda)\n\n**Supported models (examples):**\n\n| Type       | Model ID                                    |\n| ---------- | ------------------------------------------- |\n| LLM        | `anthropic.claude-3-5-sonnet-20241022-v2:0` |\n| LLM        | `anthropic.claude-3-haiku-20240307-v1:0`    |\n| Embeddings | `amazon.titan-embed-text-v2:0`              |\n| Embeddings | `cohere.embed-english-v3`                   |\n\n> **Cross-region inference profiles**: newer Claude models (Claude 3.7+, Claude 4) require a cross-region inference profile ID instead of the bare model ID. Use a `us.`, `eu.`, or `ap.` prefix — for example `us.anthropic.claude-sonnet-4-6`. Run `aws bedrock list-inference-profiles` to list profiles available in your account.\n\n```python\nfrom raglight.rag.simple_rag_api import RAGPipeline\nfrom raglight.config.settings import Settings\nfrom raglight.config.rag_config import RAGConfig\nfrom raglight.config.vector_store_config import VectorStoreConfig\nfrom raglight.models.data_source_model import GitHubSource\n\nSettings.setup_logging()\n\nvector_store_config = VectorStoreConfig(\n    provider=Settings.AWS_BEDROCK,\n    embedding_model=Settings.AWS_BEDROCK_EMBEDDING_MODEL,  # amazon.titan-embed-text-v2:0\n    database=Settings.CHROMA,\n    persist_directory=\".\u002FbedrockDb\",\n    collection_name=\"bedrock_collection\",\n)\n\nconfig = RAGConfig(\n    provider=Settings.AWS_BEDROCK,\n    llm=Settings.AWS_BEDROCK_LLM_MODEL,  # anthropic.claude-3-5-sonnet-20241022-v2:0\n    knowledge_base=[GitHubSource(url=\"https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\")],\n)\n\npipeline = RAGPipeline(config, vector_store_config)\npipeline.build()\nresponse = pipeline.generate(\"How can I create a RAGPipeline using raglight?\")\nprint(response)\n```\n\n> See the full working example in [examples\u002Fbedrock_example.py](examples\u002Fbedrock_example.py).\n\n---\n\n### Observability with Langfuse\n\nRAGLight supports **Langfuse 4.0.0** for full observability of your RAG pipeline. Every `generate()` call is traced as a single Langfuse trace, with each LangGraph node (retrieve, rerank, generate) appearing as a separate span.\n\nBoth `generate()` and `generate_streaming()` propagate Langfuse callbacks automatically across all providers (Ollama, OpenAI, Mistral, Gemini, LMStudio, Bedrock).\n\n> **Note**: If Langfuse credentials are not configured, RAGLight automatically sets `LANGFUSE_TRACING_ENABLED=false` to prevent Langfuse v4 from attempting to connect to `localhost:3000` on startup.\n\n#### Install the extra dependency\n\n```bash\npip install \"raglight[langfuse]\"\n# or directly:\npip install \"langfuse==4.0.0\"\n```\n\n#### Usage with RAGPipeline\n\n```python\nfrom raglight.config.rag_config import RAGConfig\nfrom raglight.config.vector_store_config import VectorStoreConfig\nfrom raglight.config.langfuse_config import LangfuseConfig\nfrom raglight.config.settings import Settings\nfrom raglight.rag.simple_rag_api import RAGPipeline\n\nlangfuse_config = LangfuseConfig(\n    public_key=\"pk-lf-...\",\n    secret_key=\"sk-lf-...\",\n    host=\"http:\u002F\u002Flocalhost:3000\",  # or your Langfuse Cloud URL\n)\n\nconfig = RAGConfig(\n    llm=Settings.DEFAULT_LLM,\n    provider=Settings.OLLAMA,\n    langfuse_config=langfuse_config,\n)\n\nvector_store_config = VectorStoreConfig(\n    embedding_model=Settings.DEFAULT_EMBEDDINGS_MODEL,\n    provider=Settings.HUGGINGFACE,\n    database=Settings.CHROMA,\n    persist_directory=\".\u002FmyDb\",\n    collection_name=\"my_collection\",\n)\n\npipeline = RAGPipeline(config, vector_store_config)\npipeline.build()\nresponse = pipeline.generate(\"What is RAGLight?\")\nprint(response)\n```\n\n#### Usage with the Builder API\n\n```python\nfrom raglight.rag.builder import Builder\nfrom raglight.config.langfuse_config import LangfuseConfig\nfrom raglight.config.settings import Settings\n\nlangfuse_config = LangfuseConfig(\n    public_key=\"pk-lf-...\",\n    secret_key=\"sk-lf-...\",\n    host=\"http:\u002F\u002Flocalhost:3000\",\n)\n\nrag = (\n    Builder()\n    .with_embeddings(Settings.HUGGINGFACE, model_name=Settings.DEFAULT_EMBEDDINGS_MODEL)\n    .with_vector_store(Settings.CHROMA, persist_directory=\".\u002FmyDb\", collection_name=\"my_collection\")\n    .with_llm(Settings.OLLAMA, model_name=Settings.DEFAULT_LLM)\n    .build_rag(k=5, langfuse_config=langfuse_config)\n)\n\nrag.vector_store.ingest(data_path=\".\u002Fdocs\")\nresponse = rag.generate(\"Explain the retrieval pipeline\")\nprint(response)\n```\n\n#### Session ID\n\nBy default, a **UUID is generated once per `RAG` instance** and reused for every `generate()` call, so all turns of the same conversation are grouped under the same Langfuse trace.\n\nYou can pin a custom ID via `LangfuseConfig(session_id=\"my-session-42\", ...)`.\n\n---\n\n## Use RAGLight with Docker\n\nYou can use RAGLight inside a Docker container easily.\nFind Dockerfile example here : [examples\u002FDockerfile.example](https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\u002Fblob\u002Fmain\u002Fexamples\u002FDockerfile.example)\n\n### Build your image\n\nJust go to **examples** directory and run :\n\n```bash\ndocker build -t docker-raglight -f Dockerfile.example .\n```\n\n## Run your image\n\nIn order your container can communicate with Ollama or LMStudio, you need to add a custom host-to-IP mapping :\n\n```bash\ndocker run --add-host=host.docker.internal:host-gateway docker-raglight\n```\n\nWe use `--add-host` flag to allow Ollama call.\n","# RAGLight\n\n![License](https:\u002F\u002Fimg.shields.io\u002Fgithub\u002Flicense\u002FBessouat40\u002FRAGLight)\n[![Downloads](https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FBessouat40_RAGLight_readme_638ed81512e6.png)](https:\u002F\u002Fpepy.tech\u002Fprojects\u002Fraglight)\n[![Run Test](https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\u002Factions\u002Fworkflows\u002Ftest.yml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\u002Factions\u002Fworkflows\u002Ftest.yml)\n\n\u003Cdiv align=\"center\">\n    \u003Cimg alt=\"RAGLight\" height=\"200px\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FBessouat40_RAGLight_readme_d4032dc61b0f.png\">\n\u003C\u002Fdiv>\n\n**RAGLight** 是一个轻量级且模块化的 Python 库，用于实现 **检索增强生成（RAG）**。它通过将文档检索与自然语言推理相结合，增强了大型语言模型（LLM）的能力。\n\nRAGLight 旨在提供简单性和灵活性，其模块化组件可以轻松集成各种 LLM、嵌入模型和向量存储，使其成为构建上下文感知 AI 解决方案的理想工具。\n\n---\n\n## 📚 目录\n\n- [要求](#⚠️-requirements)\n\n- [特性](#features)\n\n- [导入库](#import-library-🛠️)\n\n- [使用 CLI 立即与您的文档聊天](#chat-with-your-documents-instantly-with-cli-💬)\n  - [忽略文件夹功能](#ignore-folders-feature-🚫)\n  - [在配置类中忽略文件夹](#ignore-folders-in-configuration-classes-🚫)\n\n- [部署为 REST API (raglight serve)](#deploy-as-a-rest-api-raglight-serve-🌐)\n  - [启动服务器](#start-the-server)\n  - [启动聊天界面](#launch-the-chat-ui-💬)\n  - [端点](#endpoints)\n  - [通过环境变量配置](#configuration-via-environment-variables)\n  - [使用 Docker Compose 部署](#deploy-with-docker-compose)\n\n- [环境变量](#environment-variables)\n\n- [提供商和数据库](#providers-and-databases)\n  - [LLM](#llm)\n  - [嵌入模型](#embeddings)\n  - [向量存储](#vector-store)\n\n- [快速入门](#quick-start-🚀)\n  - [知识库](#knowledge-base)\n  - [RAG](#rag)\n  - [代理式 RAG](#agentic-rag)\n  - [MCP 集成](#mcp-integration)\n  - [使用自定义管道](#use-custom-pipeline)\n  - [覆盖默认处理器](#override-default-processors)\n  - [混合搜索（BM25 + 语义 + RRF）](#hybrid-search-bm25--semantic--rrf-)\n  - [Qdrant 向量存储](#qdrant-vector-store-️)\n  - [查询改写](#query-reformulation-✍️)\n  - [流式输出](#streaming-output-⚡)\n  - [对话历史](#conversation-history-💬)\n  - [AWS Bedrock](#aws-bedrock-☁️)\n  - [使用 Langfuse 进行可观测性](#observability-with-langfuse)\n\n- [使用 Docker 运行 RAGLight](#use-raglight-with-docker)\n  - [构建镜像](#build-your-image)\n  - [运行镜像](#run-your-image)\n\n---\n\n> ## ⚠️ 要求\n>\n> 实际上，RAGLight 支持：\n>\n> - Ollama\n> - Google Gemini\n> - LMStudio\n> - vLLM\n> - OpenAI API\n> - Mistral API\n> - AWS Bedrock\n>\n> 如果您使用 LMStudio，需要确保已加载您想要使用的模型。\n> 如果您使用 AWS Bedrock，请配置您的 AWS 凭证（环境变量、`~\u002F.aws\u002Fcredentials` 或 IAM 角色）——无需额外安装。\n\n## 特性\n\n- **嵌入模型集成**：插入您偏好的嵌入模型（例如 HuggingFace 的 **all-MiniLM-L6-v2**），以获得紧凑高效的向量嵌入。\n- **LLM 无关性**：可无缝集成来自不同提供商的不同 LLM（Ollama、LMStudio、Mistral、OpenAI、Google Gemini、AWS Bedrock）。\n- **RAG 流程**：将文档检索和语言生成结合在一个统一的工作流程中。\n- **代理式 RAG 流程**：使用代理来提升 RAG 的性能。\n- 🔌 **MCP 集成**：通过 MCP 服务器添加外部工具功能（例如代码执行、数据库访问）。\n- **灵活的文档支持**：可摄取并索引多种文档类型（例如 PDF、TXT、DOCX、Python、Javascript 等）。\n- **可扩展架构**：可轻松更换向量存储、嵌入模型或 LLM，以满足您的需求。\n- 🔍 **混合搜索（BM25 + 语义 + RRF）**：将基于关键词的 BM25 检索与密集向量搜索相结合，使用倒排排名融合技术，以获得最佳结果。\n- ✍️ **查询改写**：利用对话历史自动将后续问题改写为独立查询，从而提高多轮对话中的检索准确性。\n- 💬 **对话历史**：所有提供商（Ollama、OpenAI、Mistral、LMStudio、Gemini、Bedrock）均支持完整的多轮对话历史，并可选择设置 `max_history` 上限。\n- ⚡ **流式输出**：所有提供商都支持通过 `generate_streaming()` 进行逐 token 流式输出——无需额外配置即可与 `generate()` 互换使用。\n- ☁️ **AWS Bedrock**：可使用 Claude、Titan、Llama 等 Bedrock 模型进行 LLM 推理和嵌入计算。\n- 📊 **Langfuse 可观测性（v3+）**：可在 Langfuse 仪表板中直接跟踪每次 RAG 调用的端到端过程——检索、重新排序和生成。\n\n---\n\n## 导入库 🛠️\n\n安装基础库：\n\n```bash\npip install raglight\n```\n\nRAGLight 使用 **可选依赖项** 来支持不同的向量存储后端，因此您可以只安装所需的部分：\n\n| 附加项                | 安装的包       | 备注                                                 |\n| -------------------- | ----------------- | ----------------------------------------------------- |\n| `raglight[chroma]`   | `chromadb`        | Windows 上需要 C++ 编译器                    |\n| `raglight[qdrant]`   | `qdrant-client`   | 纯 Python —— 在 Windows 上无需 C++ 编译器即可运行 |\n| `raglight[langfuse]` | `langfuse`        | 可观测性追踪                                 |\n\n```bash\npip install \"raglight[qdrant]\"           # 仅 Qdrant（Windows 友好）\npip install \"raglight[chroma]\"           # 仅 ChromaDB\npip install \"raglight[chroma,qdrant]\"    # 两者\npip install \"raglight[qdrant,langfuse]\"  # Qdrant + 可观测性\n```\n\n---\n\n## 使用 CLI 立即与您的文档聊天 💬\n\n为了最快速简便地开始使用，RAGLight 提供了一个交互式命令行向导。它将引导您完成从选择文档到与文档聊天的每一个步骤，而无需编写任何一行 Python 代码。\n前提条件：请确保您已运行本地 LLM 服务，例如 Ollama。\n\n只需在终端中运行以下命令：\n\n```bash\nraglight chat\n```\n\n您也可以通过以下命令启动代理式 RAG 向导：\n\n```bash\nraglight agentic-chat\n```\n\n向导将指导您完成设置过程。以下是其界面示意图：\n\n\u003Cdiv align=\"center\">\n    \u003Cimg alt=\"RAGLight\" src=\"https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FBessouat40_RAGLight_readme_b05550b22284.png\">\n\u003C\u002Fdiv>\n\n向导会询问您：\n\n- 📂 数据源：包含文档的本地文件夹路径。\n- 🚫 忽略文件夹：配置在索引过程中要排除哪些文件夹（例如 `.venv`、`node_modules`、`__pycache__`）。\n- 💾 向量数据库：索引数据的存储位置及名称。\n- 🧠 嵌入模型：用于理解文档内容的模型。\n- 🤖 语言模型（LLM）：用于生成答案的 LLM。\n\n配置完成后，它将自动索引您的文档并开始聊天会话。\n\n### 忽略文件夹功能 🚫\n\nRAGLight 会自动排除不应被索引的常见目录，例如：\n\n- 虚拟环境（`.venv`、`venv`、`env`）\n- Node.js 依赖项（`node_modules`）\n- Python 缓存文件（`__pycache__`）\n- 构建产物（`build`、`dist`、`target`）\n- IDE 相关文件（`.vscode`、`.idea`）\n- 以及更多……\n\n您可以在 CLI 设置过程中自定义此列表，或使用默认配置。这样可以确保只有相关代码和文档被索引，从而提高性能并减少搜索结果中的噪声。\n\n### 配置类中的忽略文件夹功能 🚫\n\n忽略文件夹功能同样适用于所有配置类，允许您指定在索引过程中要排除的目录：\n\n- **RAGConfig**：使用 `ignore_folders` 参数在 RAG 流水线索引时排除文件夹\n- **AgenticRAGConfig**：使用 `ignore_folders` 参数在 AgenticRAG 流水线索引时排除文件夹\n- **VectorStoreConfig**：使用 `ignore_folders` 参数在向量存储操作中排除文件夹\n\n所有配置类都以 `Settings.DEFAULT_IGNORE_FOLDERS` 作为默认值，但您可以使用自定义列表进行覆盖：\n\n```python\n# 示例：为任意配置自定义忽略文件夹\ncustom_ignore_folders = [\n    \".venv\",\n    \"venv\",\n    \"node_modules\",\n    \"__pycache__\",\n    \".git\",\n    \"build\",\n    \"dist\",\n    \"temp_files\",  # 您的自定义文件夹\n    \"cache\"\n]\n\n# 在任意配置类中使用\nconfig = RAGConfig(\n    llm=Settings.DEFAULT_LLM,\n    provider=Settings.OLLAMA,\n    ignore_folders=custom_ignore_folders  # 覆盖默认值\n)\n```\n\n完整示例请参见 [examples\u002Fignore_folders_config_example.py](examples\u002Fignore_folders_config_example.py)，涵盖所有配置类型。\n\n---\n\n## 以 REST API 形式部署（raglight serve）🌐\n\n`raglight serve` 会启动一个完全通过环境变量配置的 **FastAPI** 服务器——无需编写任何 Python 代码。\n\n### 启动服务器\n\n```bash\nraglight serve\n```\n\n选项：\n\n```\n--host      绑定的主机地址（默认：0.0.0.0）\n--port      监听的端口（默认：8000）\n--reload    开发模式下启用自动重载（默认：False）\n--workers   工作进程数量（默认：1）\n--ui        同时启动 Streamlit 聊天 UI（默认：False）\n--ui-port   Streamlit UI 的端口（默认：8501）\n```\n\n示例：\n\n```bash\nRAGLIGHT_LLM_MODEL=mistral-small-latest \\\nRAGLIGHT_LLM_PROVIDER=Mistral \\\nraglight serve --port 8080\n```\n\nLangfuse 追踪示例：\n\n```bash\nLANGFUSE_HOST=http:\u002F\u002Flocalhost:3000 \\\nLANGFUSE_PUBLIC_KEY=pk-lf-... \\\nLANGFUSE_SECRET_KEY=sk-lf-... \\\nraglight serve\n```\n\n> 当 `LANGFUSE_HOST`（或 `LANGFUSE_BASE_URL`）、`LANGFUSE_PUBLIC_KEY` 和 `LANGFUSE_SECRET_KEY` 均在环境中设置时，Langfuse 追踪将自动启用。\n> 需要运行 `pip install \"raglight[langfuse]\"`。\n\n### 启动聊天界面 💬\n\n添加 `--ui` 即可在 REST API 旁启动 **Streamlit 聊天界面**——无需额外配置：\n\n```bash\nraglight serve --ui\n```\n\n| 地址                 | 服务                      |\n| ----------------------- | ---------------------------- |\n| `http:\u002F\u002Flocalhost:8000` | REST API + Swagger (`\u002Fdocs`) |\n| `http:\u002F\u002Flocalhost:8501` | Streamlit 聊天界面            |\n\n该界面支持：\n\n- **聊天**：与您的文档交互——保留完整对话历史，并支持 Markdown 渲染\n- **上传文件**：直接从浏览器上传 PDF、TXT、代码等文件\n- **导入目录**：只需提供服务器上的路径即可\n- **实时切换 LLM**——侧边栏的 ⚙️ 模型设置面板允许您在不重启服务器的情况下更改提供商、模型和 API 基础 URL（包括 `AWSBedrock` 和 `GoogleGemini`）\n\n使用 `--ui-port` 可以更改 Streamlit 的端口：\n\n```bash\nraglight serve --ui --port 8000 --ui-port 3000\n```\n\n两个进程共享相同的配置（环境变量），并在您停止服务器时同时终止。\n\n### 端点\n\n| 方法 | 路径             | 请求体                                                                                      | 响应                                                             |\n| ------ | ---------------- | ----------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |\n| `GET`  | `\u002Fhealth`        | —                                                                                         | `{\"status\": \"ok\"}`                                                   |\n| `POST` | `\u002Fgenerate`      | `{\"question\": \"...\"}`                                                                     | `{\"answer\": \"...\"}`                                                  |\n| `POST` | `\u002Fingest`        | `{\"data_path\": \"...\", \"file_paths\": [...], \"github_url\": \"...\", \"github_branch\": \"main\"}` | `{\"message\": \"...\"}`                                                 |\n| `POST` | `\u002Fingest\u002Fupload` | `multipart\u002Fform-data` — 字段 `files`（一个或多个文件）                                 | `{\"message\": \"...\"}`                                                 |\n| `GET`  | `\u002Fcollections`   | —                                                                                         | `{\"collections\": [...]}`                                             |\n| `GET`  | `\u002Fconfig`        | —                                                                                         | `{\"llm_provider\": \"...\", \"llm_model\": \"...\", \"llm_api_base\": \"...\"}` |\n| `POST` | `\u002Fconfig`        | `{\"llm_provider\": \"...\", \"llm_model\": \"...\", \"llm_api_base\": \"...\"}`                      | `{\"llm_provider\": \"...\", \"llm_model\": \"...\", \"llm_api base\": \"...\"}` |\n\n交互式 API 文档（Swagger UI）会自动在 `http:\u002F\u002Flocalhost:8000\u002Fdocs` 提供。\n\n#### 使用 curl 的示例\n\n```bash\n# 健康检查\ncurl http:\u002F\u002Flocalhost:8000\u002Fhealth\n\n# 提问\ncurl -X POST http:\u002F\u002Flocalhost:8000\u002Fgenerate \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"question\": \"What is RAGLight?\"}'\n\n# 导入本地文件夹\ncurl -X POST http:\u002F\u002Flocalhost:8000\u002Fingest \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"data_path\": \".\u002Fmy_documents\"}'\n\n# 导入 GitHub 仓库\ncurl -X POST http:\u002F\u002Flocalhost:8000\u002Fingest \\\n  -H \"Content-Type: application\u002Fjson\" \\\n  -d '{\"github_url\": \"https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\", \"github_branch\": \"main\"}'\n\n# 直接上传文件（multipart）\ncurl -X POST http:\u002F\u002Flocalhost:8000\u002Fingest\u002Fupload \\\n  -F \"files=@.\u002Frapport.pdf\" \\\n  -F \"files=@.\u002Fnotes.txt\"\n\n# 列出集合\ncurl http:\u002F\u002Flocalhost:8000\u002Fcollections\n```\n\n### 通过环境变量配置\n\n所有服务器设置都从 `RAGLIGHT_*` 环境变量中读取。将 `examples\u002Fserve_example\u002F.env.example` 复制到 `.env` 文件中，并根据需要调整值。\n\n| 变量                       | 默认值                  | 描述                                                                |\n| ------------------------------ | ------------------------ | -------------------------------------------------------------------------- |\n| `RAGLIGHT_LLM_MODEL`           | `llama3`                 | LLM 模型名称                                                             |\n| `RAGLIGHT_LLM_PROVIDER`        | `Ollama`                 | LLM 提供商（`Ollama`、`Mistral`、`OpenAI`、`LmStudio`、`GoogleGemini`）   |\n| `RAGLIGHT_LLM_API_BASE`        | `http:\u002F\u002Flocalhost:11434` | LLM API 基础 URL                                                           |\n| `RAGLIGHT_EMBEDDINGS_MODEL`    | `all-MiniLM-L6-v2`       | 嵌入模型名称                                                      |\n| `RAGLIGHT_EMBEDDINGS_PROVIDER` | `HuggingFace`            | 嵌入提供商（`HuggingFace`、`Ollama`、`OpenAI`、`GoogleGemini`）    |\n| `RAGLIGHT_EMBEDDINGS_API_BASE` | `http:\u002F\u002Flocalhost:11434` | 嵌入 API 基础 URL                                                    |\n| `RAGLIGHT_DB`                  | `Chroma`                 | 向量存储后端（`Chroma` 或 `Qdrant`）                                |\n| `RAGLIGHT_PERSIST_DIR`         | `.\u002Fraglight_db`          | 本地持久化目录（当未设置 `RAGLIGHT_DB_HOST` 时使用）      |\n| `RAGLIGHT_COLLECTION`          | `default`                | 集合名称                                                            |\n| `RAGLIGHT_K`                   | `5`                      | 每次查询检索的文档数量                                    |\n| `RAGLIGHT_SYSTEM_PROMPT`       | _(默认提示)_       | LLM 的自定义系统提示                                           |\n| `RAGLIGHT_DB_HOST`             | —                        | 远程向量存储主机（留空则使用本地磁盘存储）                           |\n| `RAGLIGHT_DB_PORT`             | —                        | 远程向量存储端口                                                   |\n| `RAGLIGHT_API_TIMEOUT`         | `300`                    | Streamlit UI 的请求超时时间（秒）（对于速度较慢的模型可适当增加） |\n\n### 使用 Docker Compose 部署\n\n在生产环境中快速部署的方法：\n\n```bash\ncd examples\u002Fserve_example\ncp .env.example .env   # 根据需要编辑值\ndocker-compose up\n```\n\n`docker-compose.yml` 文件使用了 `extra_hosts: host.docker.internal:host-gateway`，以便容器能够访问宿主机上运行的 Ollama 实例。\n\n---\n\n## 环境变量\n\n你可以设置多个环境变量来更改 **RAGLight** 的配置：\n\n**提供商凭据及 URLs**\n\n- 如果你想使用 Mistral API，可以设置 `MISTRAL_API_KEY`。\n- 如果你有自定义的 Ollama URL，可以设置 `OLLAMA_CLIENT_URL`。\n- 如果你有自定义的 LMStudio URL，可以设置 `LMSTUDIO_CLIENT`。\n- 如果你有自定义的 OpenAI URL 或 vLLM URL，可以设置 `OPENAI_CLIENT_URL`。\n- 如果你需要 OpenAI 密钥，可以设置 `OPENAI_API_KEY`。\n- 如果你需要 Google Gemini API 密钥，可以设置 `GEMINI_API_KEY`。\n- 对于 AWS Bedrock，可以设置 `AWS_ACCESS_KEY_ID`、`AWS_SECRET_ACCESS_KEY` 和 `AWS_DEFAULT_REGION`（或者使用 `~\u002F.aws\u002Fcredentials` 文件或 IAM 角色）。\n\n**REST API 服务器 (`raglight serve`)**\n\n完整列表请参见上方的 [通过环境变量配置](#configuration-via-environment-variables) 部分。\n\n## 提供商与数据库\n\n### LLM\n\n对于 LLM 推理，你可以使用以下提供商：\n\n- LMStudio (`Settings.LMSTUDIO`)\n- Ollama (`Settings.OLLAMA`)\n- Mistral API (`Settings.MISTRAL`)\n- vLLM (`Settings.VLLM`)\n- OpenAI (`Settings.OPENAI`)\n- Google Gemini (`Settings.GOOGLE_GEMINI`)\n- AWS Bedrock (`Settings.AWS_BEDROCK`)\n\n### 嵌入\n\n对于嵌入模型，你可以使用以下提供商：\n\n- Huggingface (`Settings.HUGGINGFACE`)\n- Ollama (`Settings.OLLAMA`)\n- vLLM (`Settings.VLLM`)\n- OpenAI (`Settings.OPENAI`)\n- Google Gemini (`Settings.GOOGLE_GEMINI`)\n- AWS Bedrock (`Settings.AWS_BEDROCK`)\n\n### 向量存储\n\n对于向量存储，你可以使用：\n\n| 提供商     | 常量          | 其他              | Windows（无 C++）             |\n| -------- | ----------------- | ------------------ | ---------------------------- |\n| ChromaDB | `Settings.CHROMA` | `raglight[chroma]` | 否 — 需要 C++ 编译器       |\n| Qdrant   | `Settings.QDRANT` | `raglight[qdrant]` | 是 — 纯 Python 客户端     |\n\n两者都支持本地（磁盘）和远程（HTTP）模式。\n\n## 快速入门 🚀\n\n### 知识库\n\n知识库是一种在 RAG 初始化过程中将数据导入向量存储的方式。当你调用 `build` 函数时，就会进行数据导入：\n\n```python\nfrom raglight import RAGPipeline\npipeline = RAGPipeline(knowledge_base=[\n    FolderSource(path=\"\u003C你的 PDF 文件夹路径>\u002Fknowledge_base\"),\n    GitHubSource(url=\"https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\")\n    ],\n    model_name=\"llama3\",\n    provider=Settings.OLLAMA,\n    k=5)\n\npipeline.build()\n```\n\n你可以定义两种不同的知识库：\n\n1. 文件夹知识库\n\n该目录下的所有文件\u002F文件夹都会被导入到向量存储中：\n\n```python\nfrom raglight import FolderSource\nFolderSource(path=\"\u003C你的 PDF 文件夹路径>\u002Fknowledge_base\"),\n```\n\n2. GitHub 知识库\n\n你可以声明想要存储到向量存储中的 GitHub 仓库：\n\n```python\nfrom raglight import GitHubSource\nGitHubSource(url=\"https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\")\n```\n\n### RAG\n\n您可以使用 RAGLight 轻松设置您的 RAG：\n\n```python\nfrom raglight.rag.simple_rag_api import RAGPipeline\nfrom raglight.models.data_source_model import FolderSource, GitHubSource\nfrom raglight.config.settings import Settings\nfrom raglight.config.rag_config import RAGConfig\nfrom raglight.config.vector_store_config import VectorStoreConfig\n\nSettings.setup_logging()\n\nknowledge_base=[\n    FolderSource(path=\"\u003C您包含 PDF 文件的文件夹路径>\u002Fknowledge_base\"),\n    GitHubSource(url=\"https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\")\n    ]\n\nvector_store_config = VectorStoreConfig(\n    embedding_model = Settings.DEFAULT_EMBEDDINGS_MODEL,\n    api_base = Settings.DEFAULT_OLLAMA_CLIENT,\n    provider=Settings.HUGGINGFACE,\n    database=Settings.CHROMA,\n    persist_directory = '.\u002FdefaultDb',\n    collection_name = Settings.DEFAULT_COLLECTION_NAME\n)\n\nconfig = RAGConfig(\n        llm = Settings.DEFAULT_LLM,\n        provider = Settings.OLLAMA,\n        # k = Settings.DEFAULT_K,\n        # cross_encoder_model = Settings.DEFAULT_CROSS_ENCODER_MODEL,\n        # system_prompt = Settings.DEFAULT_SYSTEM_PROMPT,\n        # knowledge_base = knowledge_base\n    )\n\npipeline = RAGPipeline(config, vector_store_config)\n\npipeline.build()\n\nresponse = pipeline.generate(\"如何使用 raglight 框架创建一个简单的 RAGPipeline？请提供 Python 实现\")\nprint(response)\n```\n\n您只需填写想要使用的模型即可。\n\n> ⚠️\n> 默认情况下，LLM 提供商会是 Ollama。\n\n### 代理式 RAG\n\n此管道通过引入一个额外的代理来扩展检索增强生成（RAG）的概念。该代理可以从您的向量存储中检索数据。\n\n您可以在配置中修改多个参数：\n\n- `provider`：您的 LLM 提供商（Ollama、LMStudio、Mistral）\n- `model`：您想要使用的模型\n- `k`：您将检索的文档数量\n- `max_steps`：代理使用的最大反思步骤数\n- `api_key`：您的 Mistral API 密钥\n- `api_base`：您的 API URL（Ollama URL、LM Studio URL 等）\n- `num_ctx`：您的上下文最大长度\n- `verbosity_level`：日志的详细级别\n- `ignore_folders`：索引过程中要排除的文件夹列表（例如，[\".venv\", \"node_modules\", \"**pycache**\" ]）\n\n```python\nfrom raglight.config.settings import Settings\nfrom raglight.rag.simple_agentic_rag_api import AgenticRAGPipeline\nfrom raglight.config.agentic_rag_config import AgenticRAGConfig\nfrom raglight.config.vector_store_config import VectorStoreConfig\nfrom raglight.config.settings import Settings\nfrom dotenv import load_dotenv\n\nload_dotenv()\nSettings.setup_logging()\n\npersist_directory = '.\u002FdefaultDb'\nmodel_embeddings = Settings.DEFAULT_EMBEDDINGS_MODEL\ncollection_name = Settings.DEFAULT_COLLECTION_NAME\n\nvector_store_config = VectorStoreConfig(\n    embedding_model = model_embeddings,\n    api_base = Settings.DEFAULT_OLLAMA_CLIENT,\n    database=Settings.CHROMA,\n    persist_directory = persist_directory,\n    # host='localhost',\n    # port='8001',\n    provider = Settings.HUGGINGFACE,\n    collection_name = collection_name\n)\n\n# 自定义忽略文件夹 - 您可以覆盖默认列表\ncustom_ignore_folders = [\n    \".venv\",\n    \"venv\",\n    \"node_modules\",\n    \"__pycache__\",\n    \".git\",\n    \"build\",\n    \"dist\",\n    \"my_custom_folder_to_ignore\"  # 在此处添加您自定义的文件夹\n]\n\nconfig = AgenticRAGConfig(\n            provider = Settings.MISTRAL,\n            model = \"mistral-large-2411\",\n            k = 10,\n            system_prompt = Settings.DEFAULT_AGENT_PROMPT,\n            max_steps = 4,\n            api_key = Settings.MISTRAL_API_KEY, # os.environ.get('MISTRAL_API_KEY')\n            ignore_folders = custom_ignore_folders,  # 使用自定义的忽略文件夹\n            # api_base = ... # 如果您有自定义的客户端 URL\n            # num_ctx = ... # 最大上下文长度\n            # verbosity_level = ... # 默认 = 2\n            # knowledge_base = knowledge_base\n        )\n\nagenticRag = AgenticRAGPipeline(config, vector_store_config)\nagenticRag.build()\n\nresponse = agenticRag.generate(\"请为我实现一个受 RAGPipeline 和 AgenticRAG 及 RAG 启发的 AgenticRAGPipeline\")\n\nprint('response : ', response)\n```\n\n### MCP 集成\n\nRAGLight 支持 MCP 服务器集成，以增强您的代理的推理能力。MCP 允许代理通过标准化的服务器接口与外部工具（例如代码执行环境、数据库工具或搜索代理）进行交互。\n\n要使用 MCP，只需将 mcp_config 参数传递给您的 AgenticRAGConfig，其中每个配置都定义了 MCP 服务器的 URL（以及可选的传输方式）。\n\n只需将此参数添加到您的 AgenticRAGPipeline 中：\n\n```python\nconfig = AgenticRAGConfig(\n    provider = Settings.OPENAI,\n    model = \"gpt-4o\",\n    k = 10,\n    mcp_config = [\n        {\"url\": \"http:\u002F\u002F127.0.0.1:8001\u002Fsse\"}  # 您的 MCP 服务器 URL\n    ],\n    ...\n)\n```\n\n> 📚 文档：了解如何使用 [MCPClient.server_parameters](https:\u002F\u002Fhuggingface.co\u002Fdocs\u002Fsmolagents\u002Fen\u002Freference\u002Ftools#smolagents.MCPClient.server_parameters) 配置并启动 MCP 服务器。\n\n### 使用自定义管道\n\n**1. 配置您的管道**\n\n您也可以设置自己的管道：\n\n```python\nfrom raglight.rag.builder import Builder\nfrom raglight.config.settings import Settings\n\nrag = Builder() \\\n    .with_embeddings(Settings.HUGGINGFACE, model_name=model_embeddings) \\\n    .with_vector_store(Settings.CHROMA, persist_directory=persist_directory, collection_name=collection_name) \\\n    .with_llm(Settings.OLLAMA, model_name=model_name, system_prompt_file=system_prompt_directory, provider=Settings.LMStudio) \\\n    .build_rag(k = 5)\n```\n\n**2. 将文档摄入您的向量存储**\n\n然后您可以将数据摄入您的向量存储。\n\n1. 您可以使用默认管道来摄入非代码数据：\n\n```python\nrag.vector_store.ingest(data_path='.\u002Fdata')\n```\n\n2. 或者您可以使用代码管道：\n\n```python\nrag.vector_store.ingest(repos_path=['.\u002Frepository1', '.\u002Frepository2'])\n```\n\n此管道会将代码嵌入摄入到您的集合中：**collection_name**。但此管道还会从您的代码库中提取所有签名，并将其摄入到：**collection_name_classes**。\n\n您可以在 `VectorStore` 类中访问两个不同的函数：`similarity_search` 和 `similarity_search_class`，用于在不同的集合中进行搜索。\n\n**3. 查询管道**\n\n使用 RAG 管道检索并生成答案：\n\n```python\nresponse = rag.generate(\"我该如何优化我的马拉松训练？\")\nprint(response)\n```\n\n> ### ✚ 更多示例\n>\n> 您可以在 [examples](https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\u002Fblob\u002Fmain\u002Fexamples) 目录中找到所有这些用例的更多示例。\n\n### 覆盖默认处理器\n\nRAGLight 内置了基于文件扩展名的文档处理器：\n\n- `pdf` → `PDFProcessor`\n- `py`、`js`、`ts`、`java`、`cpp`、`cs` → `CodeProcessor`\n- `txt`、`md`、`html` → `TextProcessor`\n\n您可以在构建向量存储时，使用 `custom_processors` 参数覆盖这些默认设置。这在需要对某些文件类型应用自定义逻辑时特别有用，例如对于包含图表和图像的 PDF 文件，可以使用 **视觉语言模型（VLM）** 进行处理。RAGLight 也提供了基于 VLM 的处理器。\n\n#### 在构建器中注册自定义处理器\n\n```python\nfrom raglight.document_processing.vlm_pdf_processor import VlmPDFProcessor\nfrom raglight.llm.ollama_model import OllamaModel\nfrom raglight.rag.builder import Builder\nfrom raglight.config.settings import Settings\n\nfrom dotenv import load_dotenv\nimport os\n\nload_dotenv()\nSettings.setup_logging()\n\npersist_directory = '.\u002FdefaultDb'\nmodel_embeddings = Settings.DEFAULT_EMBEDDINGS_MODEL\ncollection_name = Settings.DEFAULT_COLLECTION_NAME\ndata_path = os.environ.get('DATA_PATH')\n\n# 视觉语言模型（以 Ollama 为例）\nvlm = OllamaModel(\n    model_name=\"ministral-3:3b\",\n    system_prompt=\"You are a technical documentation visual assistant.\",\n)\n\ncustom_processors = {\n    \"pdf\": VlmPDFProcessor(vlm),  # 覆盖默认的 PDF 处理器\n}\n\nvector_store = Builder() \\\n    .with_embeddings(Settings.HUGGINGFACE, model_name=model_embeddings) \\\n    .with_vector_store(\n        Settings.CHROMA,\n        persist_directory=persist_directory,\n        collection_name=collection_name,\n        custom_processors=custom_processors,\n    ) \\\n    .build_vector_store()\n\nvector_store.ingest(data_path=data_path)\n```\n\n通过这种配置，所有 `.pdf` 文件都将由您自定义的 `VlmPDFProcessor` 处理，而其他类型的文件则继续使用默认处理器。\n\n### 混合检索（BM25 + 语义 + RRF）🔍\n\nRAGLight 支持三种检索策略，可通过 `search_type` 参数进行配置。同时支持 **Chroma** 和 **Qdrant** 后端。\n\n| 模式         | 描述                                              |\n| ------------ | -------------------------------------------------------- |\n| `\"semantic\"` | 密集向量相似度检索（默认）                 |\n| `\"bm25\"`     | 基于关键词的 BM25 检索                                |\n| `\"hybrid\"`   | BM25 与语义检索结合，使用倒数排名融合（RRF） |\n\n#### 使用构建器 API\n\n```python\nfrom raglight.rag.builder import Builder\nfrom raglight.config.settings import Settings\n\n# 可用于 Settings.CHROMA 或 Settings.QDRANT\nrag = (\n    Builder()\n    .with_embeddings(Settings.HUGGINGFACE, model_name=\"all-MiniLM-L6-v2\")\n    .with_vector_store(\n        Settings.QDRANT,                     # 或 Settings.CHROMA\n        persist_directory=\".\u002FmyDb\",\n        collection_name=\"my_collection\",\n        search_type=Settings.SEARCH_HYBRID,  # \"semantic\" | \"bm25\" | \"hybrid\"\n        alpha=0.5,                           # RRF 中语义与 BM25 的权重\n    )\n    .with_llm(Settings.OLLAMA, model_name=\"llama3.1:8b\")\n    .build_rag(k=5)\n)\n\nrag.vector_store.ingest(data_path=\".\u002Fdocs\")\nresponse = rag.generate(\"What is Reciprocal Rank Fusion?\")\nprint(response)\n```\n\n#### 使用高级 RAGPipeline API\n\n```python\nfrom raglight.rag.simple_rag_api import RAGPipeline\nfrom raglight.config.rag_config import RAGConfig\nfrom raglight.config.vector_store_config import VectorStoreConfig\nfrom raglight.config.settings import Settings\nfrom raglight.models.data_source_model import FolderSource\n\nvector_store_config = VectorStoreConfig(\n    embedding_model=Settings.DEFAULT_EMBEDDINGS_MODEL,\n    provider=Settings.HUGGINGFACE,\n    database=Settings.CHROMA,\n    persist_directory=\".\u002FmyDb\",\n    collection_name=\"my_collection\",\n    search_type=Settings.SEARCH_HYBRID,   # 或 SEARCH_SEMANTIC \u002F SEARCH_BM25\n    hybrid_alpha=0.5,\n)\n\nconfig = RAGConfig(\n    llm=\"llama3.1:8b\",\n    provider=Settings.OLLAMA,\n    k=5,\n    knowledge_base=[FolderSource(path=\".\u002Fdocs\")],\n)\n\npipeline = RAGPipeline(config, vector_store_config)\npipeline.build()\nresponse = pipeline.generate(\"Explain the retrieval pipeline\")\nprint(response)\n```\n\n> **RRF 的工作原理**：每种检索模式都会返回各自的文档排序列表。RRF 会为每个列表中的文档分配一个分数 `1 \u002F (k + rank)`，并将这些分数相加——在两个列表中都排名靠前的文档会被优先提升，而仅出现在其中一个列表中的文档则会被保留，但排名会较低。这种方式使混合模式比单独使用任一模式都能获得更好的召回率和精确率。\n\n> 完整示例请参见 [examples\u002Fhybrid_search_example.py](examples\u002Fhybrid_search_example.py)。\n\n---\n\n### Qdrant 向量存储 🗄️\n\nQdrant 是 ChromaDB 的纯 Python 替代方案——**无需 C++ 编译器**，因此在 Windows 系统上是推荐的选择。\n\n```bash\npip install \"raglight[qdrant]\"\n```\n\n#### 本地模式（磁盘存储，无需服务器）\n\n```python\nimport uuid\nfrom raglight.rag.builder import Builder\nfrom raglight.config.settings import Settings\n\nrag = (\n    Builder()\n    .with_embeddings(Settings.HUGGINGFACE, model_name=\"all-MiniLM-L6-v2\")\n    .with_vector_store(\n        Settings.QDRANT,\n        persist_directory=\".\u002FqdrantDb\",\n        collection_name=str(uuid.uuid4()),\n    )\n    .with_llm(Settings.OLLAMA, model_name=\"llama3.1:8b\")\n    .build_rag(k=5)\n)\n\nrag.vector_store.ingest(data_path=\".\u002Fdocs\")\nresponse = rag.generate(\"What is RAGLight?\")\nprint(response)\n```\n\n#### 远程模式（Qdrant 服务器）\n\n使用 Docker 启动 Qdrant 服务器：\n\n```bash\ndocker run -p 6333:6333 qdrant\u002Fqdrant\n```\n\n然后将构建器指向该服务器：\n\n```python\nrag = (\n    Builder()\n    .with_embeddings(Settings.HUGGINGFACE, model_name=\"all-MiniLM-L6-v2\")\n    .with_vector_store(\n        Settings.QDRANT,\n        host=\"localhost\",\n        port=6333,\n        collection_name=\"my_collection\",\n    )\n    .with_llm(Settings.OLLAMA, model_name=\"llama3.1:8b\")\n    .build_rag(k=5)\n)\n```\n\n> 完整示例请参见 [examples\u002Fqdrant_example.py](examples\u002Fqdrant_example.py)。\n\n---\n\n### 查询改写 ✍️\n\nRAGLight 会在检索之前自动将后续问题改写成独立的查询。这在多轮对话中显著提高了准确性，尤其是在用户的问题引用了之前的上下文时（例如 _\"and for Python?\"_ → _\"How do I do X in Python?\"_）。\n\n查询改写功能 **默认启用**。当前使用的 LLM 会用来改写问题；如果尚未有对话历史，则问题会保持不变传递下去。\n\n#### 使用高级 RAGPipeline API\n\n```python\nfrom raglight.config.rag_config import RAGConfig\nfrom raglight.config.settings import Settings\n\n# 默认启用\nconfig = RAGConfig(\n    llm=Settings.DEFAULT_LLM,\n    provider=Settings.OLLAMA,\n)\n\n# 如需禁用\nconfig = RAGConfig(\n    llm=Settings.DEFAULT_LLM,\n    provider=Settings.OLLAMA,\n    reformulation=False,\n)\n```\n\n#### 使用构建器 API\n\n```python\nfrom raglight.rag.builder import Builder\nfrom raglight.config.settings import Settings\n\nrag = (\n    Builder()\n    .with_embeddings(Settings.HUGGINGFACE, model_name=\"all-MiniLM-L6-v2\")\n    .with_vector_store(Settings.CHROMA, persist_directory=\".\u002FmyDb\", collection_name=\"my_collection\")\n    .with_llm(Settings.OLLAMA, model_name=\"llama3.1:8b\")\n    .build_rag(k=5, reformulation=True)  # 默认为 True\n)\n```\n\n经过改写的查询会在 `INFO` 级别被记录，以便您可以检查 LLM 的输出内容。\n\n**启用改写功能的管道流程：**\n\n```\n改写 → 检索 → [重排序？] → 生成\n```\n\n---\n\n### 流式输出 ⚡\n\n所有提供商都支持通过 `generate_streaming()` 进行逐 token 流式输出。它会运行完整的管道（改写 → 检索 → 重排序），并在 LLM 产生答案片段时将其逐步返回。\n\n#### 使用 RAGPipeline\n\n```python\npipeline = RAGPipeline(config, vector_store_config)\npipeline.build()\n\nfor chunk in pipeline.generate_streaming(\"RAGLight 是如何工作的？\"):\n    print(chunk, end=\"\", flush=True)\nprint()\n```\n\n#### 使用构建器 API\n\n```python\nrag = (\n    Builder()\n    .with_embeddings(Settings.HUGGINGFACE, model_name=\"all-MiniLM-L6-v2\")\n    .with_vector_store(Settings.CHROMA, persist_directory=\".\u002FmyDb\", collection_name=\"col\")\n    .with_llm(Settings.OLLAMA, model_name=\"llama3.1:8b\")\n    .build_rag(k=5)\n)\n\nfor chunk in rag.generate_streaming(\"请解释检索流程\")：\n    print(chunk，end=\"\"，flush=True)\nprint()\n```\n\n所有提供商均支持流式输出：**Ollama**、**OpenAI**、**vLLM**、**LMStudio**、**Mistral**、**Google Gemini** 和 **AWS Bedrock**。流式传输结束时，对话历史会自动更新。\n\n---\n\n### 对话历史 💬\n\nRAGLight 会自动在多次调用 `generate()` 之间维护对话历史。每一轮都会将用户和助手的消息追加到下一次调用传递给 LLM 的消息中，从而实现真正的多轮对话，且适用于**所有提供商**。\n\n默认情况下，对话历史上限为 **20 条消息**（约 10 轮）。您可以通过 `max_history` 参数调整此限制，或将该参数设置为 `None` 以取消限制：\n\n```python\n# 通过 RAGConfig（高级 API）\nconfig = RAGConfig(\n    llm=Settings.DEFAULT_LLM,\n    provider=Settings.OLLAMA,\n    max_history=20,  # 保留最近 20 条消息（约 10 轮）\n)\n\n# 通过 Builder\nrag = (\n    Builder()\n    .with_embeddings(Settings.HUGGINGFACE，model_name=\"all-MiniLM-L6-v2\")\n    .with_vector_store(Settings.CHROMA，persist_directory=\".\u002FmyDb\"，collection_name=\"col\")\n    .with_llm(Settings.OLLAMA，model_name=\"llama3.1:8b\")\n    .build_rag(k=5，max_history=20)\n)\n```\n\n> **提示**：将 `max_history` 设置为您希望保留的轮数的大致两倍（每轮包含两条消息）。\n\n---\n\n### AWS Bedrock ☁️\n\nRAGLight 支持使用 AWS Bedrock 进行 LLM 推理和嵌入计算。身份验证依赖于标准的 boto3 凭证链（环境变量、`~\u002F.aws\u002Fcredentials` 文件或 IAM 角色）。\n\n**AWS 凭证（三者之一）：**\n\n- 环境变量：`AWS_ACCESS_KEY_ID`、`AWS_SECRET_ACCESS_KEY`、`AWS_DEFAULT_REGION`\n- AWS 凭证文件：`~\u002F.aws\u002Fcredentials`\n- IAM 角色（EC2 \u002F ECS \u002F Lambda）\n\n**支持的模型（示例）：**\n\n| 类型       | 模型 ID                                    |\n| ---------- | ------------------------------------------- |\n| LLM        | `anthropic.claude-3-5-sonnet-20241022-v2:0` |\n| LLM        | `anthropic.claude-3-haiku-20240307-v1:0`    |\n| 嵌入       | `amazon.titan-embed-text-v2:0`              |\n| 嵌入       | `cohere.embed-english-v3`                   |\n\n> **跨区域推理配置文件**：较新的 Claude 模型（Claude 3.7+、Claude 4）需要使用跨区域推理配置文件 ID，而不是单纯的模型 ID。请使用 `us.`、`eu.` 或 `ap.` 前缀——例如 `us.anthropic.claude-sonnet-4-6`。运行 `aws bedrock list-inference-profiles` 可查看您账户中可用的配置文件列表。\n\n```python\nfrom raglight.rag.simple_rag_api import RAGPipeline\nfrom raglight.config.settings import Settings\nfrom raglight.config.rag_config import RAGConfig\nfrom raglight.config.vector_store_config import VectorStoreConfig\nfrom raglight.models.data_source_model import GitHubSource\n\nSettings.setup_logging()\n\nvector_store_config = VectorStoreConfig(\n    provider=Settings.AWS_BEDROCK,\n    embedding_model=Settings.AWS_BEDROCK_EMBEDDING_MODEL,  # amazon.titan-embed-text-v2:0\n    database=Settings.CHROMA,\n    persist_directory=\".\u002FbedrockDb\",\n    collection_name=\"bedrock_collection\",\n)\n\nconfig = RAGConfig(\n    provider=Settings.AWS_BEDROCK,\n    llm=Settings.AWS_BEDROCK_LLM_MODEL,  # anthropic.claude-3-5-sonnet-20241022-v2:0\n    knowledge_base=[GitHubSource(url=\"https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\")],\n)\n\npipeline = RAGPipeline(config，vector_store_config)\npipeline.build()\nresponse = pipeline.generate(\"我该如何使用 raglight 创建一个 RAGPipeline？\")\nprint(response)\n```\n\n> 完整的工作示例请参见 [examples\u002Fbedrock_example.py](examples\u002Fbedrock_example.py)。\n\n---\n\n### 使用 Langfuse 实现可观测性\n\nRAGLight 支持 **Langfuse 4.0.0**，可全面监控您的 RAG 流程。每次调用 `generate()` 都会被记录为一条单独的 Langfuse 跟踪，并且每个 LangGraph 节点（检索、重排序、生成）都会作为独立的跨度显示。\n\n无论是 `generate()` 还是 `generate_streaming()`，都会自动在所有提供商（Ollama、OpenAI、Mistral、Gemini、LMStudio、Bedrock）上传播 Langfuse 回调。\n\n> **注意**：如果未配置 Langfuse 凭证，RAGLight 会自动将 `LANGFUSE_TRACING_ENABLED` 设置为 `false`，以防止 Langfuse v4 在启动时尝试连接到 `localhost:3000`。\n\n#### 安装额外依赖项\n\n```bash\npip install \"raglight[langfuse]\"\n\n# 或者直接：\npip install \"langfuse==4.0.0\"\n```\n\n#### 与 RAGPipeline 配合使用\n\n```python\nfrom raglight.config.rag_config import RAGConfig\nfrom raglight.config.vector_store_config import VectorStoreConfig\nfrom raglight.config.langfuse_config import LangfuseConfig\nfrom raglight.config.settings import Settings\nfrom raglight.rag.simple_rag_api import RAGPipeline\n\nlangfuse_config = LangfuseConfig(\n    public_key=\"pk-lf-...\",\n    secret_key=\"sk-lf-...\",\n    host=\"http:\u002F\u002Flocalhost:3000\",  # 或您的 Langfuse Cloud URL\n)\n\nconfig = RAGConfig(\n    llm=Settings.DEFAULT_LLM,\n    provider=Settings.OLLAMA,\n    langfuse_config=langfuse_config,\n)\n\nvector_store_config = VectorStoreConfig(\n    embedding_model=Settings.DEFAULT_EMBEDDINGS_MODEL,\n    provider=Settings.HUGGINGFACE,\n    database=Settings.CHROMA,\n    persist_directory=\".\u002FmyDb\",\n    collection_name=\"my_collection\",\n)\n\npipeline = RAGPipeline(config, vector_store_config)\npipeline.build()\nresponse = pipeline.generate(\"What is RAGLight?\")\nprint(response)\n```\n\n#### 使用 Builder API\n\n```python\nfrom raglight.rag.builder import Builder\nfrom raglight.config.langfuse_config import LangfuseConfig\nfrom raglight.config.settings import Settings\n\nlangfuse_config = LangfuseConfig(\n    public_key=\"pk-lf-...\",\n    secret_key=\"sk-lf-...\",\n    host=\"http:\u002F\u002Flocalhost:3000\",\n)\n\nrag = (\n    Builder()\n    .with_embeddings(Settings.HUGGINGFACE, model_name=Settings.DEFAULT_EMBEDDINGS_MODEL)\n    .with_vector_store(Settings.CHROMA, persist_directory=\".\u002FmyDb\", collection_name=\"my_collection\")\n    .with_llm(Settings.OLLAMA, model_name=Settings.DEFAULT_LLM)\n    .build_rag(k=5, langfuse_config=langfuse_config)\n)\n\nrag.vector_store.ingest(data_path=\".\u002Fdocs\")\nresponse = rag.generate(\"Explain the retrieval pipeline\")\nprint(response)\n```\n\n#### 会话 ID\n\n默认情况下，每个 `RAG` 实例只会生成一个 **UUID**，并在每次调用 `generate()` 时重复使用，因此同一对话的所有轮次都会被归入同一个 Langfuse 跟踪中。\n\n您可以通过 `LangfuseConfig(session_id=\"my-session-42\", ...)` 来固定自定义的会话 ID。\n\n---\n\n## 在 Docker 中使用 RAGLight\n\n您可以轻松地在 Docker 容器中使用 RAGLight。\nDockerfile 示例请参见：[examples\u002FDockerfile.example](https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\u002Fblob\u002Fmain\u002Fexamples\u002FDockerfile.example)\n\n### 构建您的镜像\n\n只需进入 **examples** 目录并运行：\n\n```bash\ndocker build -t docker-raglight -f Dockerfile.example .\n```\n\n## 运行您的镜像\n\n为了让容器能够与 Ollama 或 LMStudio 通信，您需要添加自定义的主机到 IP 映射：\n\n```bash\ndocker run --add-host=host.docker.internal:host-gateway docker-raglight\n```\n\n我们使用 `--add-host` 标志来允许 Ollama 的调用。","# RAGLight 快速上手指南\n\nRAGLight 是一个轻量级、模块化的 Python 库，用于构建检索增强生成（RAG）应用。它支持多种大语言模型（LLM）、嵌入模型和向量数据库，旨在帮助开发者快速搭建上下文感知的 AI 解决方案。\n\n## 环境准备\n\n在开始之前，请确保满足以下要求：\n\n*   **Python 版本**：建议 Python 3.9 或更高版本。\n*   **本地 LLM 服务（可选但推荐）**：若使用本地模型，需预先安装并运行 **Ollama**、**LMStudio** 或 **vLLM**。\n    *   例如使用 Ollama：确保模型已加载（如 `ollama run llama3`）。\n*   **API Key（如需云服务）**：若使用 OpenAI、Mistral、Google Gemini 或 AWS Bedrock，请准备好相应的 API Key 或配置好 AWS 凭证。\n*   **编译器（仅 Windows + ChromaDB）**：如果计划在 Windows 上使用 ChromaDB 向量库，需要安装 C++ 编译工具链；或者选择无需编译器的 Qdrant。\n\n## 安装步骤\n\n### 1. 安装基础库\n\n使用 pip 安装核心功能：\n\n```bash\npip install raglight\n```\n\n> **国内加速建议**：如遇下载缓慢，可使用清华或阿里镜像源：\n> ```bash\n> pip install raglight -i https:\u002F\u002Fpypi.tuna.tsinghua.edu.cn\u002Fsimple\n> ```\n\n### 2. 安装向量数据库扩展（可选）\n\nRAGLight 采用按需安装策略，根据你选择的向量后端安装额外依赖：\n\n*   **推荐方案（Qdrant，纯 Python，Windows 友好）**：\n    ```bash\n    pip install \"raglight[qdrant]\"\n    ```\n*   **ChromaDB 方案**（Windows 需 C++ 编译器）：\n    ```bash\n    pip install \"raglight[chroma]\"\n    ```\n*   **可观测性方案**（集成 Langfuse）：\n    ```bash\n    pip install \"raglight[qdrant,langfuse]\"\n    ```\n\n## 基本使用\n\nRAGLight 提供了两种极速启动方式：命令行交互向导（无需写代码）和 REST API 部署。\n\n### 方式一：命令行交互向导（最快上手）\n\n这是最简单的入门方式。RAGLight 会引导你选择文档文件夹、配置模型并直接开始对话。\n\n1.  确保本地 LLM 服务（如 Ollama）正在运行。\n2.  在终端执行以下命令：\n\n```bash\nraglight chat\n```\n\n若需体验智能体增强版 RAG，可运行：\n\n```bash\nraglight agentic-chat\n```\n\n**向导流程说明：**\n*   📂 **数据源**：输入包含文档（PDF, TXT, Code 等）的本地文件夹路径。\n*   🚫 **忽略文件夹**：自动排除 `.venv`, `node_modules`, `__pycache__` 等无关目录（支持自定义）。\n*   💾 **向量库**：选择存储位置和名称。\n*   🧠 **嵌入模型** & 🤖 **LLM**：选择用于理解文档和生成回答的模型。\n\n配置完成后，系统将自动索引文档并开启聊天会话。\n\n### 方式二：部署为 REST API 服务\n\n你可以一键启动一个带有 Swagger 文档和 Streamlit 聊天界面的 FastAPI 服务器，完全通过环境变量配置，无需编写 Python 代码。\n\n**启动命令：**\n\n```bash\nraglight serve --ui\n```\n\n**常用参数：**\n*   `--port`：API 端口（默认 8000）\n*   `--ui-port`：聊天界面端口（默认 8501）\n*   `--reload`：开发模式下自动重载\n\n**示例：指定模型并启动服务**\n\n```bash\nRAGLIGHT_LLM_MODEL=mistral-small-latest \\\nRAGLIGHT_LLM_PROVIDER=Mistral \\\nraglight serve --port 8080 --ui\n```\n\n启动后访问：\n*   **REST API & 文档**: `http:\u002F\u002Flocalhost:8000` (Swagger UI 位于 `\u002Fdocs`)\n*   **Web 聊天界面**: `http:\u002F\u002Flocalhost:8501`\n\n在 Web 界面中，你可以直接上传文件、切换模型并进行多轮对话。","某金融科技公司的研发团队需要构建一个内部智能助手，让分析师能直接通过自然语言查询海量的合规文档、财报 PDF 及实时市场数据。\n\n### 没有 RAGLight 时\n- **模型切换成本极高**：团队若想从本地 Ollama 模型迁移到 AWS Bedrock 以处理敏感数据，必须重写大量底层连接代码，耗时数天。\n- **检索精度不足**：仅依赖单一的语义向量搜索，经常无法准确匹配包含特定专业术语（如“巴塞尔协议 III\"）的文档片段，导致回答幻觉严重。\n- **数据源孤立**：系统只能读取静态文档，无法调用外部 SQL 数据库获取实时交易数据，用户需手动切换多个工具拼凑信息。\n- **部署流程繁琐**：缺乏标准化的 API 服务接口，每次更新知识库或调整参数都需要重新打包容器，运维负担重。\n\n### 使用 RAGLight 后\n- **无缝切换模型**：利用 RAGLight 的模块化架构，开发人员仅需修改配置文件即可在 Ollama、OpenAI 或 AWS Bedrock 之间自由切换，无需改动核心逻辑。\n- **混合搜索提升准确率**：启用内置的“混合搜索（BM25 + 语义+RRF）”功能，既保留了关键词匹配的精确性，又兼顾了语义理解，大幅减少错误引用。\n- **MCP 集成打破数据孤岛**：通过 MCP 插件机制，轻松接入外部数据库和代码执行工具，助手能直接查询实时行情并生成分析图表。\n- **一键部署服务**：使用 `raglight serve` 命令快速将系统发布为 REST API，并自带聊天 UI，配合 Docker Compose 实现分钟级上线与弹性扩容。\n\nRAGLight 通过其高度模块化设计和原生 MCP 支持，将原本复杂的定制化 RAG 开发周期从数周缩短至数小时，同时显著提升了回答的准确性与实时性。","https:\u002F\u002Foss.gittoolsai.com\u002Fimages\u002FBessouat40_RAGLight_2f497fd9.png","Bessouat40",null,"https:\u002F\u002Foss.gittoolsai.com\u002Favatars\u002FBessouat40_6d02c8d6.png","Software Engineer","France","https:\u002F\u002Frbessouat.fr\u002F","https:\u002F\u002Fgithub.com\u002FBessouat40",[80,84],{"name":81,"color":82,"percentage":83},"Python","#3572A5",99.9,{"name":85,"color":86,"percentage":87},"Makefile","#427819",0.1,657,100,"2026-04-08T21:04:23","MIT","Linux, macOS, Windows","未说明 (取决于所选 LLM 提供商，如使用本地 Ollama\u002FvLLM 则需相应 GPU，使用云端 API 则无需)","未说明",{"notes":96,"python":94,"dependencies":97},"1. 支持多种 LLM 提供商（Ollama, Google Gemini, LMStudio, vLLM, OpenAI, Mistral, AWS Bedrock），若使用 LMStudio 需预先加载模型，若使用 AWS Bedrock 需配置凭证。2. 在 Windows 上安装 ChromaDB 额外依赖时需要 C++ 编译器，而 Qdrant 为纯 Python 实现无需编译器。3. 可通过环境变量完全配置服务，支持 Docker 部署。4. 默认会自动忽略虚拟环境、node_modules 等常见文件夹。",[98,99,100,101,102],"chromadb (可选)","qdrant-client (可选)","langfuse (可选)","FastAPI","Streamlit",[15,13,35,14,16,52,104],"其他",[106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124],"data-science","framework","huggingface","ollama","retrieval-augmented-generation","vector-database","artificial-intelligence","rag","lmstudio","retrieval-augmented","agentic-rag","mistral-api","mistralai","agentic-ai","agentic-workflow","openai","openai-api","mcp","mcp-tools","2026-03-27T02:49:30.150509","2026-04-09T15:48:06.494766",[],[129,134,139,144,149,154,159,164,169,174,179,184,189,194,199,204,209,214,219,224],{"id":130,"version":131,"summary_zh":132,"released_at":133},171539,"3.4.7","## 变更内容\n* @Bessouat40 在 https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\u002Fpull\u002F138 中为所有大模型提供商添加了流式传输支持\n* 添加 Bedrock 提供商\n* @Bessouat40 在 https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\u002Fpull\u002F139 中为 RAG 流水线、流式传输、文档处理器和爬虫添加了测试\n* @Bessouat40 在 https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\u002Fpull\u002F141 中添加了 Qdrant 向量存储，并增加了一些测试\n* @Bessouat40 在 https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\u002Fpull\u002F142 中修复了 Qdrant 混合搜索功能\n* @Bessouat40 在 https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\u002Fpull\u002F143 中修复了 LangFuse 集成","2026-03-24T15:38:42",{"id":135,"version":136,"summary_zh":137,"released_at":138},171540,"3.2.0","## 变更内容\n* 由 @Bessouat40 在 https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\u002Fpull\u002F131 中进行的界面优化\n* 由 @Bessouat40 在 https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\u002Fpull\u002F133 中添加的重述功能\n* 由 @Bessouat40 在 https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\u002Fpull\u002F134 中改进的历史记录管理功能\n\n\n**完整变更日志**: https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\u002Fcompare\u002F3.1.1...3.2.0","2026-03-12T23:33:23",{"id":140,"version":141,"summary_zh":142,"released_at":143},171541,"3.1.1","修复 CLI 错误","2026-03-05T15:49:11",{"id":145,"version":146,"summary_zh":147,"released_at":148},171542,"3.1.0","## 新增\r\n\r\n- `raglight serve --ui` — 在启动 REST API 的同时，还会启动一个 Streamlit 聊天界面\r\n  - `--ui-port` 选项用于配置 Streamlit 的端口（默认：`8501`）\r\n  - 聊天标签页支持完整的对话历史记录，并可渲染 Markdown 格式\r\n  - 上传标签页允许用户直接从浏览器上传文件或指定服务器端目录\r\n  - 两个进程共享同一份配置，并在按下 Ctrl+C 时同时关闭","2026-03-05T11:17:24",{"id":150,"version":151,"summary_zh":152,"released_at":153},171543,"3.0.0","# 新特性                                                                                                                                                                                                            \r\n                                                                                                                                                                                                            \r\n ## REST API 服务器（https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\u002Fpull\u002F126）                                                                                                                                         \r\n  - 新增 `raglight serve` CLI 命令，无需编写任何 Python 代码即可将 RAG 流水线部署为 REST API                                                                                                   \r\n  - 基于 FastAPI 构建，自动提供 Swagger UI 文档，访问地址为 `\u002Fdocs`。\r\n  - 完全可通过 `RAGLIGHT_*` 环境变量进行配置（LLM 提供者、嵌入模型、向量存储等）。\r\n  - 提供以下 API 端点：`GET \u002Fhealth`、`POST \u002Fgenerate`、`POST \u002Fingest`、`POST \u002Fingest\u002Fupload`、`GET \u002Fcollections`。\r\n  - 支持通过 multipart form-data 进行文件上传。\r\n  - 提供 Docker Compose 示例，实现一键部署。\r\n\r\n ## 混合检索（https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\u002Fpull\u002F127）\r\n  - 新增混合检索功能，结合 BM25（关键词搜索）与语义检索（向量搜索）。\r\n  - 在稀疏或技术性文档场景下，能够有效提升检索质量，弥补纯向量检索的不足。\r\n  - 可通过 Builder API 和 `RAGConfig` 进行配置。","2026-03-04T16:35:44",{"id":155,"version":156,"summary_zh":157,"released_at":158},171544,"2.10.1","# 更新依赖项\r\n\r\n移除 smolagents 依赖。","2026-01-12T19:08:15",{"id":160,"version":161,"summary_zh":162,"released_at":163},171545,"2.10.0","# v2.10.0\n\n## 变更内容\n\n- **[破坏性变更]** 移除旧的 RAT 功能\n- **[新功能]** 现在在使用 RAGLight 的命令行工具时，可以添加一个或多个 GitHub 仓库作为知识源。你也可以通过该框架与你喜欢的仓库进行对话。","2026-01-11T18:17:13",{"id":165,"version":166,"summary_zh":167,"released_at":168},171546,"2.9.0","## 依赖项更新\n\n更新依赖项以避免漏洞。\n\n## 经典 RAG 中的重排序\n\n改进 RAG 功能中的重排序特性。\n\n## 内存\n\n为 RAG 功能添加内存使用功能。\n\n## 新的 PDF 解析器\n\n在索引文档时，可使用基于多模态大模型的新 PDF 解析器，该解析器能够处理 PDF 文件中的图像。\n\n## 重构代理式 RAG 功能\n\n重构代理式 RAG 功能：改用 LangChain 框架，取代 SmolAgents 框架。","2026-01-09T14:39:36",{"id":170,"version":171,"summary_zh":172,"released_at":173},171547,"2.8.1","修复：修改 RAG 类，以更好地理解上下文。","2025-12-04T15:56:33",{"id":175,"version":176,"summary_zh":177,"released_at":178},171548,"2.8.0","# 自定义处理器与 VLM 驱动的 PDF 解析\n\n## 新功能：覆盖向量存储处理器\n\n现在，您可以在索引数据时覆盖 RAGLight 的默认文档处理器。这使得数据摄取流水线完全可定制。\n\n```python\ncustom_processors = {\n    \"pdf\": VlmPDFProcessor(vlm),\n    \"py\": MyCustomPythonProcessor(),\n}\n```\n\n这样，您可以为任何文件扩展名插入自定义逻辑，并将 RAGLight 适配到高级或领域特定的工作流中。\n\n---\n\n## 增强型 VLM 的 PDF 处理器\n\n新引入了一个 `VlmPDFProcessor`。它具备以下功能：\n\n* 从 PDF 中提取文本和图像\n* 将图像转换为 base64 格式\n* 发送至您的视觉-语言模型（OpenAI、Mistral、Ollama 等）\n* 生成图注并将其嵌入为可搜索的内容\n\n这一机制能够将**视觉信息**（如图表、插图、示意图）保留在向量存储中，从而提升技术文档的检索效果。","2025-12-04T13:53:27",{"id":180,"version":181,"summary_zh":182,"released_at":183},171549,"2.7.2","- Allow user to use more Ollama parameters (see options parameter)\r\n- Fix problem for Mistral use","2025-10-13T17:39:06",{"id":185,"version":186,"summary_zh":187,"released_at":188},171550,"2.7.0","Agentic RAG can now retrieve data fro different collections.","2025-08-22T09:25:49",{"id":190,"version":191,"summary_zh":192,"released_at":193},171551,"2.6.0","Add :\r\n- Multiprocessing for data ingestion inside vector store\r\n- Better GithubSource -> Now we can target a custom branch : \r\n\r\n```python\r\nknowledge_base=[\r\n    # FolderSource(path=\"\u003Cpath to your folder with pdf>\u002Fknowledge_base\"),\r\n    GitHubSource(url=\"https:\u002F\u002Fgithub.com\u002FBessouat40\u002FRAGLight\", branch=\"main\"),\r\n    ]\r\n```","2025-08-21T21:28:44",{"id":195,"version":196,"summary_zh":197,"released_at":198},171552,"2.5.0","Now you can connect to a remote Chroma server :\r\n\r\n```python\r\nvector_store_config = VectorStoreConfig(\r\n    embedding_model = model_embeddings,\r\n    api_base = Settings.DEFAULT_OLLAMA_CLIENT,\r\n    database=Settings.CHROMA,\r\n    # persist_directory = persist_directory, ----> To use local Chroma\r\n    host='localhost',\r\n    port='8000',\r\n    provider = Settings.HUGGINGFACE,\r\n    collection_name = collection_name\r\n)\r\n```","2025-08-21T20:12:23",{"id":200,"version":201,"summary_zh":202,"released_at":203},171553,"2.4.0","**New Feature in RAGLight: Effortless MCP Integration for Agentic RAG Pipelines!** 🔌\r\n\r\nYou can now plug in external tools directly into your agent's reasoning process using an MCP server.\r\n\r\n### Example:\r\n\r\n```python\r\nconfig = AgenticRAGConfig(\r\n    provider = Settings.OPENAI,\r\n    model = \"gpt-4o\",\r\n    k = 10,\r\n    mcp_config = [\r\n        {\"url\": \"http:\u002F\u002F127.0.0.1:8001\u002Fsse\"}  # Your MCP server URL\r\n    ],\r\n    ...\r\n)\r\n```\r\n\r\nThis automatically injects all MCP tools into the agent's toolset.","2025-08-16T19:33:40",{"id":205,"version":206,"summary_zh":207,"released_at":208},171554,"2.3.0","Refacto code to simplify data ingestion inside vector stores.","2025-08-14T20:42:40",{"id":210,"version":211,"summary_zh":212,"released_at":213},171555,"2.2.2","Fix use of custom url for llm and embeddings providers.\r\nFix the use of ignore_folders parameters to avoid indexing some directories","2025-08-07T18:12:28",{"id":215,"version":216,"summary_zh":217,"released_at":218},171556,"2.2.1","Fix a bug during data ingestion.\r\nNow ingestion is robust and doesn't crash.","2025-08-06T22:21:52",{"id":220,"version":221,"summary_zh":222,"released_at":223},171557,"2.2.0","- Use custom URL for LLM Providers\r\n- Add a new CLI command : raglight agentic-chat\r\n\r\nNow you can use custom url for your LLM providers and use Agentic RAG inside your terminal 🎉\r\n","2025-08-04T22:36:44",{"id":225,"version":226,"summary_zh":227,"released_at":228},171558,"2.0.0","Add CLI :\r\n\r\nAllow user to use RAGLight to setup a local RAG and chat using its local documents as knowledge base.","2025-07-29T20:58:41"]