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

  1. Ingest — upload documents, URLs, GitHub repos, or plain text.
  2. Chunk & Embed — the backend splits content into chunks and generates vector embeddings using your configured AI provider (OpenAI, Anthropic, Google, or local).
  3. Store — embeddings are stored in Qdrant Cloud; metadata is stored in Firestore.
  4. 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. 1. POST /upload with multipart form data → returns fileId
  2. 2. POST /knowledge-base/ingest/document with { 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

MethodEndpointDescription
GET/knowledge-base/statsTotal entries, chunks, and storage usage
GET/knowledge-base/entriesList entries (filter by source, date, category)
GET/knowledge-base/entries/:idGet a specific entry by ID
PATCH/knowledge-base/entries/:idUpdate entry metadata
DELETE/knowledge-base/entries/:idDelete entry from Firestore + Qdrant
POST/knowledge-base/ingest/urlIngest content from one or more URLs
POST/knowledge-base/ingest/githubIngest entire GitHub repositories
POST/knowledge-base/ingest/textIngest plain text content
POST/knowledge-base/ingest/imageIngest an image (vision models)
POST/knowledge-base/ingest/documentIngest an uploaded document (PDF, DOCX)
GET/knowledge-base/chunksExplore raw vector chunks in Qdrant
POST/knowledge-base/searchSemantic similarity search
Knowledge Base — CognitionDesk Docs