Core Modules
Knowledge Base
The Knowledge Base module powers Retrieval-Augmented Generation (RAG) for your AI assistants. Content is chunked, embedded, and stored in Qdrant Cloud for fast semantic search.
How it works
- Ingest — upload documents, URLs, GitHub repos, or plain text.
- Chunk & Embed — the backend splits content into chunks and generates vector embeddings using your configured AI provider (OpenAI, Anthropic, Google, or local).
- Store — embeddings are stored in Qdrant Cloud; metadata is stored in Firestore.
- Retrieve — at chat time, the most relevant chunks are retrieved and injected into the AI context window.
Ingesting content
From URLs
Crawl and ingest web pages. Supports multiple URLs in a single request:
Shell
curl -X POST https://api.cognitiondesk.com/knowledge-base/ingest/url \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"urls": ["https://example.com/docs", "https://example.com/faq"],
"metadata": { "source": "website", "category": "support" }
}'From GitHub
Ingest an entire repository. You can filter by file patterns:
Shell
curl -X POST https://api.cognitiondesk.com/knowledge-base/ingest/github \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"repoUrl": "https://github.com/your-org/your-repo",
"branch": "main",
"filePatterns": ["**/*.md", "**/*.txt"]
}'Document upload
First upload the document using POST /upload, then ingest the returned file ID:
- 1.
POST /uploadwith multipart form data → returnsfileId - 2.
POST /knowledge-base/ingest/documentwith{ fileId }
Semantic search
Run a standalone semantic search against your knowledge base — useful for building custom retrieval pipelines:
Shell
curl -X POST https://api.cognitiondesk.com/knowledge-base/search \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"query": "How do I reset my password?",
"limit": 5,
"threshold": 0.75
}'Response
JSON
{
"results": [
{
"id": "chunk_abc123",
"content": "To reset your password, navigate to Settings > Security...",
"score": 0.92,
"metadata": { "source": "website", "url": "https://example.com/faq" }
}
],
"query": "How do I reset my password?",
"total": 5
}Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /knowledge-base/stats | Total entries, chunks, and storage usage |
| GET | /knowledge-base/entries | List entries (filter by source, date, category) |
| GET | /knowledge-base/entries/:id | Get a specific entry by ID |
| PATCH | /knowledge-base/entries/:id | Update entry metadata |
| DELETE | /knowledge-base/entries/:id | Delete entry from Firestore + Qdrant |
| POST | /knowledge-base/ingest/url | Ingest content from one or more URLs |
| POST | /knowledge-base/ingest/github | Ingest entire GitHub repositories |
| POST | /knowledge-base/ingest/text | Ingest plain text content |
| POST | /knowledge-base/ingest/image | Ingest an image (vision models) |
| POST | /knowledge-base/ingest/document | Ingest an uploaded document (PDF, DOCX) |
| GET | /knowledge-base/chunks | Explore raw vector chunks in Qdrant |
| POST | /knowledge-base/search | Semantic similarity search |