• CusmatoDocumentatie
  • Overzicht
    • Richtlijnen
    • Workflow
    • AI-model
    • Jessica
    • Kennisbank
    • Patronen
    Knowledge base icon

    Knowledge base

    Knowledge base and RAG

    RAG, embeddings and vector storage for the AI system

    Overview

    The knowledge base in Cusmato feeds the AI system with relevant documentation. Via RAG (Retrieval-Augmented Generation), the right sources are retrieved when generating responses.

    • RAG — Searches indexed documents based on semantic similarity
    • Embeddings — Via Ollama
    • Vector storage — Qdrant
    • Filtering — Per channel (channelKey) possible

    How it works

    During first-contact

    When a ticket is processed:

    1. The content of the customer message is used as search query
    2. RAG searches for similar documents in the knowledge base
    3. The found context is added to the AI prompt
    4. The response is generated with this extra context

    Search parameters

    ParameterDefaultDescription
    limit5Maximum number of results
    scoreThreshold0.7Minimum relevance score (0–1)
    sourceTypes—Filter by source type
    channelKey—Filter by channel (bolcom, shopify, etc.)

    Managing the knowledge base

    The knowledge base API supports:

    • Search — Search indexed content
    • Seed — Add documents to the index
    • Extract — Extract content from sources
    • AI-extract — AI-driven extraction
    • AI-generate — AI-driven content generation
    • Examples — Examples for training
    • Webpages — Scrape and index web pages

    Redis integration

    Knowledge base data is also stored in Redis. The system prompt hash contains a timestamp of the knowledge base, so changes trigger prompt invalidation.

    API endpoints

    • POST /api/[accountSlug]/rag/search — Search in RAG (query, limit, scoreThreshold, sourceTypes)
    • GET /api/[accountSlug]/rag/search — Retrieve collection statistics

    Best practices

    1. Relevant content — Only add documentation that directly helps with customer questions
    2. Channel-specific — Use channelKey filtering for channel-specific knowledge
    3. Keep updated — Keep the knowledge base up-to-date with policy changes and new products