Skip to content

RAG Configuration

Per-document configuration for the retrieval-augmented generation pipeline. Controls how documents are chunked, how retrieval queries are executed, and how results are reranked.

See Chunking method, Retrieval mode, and Reranker type for accepted enum values.

Key config fields

FieldDescription
chunking.methodHow text is split into chunks — "token" or "semantic"
chunking.target_tokensTarget chunk size in tokens
chunking.overlap_tokensToken overlap between adjacent chunks
retrieval.modeSearch strategy — "vector", "word_match", or "hybrid"
retrieval.rrf_kReciprocal rank fusion constant for hybrid mode (higher = smoother blending)
reranking.reranker_typeReranker to use — "cross_encoder" or "llm"
reranking.top_kNumber of chunks to keep after reranking

GET /rag/config/

Response 200

json
{
  "config": {
    "chunking": {
      "method": "token",
      "target_tokens": 256,
      "overlap_tokens": 50
    },
    "retrieval": {
      "mode": "hybrid",
      "rrf_k": 60,
      "word_match_limit": 100,
      "vector_limit": 100,
      "min_vector_similarity": 0.6
    },
    "reranking": {
      "enabled": true,
      "reranker_type": "cross_encoder",
      "top_k": 5
    },
    "embedding": {
      "model": "<embedding-model-id>"
    }
  }
}

PUT /rag/config/

Update the RAG configuration for a document.

Request body — full RagConfig object (same shape as response).

Response 200 — updated config.

POST /rag/ingest/

Queue chunking and embedding for a document.

Request body

FieldTypeDefaultDescription
redobooleanfalsetrue deletes existing chunks first

Response 200

json
{
  "document_id": "uuid",
  "parse_job_id": "job-id",
  "docling_job_id": "job-id",
  "chunking_job_id": "job-id",
  "embedding_job_id": "job-id",
  "upload_complete": true,
  "chunking_complete": false,
  "embedding_complete": false,
  "queued": true
}

POST /rag/chunks/preview

Dry-run chunking on raw text without persisting.

Request body

FieldTypeRequired
contentstringyes
configobjectno

Response 200

json
{
  "chunks": [
    {
      "index": 0,
      "content": "...",
      "token_count": 248,
      "contextual_text": null,
      "chunk_kind": null
    }
  ],
  "total": 5
}

POST /rag/documents/{document_id}/chunks/preview

Dry-run chunking for an already-stored document. Content is read from the stored document. Chunking parameters are form-encoded.

Request body (multipart/form-data)

FieldTypeDefaultDescription
chunking_methodstring"token""token" or "semantic"
target_tokensintegerTarget chunk size in tokens (≥ 1)
overlap_tokensintegerToken overlap between chunks (≥ 0)

Response 200 — same shape as above.