carrel README

README проекта с github.com/FengZhenfei/carrel. Одним файлом markdown: README.md.

Carrel

English | 中文

tests License: MIT

Ontology-Augmented Generation for AI agents.

Carrel is a self-hosted knowledge base for AI agents. It automates document parsing, indexing, and retrieval, with optional knowledge graphs. Agents use its API to retrieve source passages, images, and related facts, then generate their own answers.

Use it to give an agent access to a collection of product documents, research, contracts, meeting notes, or other files that change over time. A web console manages knowledge bases, models, and processing tasks. A bundled search skill connects agents such as Claude Code and Codex to the retrieval service.

0.4.1 general retrieval benchmarks and codebase capabilities · Full 0.4.0 capability evaluation

Features · Evaluation · Design · Quick start · Agent integration · Documentation

Features

0.4.3 changes and upgrade steps — Consistent document publication, version-bound evidence, table parsing repairs, and bundled code grammars.

Capability evaluation

Across 275 text queries, 0.4.1 reached 93.45% evidence Hit@5 and 0.8141 MRR@10. In a separate study of 24 code questions, Haiku answered 13 completely from the first response and 23 with Skill follow-up. 0.4.1 evaluation

The full 0.4.0 evaluation also covers graph rebuild stability, time-scoped evidence, conflicts and ontology governance. Full 0.4.0 technical report

How it works

flowchart LR
    D[Document folders] --> P[Parse and chunk]
    P --> I[Vector and keyword indexes]
    P --> G[Optional knowledge graphs]
    I --> R[Retrieval API]
    G --> R
    R --> A[AI agent]
    A -->|Follow-up queries| R

Carrel uses MinerU and native parsers for ingestion. Standard uses Qdrant, OpenSearch and Neo4j; Light uses embedded LanceDB and DuckDB. SQLite tracks files and tasks in both editions. Model services run independently, locally or through compatible hosted endpoints. See Architecture for the pipeline and retrieval design.

Design

Carrel provides general knowledge storage, retrieval, and evidence interfaces. Entities, relationships, and facts retain sources, time information, and conflicts so agents can check and use them alongside the original documents. Default retrieval retains historical and future source claims. An explicit time query selects the relevant evidence; reviewed corrections record which sources and identities the decision applies to. The Agent Loop plugin is in development and not yet implemented. It is intended to use these interfaces to continuously learn an enterprise ontology, seek clarification from relevant people, and maintain correction rules.

Routine graph updates merge new and changed content incrementally. Configured time or change thresholds trigger full rebuilds, balancing update cost with overall consistency. Parsing, indexing, and graph construction are maintained separately: rebuilding a graph can reuse parsed content and chunks while preserving RAG indexes.

Requirements

Platform Deployment
Linux with NVIDIA GPU GPU parsing with NVIDIA Container Toolkit; container scheduling
Linux without GPU CPU parsing; connect to model services on another host or a provider
macOS with Docker Desktop CPU parsing and application containers, including scheduling
Windows Use WSL2; native Windows deployment is not supported

Example setup describes the author's installation on an NVIDIA DGX Spark and some lighter alternatives.

Quick start

1. Deploy the services

git clone https://github.com/FengZhenfei/carrel.git
cd carrel
./deploy.sh --standard --build
# Or use embedded storage:
# ./deploy.sh --light --build

The optional script prepares Compose configuration and starts the application, background scheduler and selected dependencies. You can also use Compose directly. First startup downloads MinerU parser assets. See Container deployment.

2. Configure model endpoints

Choose Standard for Qdrant, OpenSearch and Neo4j, or Light for embedded LanceDB and DuckDB. The edition is fixed for that deployment directory. Both include MinerU; Light has no database containers. See Storage editions.

In System settings, configure LLM, Embedding and Reranker endpoints, model IDs and API keys. Register a vision-capable LLM and select it as the Multimodal model for each knowledge base. Images, charts and table review share that selection. Models can run on your own machines or hosted platforms. Carrel does not start these model services or download their weights. See Model configuration.

3. Add documents

Open the console at http://127.0.0.1:9800. Put documents in data/runtime/mirror/<folder>/, then enable that folder in the console. Each enabled folder becomes a knowledge base; scheduled tasks process its files.

For a knowledge graph, register a chat model with its Max Input in the console, select it in the knowledge-base settings, and enable graph building. Check service health and task progress in the console before making your first query.

Agent integration

Install the bundled carrel-search skill in your agent, or call the API directly:

The first container start creates KB_SEARCH_TOKEN in data/config/knowledge-base.env. Set CARREL_SEARCH_TOKEN to that value:

export CARREL_SEARCH_TOKEN='your search token'
curl -sS http://127.0.0.1:9810/search \
  -H "Authorization: Bearer $CARREL_SEARCH_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{"question": "What are the delivery and acceptance requirements?", "top_k": 8}'

For a remote agent, configure CARREL_SEARCH_BASE_URL and CARREL_SEARCH_TOKEN in its environment.

Responses include source passages and, when available, graph evidence and image information. Agents can request more context, inspect images, and follow relationships before answering. See Retrieval and API for authentication, response status, and citations.

Documentation

Guide Contents
Configuration Model endpoints, folders, per-base settings, and access control
Architecture Parsing, graph construction, retrieval, and code layout
Retrieval and API Agent setup, endpoints, evidence status, and evaluation
Retrieval and codebase evaluation (0.4.1) Document retrieval, page-image location, Skill follow-up and cross-file code analysis
Capability evaluation (0.4.0) Full technical report: retrieval, answers, temporal evidence, conflicts, ontology, rebuild stability, latency, and token usage
Operations and development Console, CLI, scheduling, troubleshooting, and tests
Test scope Shared regression contracts, deployment-specific checks, and live evaluations
Example setup The author's installation on a DGX Spark, a Mac that syncs the documents, and lighter alternatives
Docker Compose Infrastructure, model weights, and container settings
Container deployment Images, scheduling, persistent data and updates
systemd Native/source installation

Data and access

The console binds to localhost by default. For LAN access, set both KB_WEB_HOST and KB_WEB_TOKEN. Configure KB_SEARCH_TOKEN before using protected search endpoints remotely. The stores and model servers listen on loopback only, which keeps other machines out but not web pages opened in a browser on the same host, so avoid browsing the web there.

Documents and images are sent to the model endpoints you configure. Local endpoints keep model processing within your own infrastructure. See Access and data handling.

License

Carrel is licensed under MIT. Dependencies and model weights have their own licenses; see Third-party notices. Original-resolution PDF image retrieval uses an optional dependency installed with ./deploy.sh --with-pdf-images; without it, retrieval uses cached images.

carrel (FengZhenfei/carrel)

Ищем в базе…

808 ·GitHub
Что это такое?Carrel — это база знаний для ИИ-агентов, которую вы развёртываете у себя. Она автоматизирует разбор документов, индексацию и поиск, при необходимости с графами знаний, чтобы агент мог извлекать фрагменты текста, изображения и факты из ваших документов и отвечать на их основе.
Это Python-библиотека, которую я импортирую, или сервис, который я запускаю у себя?Это сервис, который вы разворачиваете у себя: инфраструктуру (Qdrant, OpenSearch, Neo4j) вы поднимаете через Docker, запускаете Python-приложение и управляете им через веб-консоль и API, а не импортируете как библиотеку.
Как его развернуть и проиндексировать документы?Запустите скрипт развёртывания: он определит вашу систему, запустит инфраструктуру, установит Python-приложение и создаст конфигурационные файлы. Затем отредактируйте config/knowledge-base.env, указав адреса моделей, и поместите файлы в runtime/mirror/, чтобы они были подключены как база знаний.
Что нужно установить перед развёртыванием?Python 3.12+ и Docker 25+ с Compose v2, а также эндпоинт для эмбеддингов текста, эндпоинт визуально-языковой модели для описания изображений и, если хотите строить граф знаний, чат-модель.
Можно ли запустить это нативно на Windows?Нет, нативное развёртывание на Windows не поддерживается — нужно использовать WSL2.
Куда на самом деле попадают мои документы и данные?Документы и изображения отправляются на те эндпоинты моделей, которые вы настроили. Если указать локальные эндпоинты моделей, вся обработка останется внутри вашей инфраструктуры, а не будет передана третьей стороне.
Нужна ли видеокарта NVIDIA для запуска?Только если вы хотите запускать необязательный стек локальных моделей с ускорением на GPU; разбор на CPU тоже поддерживается.
Для чего нужен встроенный навык carrel-search?Это готовый навык, который позволяет агентам для программирования, таким как Claude Code и Codex, напрямую обращаться к API поиска Carrel, так что вам не придётся самостоятельно писать интеграцию.
Что под капотом обеспечивает конвейер поиска?MinerU и нативные парсеры отвечают за загрузку документов, Qdrant хранит векторы, OpenSearch выполняет поиск по ключевым словам, Neo4j обрабатывает запросы к графу, а SQLite ведёт учёт файлов и задач.
Что на самом деле фиксируют графы знаний?Они извлекают из документов типы сущностей, связи и факты, сохраняя информацию об источниках, временные данные и признаки противоречий между фактами.
Какие типы файлов он умеет разбирать?PDF, Word, PowerPoint, таблицы, изображения, HTML, Markdown и исходный код; для каждого формата используется подходящая обработка.
Какие есть похожие проекты?m_flow, semantica, LightRAG, zilan, utopia, serviette, memvid, ragflow
Автор
FengZhenfei
Размер
6.6 MB
Звёзды
808
Возраст
1 мес
Коммиты · 90 дней