-
Notifications
You must be signed in to change notification settings - Fork 1
Home
Welcome to the Knowledge Base Platform documentation!
- API auth is enabled for protected routes after setup completion.
- Reranking is implemented (Voyage/Cohere) and configurable in Chat/Settings.
- Verify reranking in UI source cards (
reranked,rerank,pre) or API logs (Rerank applied). -
PDF support added: text-based PDFs are now supported (TXT, MD, FB2, DOCX, PDF). Heading structure is extracted at upload time for all formats and stored as
section_heading/section_path/section_levelin Qdrant payload.
The platform uses two complementary metadata layers during ingestion:
-
Structural Metadata Indexing: deterministic structure extraction (
section_heading,section_path,section_level, page mapping for PDF).
Use this for precise section/page grounding and stable behavior without extra model cost. -
Metadata Enrichment: optional semantic enrichment (currently
contextual_description) generated by an LLM during ingestion.
Use this when retrieval quality matters more than ingest latency/cost.
These layers are not alternatives: structural metadata tells the system where content lives; enrichment helps describe what a chunk means in document context.
contextual_description_enabled is resolved with strict precedence:
- Request override on operation (
upload/reprocess) - KB override (
knowledge_bases.contextual_description_enabled) - Global default (
app_settings.contextual_description_enabled) - Fallback default (
false)
Practical guidance:
- Enable globally only if most KBs require highest retrieval quality.
- Keep global off and enable per-KB for targeted quality-sensitive corpora.
- Use request-level force enable/disable for one-time bulk operations (quality reindex vs fast ingest).
-
🔧 Troubleshooting Guide - Diagnose and fix issues
-
🔗 API Documentation - Complete API reference with examples
-
⚡ Endpoints Quick Reference - Quick lookup table
-
🗺️ API Map - Visual structure and data flow diagrams
When the API is running, you can access:
- Swagger UI: http://localhost:8004/docs
- ReDoc: http://localhost:8004/redoc
- OpenAPI JSON: http://localhost:8004/api/v1/openapi.json
Recommended quick update:
git pull
docker compose down
docker compose up -d --buildNotes:
- Avoid deleting volumes unless you want to reset data.
- If builds are slow, skip cache pruning; use
docker builder prune -fonly when needed. -
docker-compose(v1) is legacy; preferdocker compose. - Ensure
./secrets/db_passwordexists and matches the current DB password.
- For search-only integrations (MCP tools), use
POST /api/v1/retrieve/to avoid creating chat conversations. - KB-level retrieval defaults can be stored via
PUT /api/v1/knowledge-bases/{kb_id}/retrieval-settings. - MCP endpoint is mounted at
/mcp(use the backend or frontend proxy). - Auth options:
- Static MCP tokens (Admin UI → MCP tab)
-
OAuth (Gateway) via
POST /oauth/token(password + refresh flow)
- OAuth TTLs are configurable in Admin UI → MCP tab.
-
UI: Settings → KB Transfer
-
Export:
POST /api/v1/kb/export(downloads.tar.gz) -
Import:
POST /api/v1/kb/import(multipart) -
Chats (Markdown):
POST /api/v1/kb/export-chats-md(separate.zipfor reading) -
Merge rules: for targeted merge, select a single-KB archive and a target KB with the same embedding model/provider/dimension.
-
Each knowledge base can have multiple conversations.
-
Conversations can be renamed or deleted from the chat list.
-
Conversation settings are saved per chat and can be revisited later.
When enabled, the system expands each retrieved chunk by including neighboring chunks from the same document. This helps recover context that was split during chunking.
-
Setting:
Context Expansion→ enableWindowed Retrieval -
Window size:
context_window= number of chunks on each side (0–5) -
API fields:
context_expansion: ["window"],context_window: N
Prompt editing is available in Settings → Prompts:
- Create and save system prompt drafts (KB chat prompt).
- Activate a prompt version to make it the default for chat.
- View previous versions and load them into the editor.
Self-check prompts are managed in the same tab:
- Create/activate self-check prompt versions.
- Toggle self-check per chat in the chat settings.
Optional setting:
- Show prompt versions in chat (adds a small badge to assistant messages for traceability).
Use this for: Detailed API reference, complete examples, data models
Contains:
- Complete endpoint descriptions
- Request/response schemas
- Authentication details
- Error handling
- Data models (TypeScript interfaces)
- Comprehensive examples
Best for: Integration, understanding business logic, troubleshooting
Use this for: Quick lookup during day-to-day use
Contains:
- Endpoint list by category
- Key parameters
- Common patterns
- HTTP status codes
- Code snippets
Best for: Daily usage, quick reference, bash scripts
Use this for: Understanding system architecture
Contains:
- Visual API tree structure
- Data flow diagrams
- Integration points
- Use case examples
- Performance tips
Best for: Onboarding, architecture review, optimization
# Check API health
curl http://localhost:8004/api/v1/health
# Get API info
curl http://localhost:8004/api/v1/info
# View available embedding models
curl http://localhost:8004/api/v1/embeddings/models# Create knowledge base
curl -X POST http://localhost:8004/api/v1/knowledge-bases/ \
-H "Content-Type: application/json" \
-d '{
"name": "My First KB",
"description": "Test knowledge base",
"chunking_strategy": "semantic",
"embedding_model": "text-embedding-3-small"
}'# Upload document (replace KB_ID with your KB ID)
curl -X POST http://localhost:8004/api/v1/documents/ \
-F "file=@/path/to/document.pdf" \
-F "knowledge_base_id=KB_ID"# Check document status (replace DOC_ID)
curl http://localhost:8004/api/v1/documents/DOC_ID/status# Ask a question (replace KB_ID)
curl -X POST http://localhost:8004/api/v1/chat/ \
-H "Content-Type: application/json" \
-d '{
"question": "What is this document about?",
"knowledge_base_id": "KB_ID",
"top_k": 5
}'# Health check
curl http://localhost:8004/api/v1/health
# Dependency check
curl http://localhost:8004/api/v1/ready
# Ollama status (if using local models)
curl http://localhost:8004/api/v1/ollama/status# List knowledge bases
curl http://localhost:8004/api/v1/knowledge-bases/
# List documents for a KB
curl "http://localhost:8004/api/v1/documents/?knowledge_base_id=KB_ID"
# List conversations
curl http://localhost:8004/api/v1/chat/conversations# Get current settings
curl http://localhost:8004/api/v1/settings/
# Update settings
curl -X PUT http://localhost:8004/api/v1/settings/ \
-H "Content-Type: application/json" \
-d '{
"llm_model": "gpt-4o-mini",
"temperature": 0.5,
"top_k": 10
}'
# Reset to defaults
curl -X POST http://localhost:8004/api/v1/settings/reset# List chat prompt versions
curl http://localhost:8004/api/v1/prompts/
# Create a new chat prompt (draft or activated)
curl -X POST http://localhost:8004/api/v1/prompts/ \
-H "Content-Type: application/json" \
-d '{
"name": "My Chat Prompt",
"system_content": "You are a helpful assistant...",
"activate": true
}'
# List self-check prompt versions
curl http://localhost:8004/api/v1/prompts/self-check{
"id": "uuid",
"status": "success",
"data": { ... }
}{
"items": [...],
"total": 100,
"page": 1,
"page_size": 10,
"pages": 5
}Pagination uses page and page_size (default 10, max 100).
{
"detail": "Error message",
"path": "/api/v1/endpoint",
"suggestion": "Helpful suggestion"
}- Read API Map to understand system architecture
- Reference Quick Reference for endpoint details
- Deep Dive API Documentation for complete specifications
- Test using Swagger UI at http://localhost:8004/docs
- ✅ Check if endpoint already exists in documentation
- ✅ Review naming conventions in Quick Reference
- ✅ Follow existing patterns from API Map
- ✅ Update all three documentation files when adding new endpoints
-
API Issues: Check error response
detailandsuggestionfields - Integration: See examples in API Documentation
- Quick Answers: Use Quick Reference
- Architecture: Review API Map
When reporting API issues, include:
- Endpoint URL
- Request method and body
- Response status code and body
- Expected vs actual behavior
- API Version: v1
- Documentation Version: 1.0
- Last Updated: 2026-02-05
Happy Building! 🚀
📝 Questions? Open an issue | 🌟 Like it? Star the repo | 📖 API Docs: Swagger UI
Version: v1.0
Updated: 2026-02-08