Knowledge base
The knowledge base is a ChromaDB collection that the proxy queries on every request (when RAG is enabled). You populate it by ingesting documents via the admin API.
Supported file types
Section titled “Supported file types”.txt, .md, .rst
Ingest a directory
Section titled “Ingest a directory”Recursively scans a directory and ingests all supported files:
curl -X POST http://localhost:8000/internal/kb/ingest-directory \ -H "Authorization: Bearer $PROXY_MASTER_KEY" \ -H "Content-Type: application/json" \ -d '{"directory": "knowledge_base"}'The directory path is relative to the proxy container’s working directory (/app in Docker). Mount your documents at /app/knowledge_base or update the path.
Response:
{ "ingested_files": 8, "total_chunks": 212, "files": [ "knowledge_base/api.md", "knowledge_base/guide.md", "knowledge_base/faq.md" ]}Upload a single file
Section titled “Upload a single file”curl -X POST http://localhost:8000/internal/kb/upload \ -H "Authorization: Bearer $PROXY_MASTER_KEY" \ -F "file=@./runbook.md"CLI script
Section titled “CLI script”For local development or CI:
python scripts/ingest_kb.py --directory ./docsChunking
Section titled “Chunking”Documents are split into overlapping chunks before embedding. Default chunk size and overlap are configured in the source. Chunks that are too short (< 50 characters) are skipped.
Kubernetes
Section titled “Kubernetes”Mount the knowledge base files as a PVC and run ingestion as a Job:
apiVersion: batch/v1kind: Jobmetadata: name: kb-ingestspec: template: spec: restartPolicy: OnFailure containers: - name: ingest image: ghcr.io/geeper-io/relay:latest command: ["python", "scripts/ingest_kb.py", "--directory", "/app/knowledge_base"] env: - name: PROXY_MASTER_KEY valueFrom: secretKeyRef: name: llm-proxy-master-key key: PROXY_MASTER_KEY volumeMounts: - name: knowledge-base mountPath: /app/knowledge_base volumes: - name: knowledge-base persistentVolumeClaim: claimName: llm-proxy-knowledge-baseRe-ingestion
Section titled “Re-ingestion”Re-ingesting a file that already exists in the collection adds duplicate chunks. Before re-ingesting:
- Use the ChromaDB HTTP API to delete the collection, or
- Scale the proxy to 0 replicas, delete the
chroma_dataPVC data, then re-ingest
A proper upsert/deduplication API is planned for a future release.