> For the complete documentation index, see [llms.txt](https://docs.clore.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clore.ai/guides/guides_v2-de/rag-and-vektordatenbanken/ragflow.md).

# RAGFlow

Stelle die RAGFlow-RAG-Engine für tiefes Dokumentenverständnis auf Clore.ai-GPUs bereit

RAGFlow ist eine Open-Source- **Retrieval-Augmented-Generation-(RAG)-Engine** mit tiefgehenden Funktionen zum Verständnis von Dokumenten. Mit über **50.000 GitHub-Sternen**, ist es eine der umfassendsten verfügbaren RAG-Plattformen — entwickelt, um komplexe Dokumente wie PDFs, Word-Dateien, Tabellenkalkulationen, Bilder und mehr zu extrahieren, in Chunks zu zerlegen und darüber zu schlussfolgern.

Im Gegensatz zu einfachen RAG-Systemen, die Dokumente naiv in Chunks aufteilen, verwendet RAGFlow ein layoutbewusstes Parsing, um die Dokumentstruktur, Tabellen, Abbildungen und mehrspaltige Layouts zu verstehen. Das führt zu deutlich höherer Abrufpräzision und besserer Antwortqualität.

Wichtige Funktionen:

* 📄 **Tiefgehendes Dokumentenverständnis** — OCR, Tabellenerkennung, Abbildungserkennung
* 🔍 **Mehrere Chunking-Strategien** — semantisch, layoutbewusst, feste Größe, Q\&A-Stil
* 🤖 **LLM-Integration** — funktioniert mit OpenAI, Ollama, Anthropic, lokalen Modellen
* 🌐 **Voll ausgestattete WebUI** — Dokumentenverwaltung per Drag-and-drop
* 🔌 **REST-API** — integrieren Sie RAGFlow in jede Anwendung
* 📊 **Quellenverfolgung** — Antworten enthalten Verweise auf Quelldokumente
* 🏗️ **Mandantenfähig** — Team-Arbeitsbereiche mit Berechtigungssteuerung

{% hint style="success" %}
Alle Beispiele können auf GPU-Servern ausgeführt werden, die gemietet wurden über [CLORE.AI-Marktplatz](https://clore.ai/marketplace).
{% endhint %}

***

## Serveranforderungen

| Parameter      | Minimum                 | Empfohlen               |
| -------------- | ----------------------- | ----------------------- |
| GPU            | NVIDIA RTX 3080 (10 GB) | NVIDIA RTX 4090 (24 GB) |
| VRAM           | 8 GB                    | 16–24 GB                |
| RAM            | 16 GB                   | 32–64 GB                |
| CPU            | 8 Kerne                 | 16+ Kerne               |
| Festplatte     | 50 GB                   | 100–500 GB              |
| Betriebssystem | Ubuntu 20.04+           | Ubuntu 22.04            |
| CUDA           | 11.8+                   | 12.1+                   |
| Ports          | 22, 9380, 80            | 22, 9380, 80            |
| Docker         | Erforderlich            | Docker + Docker Compose |

{% hint style="warning" %}
RAGFlow führt mehrere Dienste (Elasticsearch, MinIO, MySQL, Redis, Nginx) zusammen mit der Hauptanwendung aus. Stellen Sie sicher, dass genügend RAM (mindestens 16 GB, empfohlen 32 GB) und Speicherplatz vorhanden sind.
{% endhint %}

***

## Schnellbereitstellung auf CLORE.AI

### 1. Finden Sie einen geeigneten Server

Gehe zu [CLORE.AI-Marktplatz](https://clore.ai/marketplace) und filtern nach:

* **VRAM**: ≥ 8 GB
* **RAM**: ≥ 16 GB
* **Festplatte**: ≥ 50 GB
* **GPU**: RTX 3090, 4090, A100, H100

### 2. Konfigurieren Sie Ihre Bereitstellung

**Docker-Image:**

```
infiniflow/ragflow:latest
```

**Port-Zuordnungen:**

```
22 → SSH-Zugriff
80   → RAGFlow Web UI (HTTP)
9380 → RAGFlow API
```

**Startbefehl:**

```bash
bash -c "docker-compose -f docker/docker-compose.yml up -d"
```

### 3. Greifen Sie auf die WebUI zu

```
http://<your-clore-server-ip>:80
```

Standard-Zugangsdaten: `admin@ragflow.io` / `admin`

***

## Schritt-für-Schritt-Einrichtung

### Schritt 1: Per SSH auf Ihren Server verbinden

```bash
ssh root@<your-clore-server-ip> -p <ssh-port>
```

### Schritt 2: Docker Compose installieren

```bash
apt-get update && apt-get install -y docker-compose-plugin

# Prüfen
docker compose version
```

### Schritt 3: RAGFlow-Repository klonen

```bash
cd /workspace
git clone https://github.com/infiniflow/ragflow.git
cd ragflow
```

### Schritt 4: Umgebung konfigurieren

```bash
# Kopieren und bearbeiten Sie die Umgebungsdatei
cp docker/.env.example docker/.env
nano docker/.env
```

Wichtige Einstellungen, die konfiguriert werden müssen:

```env
# LLM-Konfiguration
OPENAI_API_KEY=ihr-openai-api-schlüssel

# Oder verwenden Sie eine lokale Ollama-Instanz
OLLAMA_BASE_URL=http://localhost:11434

# Speichereinstellungen
MINIO_USER=ragflow
MINIO_PASSWORD=infini_rag_flow

# MySQL-Einstellungen
MYSQL_PASSWORD=infini_rag_flow

# Anwendungsport
HTTP_PORT=80
RAGFLOW_API_PORT=9380
```

### Schritt 5: Wählen Sie die richtige Image-Variante

```bash
# Verfügbare Tags prüfen
# Für CUDA 12.8 (RTX 30xx, 40xx, 50xx)
docker pull infiniflow/ragflow:latest

# Für eine bestimmte CUDA-Version
docker pull infiniflow/ragflow:v0.7.0-cuda12.1
```

### Schritt 6: Alle Dienste starten

```bash
cd /workspace/ragflow/docker

# Mit GPU-Unterstützung starten
docker compose -f docker-compose.yml up -d

# Start überwachen (dauert 2–5 Minuten)
docker compose logs -f
```

Warten Sie auf:

```
ragflow-server | INFO: Anwendungsstart abgeschlossen.
```

### Schritt 7: Administratorkonto erstellen

Öffnen `http://<server-ip>:80` und das erste Administratorkonto registrieren.

### Schritt 8: LLM-Modell konfigurieren

1. Gehe zu **Einstellungen → Modellanbieter**
2. Fügen Sie Ihr LLM hinzu (OpenAI, Ollama usw.)
3. Legen Sie das Standard-Chatmodell und das Embedding-Modell fest

***

## Anwendungsbeispiele

### Beispiel 1: Dokumente über die WebUI hochladen und abfragen

1. Melde dich an bei `http://<server-ip>:80`
2. Klicken Sie auf **"Wissensdatenbank"** → **"Wissensdatenbank erstellen"**
3. Benennen Sie es: `"Clore.ai-Dokumentation"`
4. Laden Sie PDF-/Word-/TXT-Dateien per Drag-and-drop hoch
5. Warten Sie auf das Parsing (Fortschritt wird in der UI angezeigt)
6. Gehe zu **"Chat"** → Erstellen Sie einen neuen Assistenten, der mit Ihrer Wissensdatenbank verknüpft ist
7. Stellen Sie Fragen zu Ihren Dokumenten

***

### Beispiel 2: API — Wissensdatenbank erstellen und Dokumente hochladen

```python
import requests
import json
from pathlib import Path

BASE_URL = "http://<your-clore-server-ip>:9380"
API_KEY = "your-ragflow-api-key"  # Erhalten Sie ihn über Einstellungen → API

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

# Schritt 1: Eine Wissensdatenbank erstellen
kb_payload = {
    "name": "Clore.ai Technical Docs",
    "description": "Dokumentation und Leitfäden für GPU-Cloud-Marktplatz",
    "language": "English",
    "embedding_model": "text-embedding-ada-002",
    "chunk_method": "naive",  # oder 'qa', 'table', 'paper', 'book'
}

response = requests.post(
    f"{BASE_URL}/api/v1/knowledgebase",
    headers=headers,
    json=kb_payload
)
kb = response.json()
kb_id = kb["data"]["id"]
print(f"Wissensdatenbank erstellt: {kb_id}")

# Schritt 2: Ein Dokument hochladen
pdf_path = Path("technical_manual.pdf")

with open(pdf_path, "rb") as f:
    files = {"file": (pdf_path.name, f, "application/pdf")}
    upload_response = requests.post(
        f"{BASE_URL}/api/v1/document/upload?kb_id={kb_id}",
        headers={"Authorization": f"Bearer {API_KEY}"},
        files=files
    )

doc = upload_response.json()
doc_id = doc["data"]["id"]
print(f"Dokument hochgeladen: {doc_id}")

# Schritt 3: Parsing starten
parse_response = requests.post(
    f"{BASE_URL}/api/v1/document/run",
    headers=headers,
    json={"doc_ids": [doc_id]}
)
print(f"Parsing gestartet: {parse_response.json()}")
```

***

### Beispiel 3: Dokumente per API abfragen

```python
import requests
import json

BASE_URL = "http://<your-clore-server-ip>:9380"
API_KEY = "your-ragflow-api-key"
CHAT_ID = "your-chat-assistant-id"  # Aus der WebUI → Chat

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

def ask_ragflow(question, chat_id, session_id=None):
    """Senden Sie RAGFlow eine Frage und erhalten Sie eine Antwort mit Zitaten."""
    payload = {
        "question": question,
        "stream": False
    }

    if session_id:
        payload["session_id"] = session_id

    response = requests.post(
        f"{BASE_URL}/api/v1/chat/{chat_id}/completion",
        headers=headers,
        json=payload
    )

    result = response.json()
    if result.get("code") == 0:
        data = result["data"]
        answer = data.get("answer", "")
        references = data.get("reference", {}).get("chunks", [])
        return answer, references
    else:
        return None, []

# Beispielabfragen
questions = [
    "Welche GPU-Spezifikationen sind auf Clore.ai verfügbar?",
    "Wie miete ich einen GPU-Server im Marktplatz?",
    "Wie lautet das Preismodell für GPU-Instanzen?",
    "Welche Deep-Learning-Frameworks werden unterstützt?",
]

for question in questions:
    print(f"\n📌 F: {question}")
    answer, refs = ask_ragflow(question, CHAT_ID)
    print(f"💬 A: {answer}")
    if refs:
        print(f"📚 Quellen ({len(refs)} Chunks):")
        for ref in refs[:2]:
            print(f"   - {ref.get('docnm_kwd', 'Unknown')}: {ref.get('content_ltks', '')[:100]}...")
```

***

### Beispiel 4: Batch-Dokumentverarbeitungspipeline

```python
import requests
import time
from pathlib import Path

BASE_URL = "http://<your-clore-server-ip>:9380"
API_KEY = "your-ragflow-api-key"

headers = {"Authorization": f"Bearer {API_KEY}"}

def upload_and_parse_documents(kb_id, document_paths):
    """Mehrere Dokumente hochladen und auf den Abschluss des Parsings warten."""
    doc_ids = []

    # Alle Dokumente hochladen
    for doc_path in document_paths:
        path = Path(doc_path)
        with open(path, "rb") as f:
            mime = "application/pdf" if path.suffix == ".pdf" else "text/plain"
            files = {"file": (path.name, f, mime)}
            resp = requests.post(
                f"{BASE_URL}/api/v1/document/upload?kb_id={kb_id}",
                headers=headers,
                files=files
            )
            if resp.status_code == 200:
                doc_id = resp.json()["data"]["id"]
                doc_ids.append(doc_id)
                print(f"✓ Hochgeladen: {path.name} → {doc_id}")
            else:
                print(f"✗ Fehlgeschlagen: {path.name}")

    # Batch-Parsing starten
    if doc_ids:
        requests.post(
            f"{BASE_URL}/api/v1/document/run",
            headers={**headers, "Content-Type": "application/json"},
            json={"doc_ids": doc_ids}
        )
        print(f"\nEs werden {len(doc_ids)} Dokumente geparst...")

        # Bis zum Abschluss abfragen
        while True:
            time.sleep(5)
            status_resp = requests.get(
                f"{BASE_URL}/api/v1/document/list?kb_id={kb_id}",
                headers=headers
            )
            docs = status_resp.json().get("data", {}).get("docs", [])
            pending = [d for d in docs if d.get("status") == "1"]  # 1 = in Bearbeitung
            done = [d for d in docs if d.get("status") == "2"]     # 2 = abgeschlossen

            print(f"  In Bearbeitung: {len(pending)} | Fertig: {len(done)}/{len(doc_ids)}")

            if len(pending) == 0:
                break

    print("✓ Alle Dokumente geparst!")
    return doc_ids

# Verwendung
docs = ["manual_v1.pdf", "faq.txt", "api_reference.pdf"]
doc_ids = upload_and_parse_documents(kb_id="your-kb-id", document_paths=docs)
```

***

### Beispiel 5: RAGFlow mit lokalem Ollama-LLM

```bash
# 1. Installieren Sie Ollama auf demselben Clore.ai-Server
curl -fsSL https://ollama.ai/install.sh | sh

# 2. Laden Sie ein lokales Modell herunter
ollama pull llama3:8b
ollama pull nomic-embed-text  # Für Embeddings

# 3. RAGFlow für die Verwendung von Ollama konfigurieren
# In der WebUI: Einstellungen → Modellanbieter → Ollama hinzufügen
# Base URL: http://host.docker.internal:11434
# Oder wenn Ollama in Docker läuft: http://ollama:11434
```

```python
# Ollama-Integration testen
import requests

# Überprüfe, ob Ollama läuft
resp = requests.get("http://localhost:11434/api/tags")
models = [m["name"] for m in resp.json()["models"]]
print(f"Verfügbare Ollama-Modelle: {models}")

# RAGFlow mit lokalem LLM abfragen (in der WebUI konfiguriert)
BASE_URL = "http://localhost:9380"
API_KEY = "your-api-key"
CHAT_ID = "your-chat-id"

response = requests.post(
    f"{BASE_URL}/api/v1/chat/{CHAT_ID}/completion",
    headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"},
    json={"question": "Erklären Sie die RAGFlow-Architektur", "stream": False}
)
print(response.json()["data"]["answer"])
```

***

## Konfiguration

### Wichtige Dienste in docker-compose.yml

```yaml
services:
  ragflow:
    image: infiniflow/ragflow:latest
    ports:
      - "9380:9380"
      - "80:80"
    environment:
      - HF_ENDPOINT=https://huggingface.co
      - MACOS=0
    depends_on:
      - mysql
      - minio
      - es01
      - redis

  es01:
    image: elasticsearch:8.11.3
    environment:
      - xpack.security.enabled=false
      - discovery.type=single-node
    volumes:
      - esdata01:/usr/share/elasticsearch/data

  mysql:
    image: mysql:8.0.39
    environment:
      - MYSQL_ROOT_PASSWORD=infini_rag_flow

  minio:
    image: quay.io/minio/minio:RELEASE.2023-12-20T01-00-02Z
    command: server /data --console-address ":9001"

  redis:
    image: redis:7.2.4
```

### Chunking-Strategien

| Methode  | Am besten geeignet für          | Beschreibung                              |
| -------- | ------------------------------- | ----------------------------------------- |
| `naive`  | Allgemeine Dokumente            | Chunks fester Größe mit Überlappung       |
| `qa`     | FAQ-/Q\&A-Dokumente             | Teilt anhand von Frage-Antwort-Paaren auf |
| `table`  | Tabellenkalkulationen, Tabellen | Bewahrt die Tabellenstruktur              |
| `paper`  | Wissenschaftliche Arbeiten      | Abschnitte, Zusammenfassung, Referenzen   |
| `book`   | Lange Bücher, Handbücher        | Kapitelbewusstes Chunking                 |
| `laws`   | Rechtsdokumente                 | Artikelbasiertes Chunking                 |
| `manual` | Technische Handbücher           | Bewahrung der Abschnittshierarchie        |

***

## Leistungstipps

### 1. Elasticsearch-Speicher skalieren

```yaml
# In docker-compose.yml
es01:
  environment:
    - ES_JAVA_OPTS=-Xms4g -Xmx4g  # Für große Dokumentensätze erhöhen
```

### 2. GPU-beschleunigtes Embedding

Konfigurieren Sie RAGFlow so, dass ein GPU-basiertes Embedding-Modell verwendet wird:

* In Einstellungen → Modellanbieter ein lokales GPU-Modell über Ollama verwenden
* Oder auf einen dedizierten Embedding-Dienst verweisen, der auf der Clore.ai-GPU läuft

### 3. Parallele Dokumentenverarbeitung

RAGFlow verarbeitet Dokumente standardmäßig parallel. Konfigurieren Sie die Anzahl der Worker:

```env
# In docker/.env
TASK_WORKER_COUNT=4  # Je nach CPU-Kernen anpassen
```

### 4. MinIO für große Dokumentensätze

Für Bereitstellungen mit Tausenden von Dokumenten konfigurieren Sie in Ihrer CLORE.AI-Bestellung einen dedizierten MinIO-Speicher mit größerer Speicherzuweisung.

***

## Fehlerbehebung

### Problem: Dienste starten nicht (Speicher)

```bash
# Speichernutzung prüfen
free -h
docker stats

# Elasticsearch-Speicher reduzieren
# docker/.env bearbeiten: ES_JAVA_OPTS=-Xms1g -Xmx1g
```

### Problem: Zugriff auf WebUI über Port 80 nicht möglich

```bash
# Prüfen, ob nginx läuft
docker compose ps

# Port-Zuordnung prüfen
docker port ragflow-nginx-1

# In CLORE.AI prüfen: Port 80 muss in Ihrer Server-Bestellung zugeordnet sein
```

### Problem: Dokumenten-Parsing bleibt hängen

```bash
# Task-Worker-Logs prüfen
docker compose logs ragflow-worker

# Worker neu starten
docker compose restart ragflow-worker
```

### Problem: Elasticsearch-Heap nicht genügend Speicher

```bash
# Heap in .env erhöhen
ES_JAVA_OPTS=-Xms2g -Xmx2g
docker compose restart es01
```

### Problem: Embedding-Modell nicht gefunden

```bash
# HuggingFace-Modell-Download prüfen
docker exec ragflow-server ls /ragflow/models/

# Erneut herunterladen
docker exec ragflow-server python -c "
from huggingface_hub import snapshot_download
snapshot_download('BAAI/bge-large-en-v1.5')
"
```

***

## Links

* **GitHub**: <https://github.com/infiniflow/ragflow>
* **Offizielle Dokumentation**: <https://ragflow.io/docs>
* **Docker Hub**: <https://hub.docker.com/r/infiniflow/ragflow>
* **API-Referenz**: <https://ragflow.io/docs/dev/http_api_reference>
* **Discord**: <https://discord.gg/4XxujFgUN7>
* **CLORE.AI-Marktplatz**: <https://clore.ai/marketplace>

***

## GPU-Empfehlungen für Clore.ai

| Anwendungsfall                | Empfohlene GPU   | Geschätzte Kosten bei Clore.ai |
| ----------------------------- | ---------------- | ------------------------------ |
| Entwicklung/Testen            | RTX 3090 (24 GB) | 0,07–0,21 $/GPU/Stunde         |
| RAG in der Produktion         | RTX 3090 (24 GB) | 0,07–0,21 $/GPU/Stunde         |
| Embedding mit hohem Durchsatz | RTX 4090 (24 GB) | 0,14–0,42 $/GPU/Stunde         |

> 💡 Alle Beispiele in diesem Leitfaden können bereitgestellt werden auf [Clore.ai](https://clore.ai/marketplace) GPU-Servern. Durchsuchen Sie verfügbare GPUs und mieten Sie stundenweise — keine Verpflichtungen, voller Root-Zugriff.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.clore.ai/guides/guides_v2-de/rag-and-vektordatenbanken/ragflow.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
