This guide walks you through connecting your team’s documentation to a knowledge base and using it to ground AI chat responses with accurate information from your own content.

Prerequisites

  • Workspace enabled (suite.enabled: true)
  • RAG enabled (rag.enabled: true)
  • A connector encryption key set (connectors.encryption_key)
1

Enable RAG in your config

rag:
  enabled: true
  vector_store: memory    # use qdrant for production

connectors:
  encryption_key: my-secret-passphrase
Restart the gateway to apply.
2

Create a knowledge base

curl -X POST http://localhost:8180/w/kb \
  -H "Cookie: session=..." \
  -H "Content-Type: application/json" \
  -d '{"name": "engineering-docs"}'
Note the returned id — you will use it in subsequent steps.
3

Add documents (option A: upload files directly)

Upload files directly to the knowledge base:
curl -X POST http://localhost:8180/w/kb/$KB_ID/documents \
  -H "Cookie: session=..." \
  -F "file=@architecture.md"
Or ingest from a URL or YouTube video:
curl -X POST http://localhost:8180/w/ingest/url \
  -H "Cookie: session=..." \
  -H "Content-Type: application/json" \
  -d '{"kb_id": "'$KB_ID'", "url": "https://docs.example.com/guide"}'
4

Sync from an external source (option B: connector)

For continuously updated content, create a connector. This example syncs a Confluence space:
curl -X POST http://localhost:8180/w/kb/$KB_ID/connectors \
  -H "Cookie: session=..." \
  -H "Content-Type: application/json" \
  -d '{
    "type": "confluence",
    "config": {
      "base_url": "https://mycompany.atlassian.net",
      "space_key": "ENG"
    },
    "credential_id": "<credential-uuid>"
  }'
Trigger the first sync immediately:
curl -X POST http://localhost:8180/w/kb/$KB_ID/connectors/$CID/sync \
  -H "Cookie: session=..."
5

Test retrieval

Query the KB directly to verify your documents are indexed and relevant chunks are returned:
curl -X POST http://localhost:8180/w/kb/$KB_ID/query \
  -H "Cookie: session=..." \
  -H "Content-Type: application/json" \
  -d '{"query": "How does authentication work?", "top_k": 5}'
6

Use RAG in chat

In the workspace UI, select the knowledge base in the chat settings panel. Your messages will automatically be grounded with relevant document chunks.Citations appear in the chat as clickable references — users can see exactly which documents informed each answer.

Improve retrieval quality

After your KB is populated, tune retrieval in Admin → Settings → RAG:
  • Hybrid search — combine BM25 keyword scoring with vector search via RRF for better coverage of exact terms
  • Rerank model — add a cross-encoder for more precise document ranking after initial retrieval
  • Relevance filter — use an LLM to classify and filter low-quality chunks before they reach the context window
  • Standard answers — curate QA pairs that short-circuit RAG for common questions your team asks