.Riyaan Docs
Concepts

Knowledge Base

The knowledge base gives your agent access to company-specific information. It uses a hybrid retrieval system combining vector similarity, keyword matching, and conversation memory.

Adding documents

Upload documents via POST /api/knowledge:

curl -X POST https://your-deployment.convex.site/api/knowledge \
  -H 'Authorization: Bearer SESSION_TOKEN' \
  -d '{
    "title": "Return Policy",
    "content": "Items can be returned within 30 days...",
    "category": "policies"
  }'

Documents are automatically chunked and embedded for vector search.

Searching

Use POST /api/knowledge/search for hybrid retrieval:

  • Vector search — Semantic similarity using embeddings (weight: alphaVector, default 0.62)
  • BM25 keyword search — Traditional keyword matching (weight: alphaKeyword, default 0.38)
  • Transcript memory — Recent conversation context boosts relevance (weight: alphaMemory, default 0.20)

Knowledge gaps

Knowledge gap detection

When the agent can't find a good answer, Riyaan logs a knowledge gap. Review gaps via GET /api/knowledge/gaps to identify missing content.

Metrics

Track search quality with GET /api/knowledge/metrics:

  • Total searches — How often the knowledge base is queried
  • Average top score — Quality of the best match
  • Gap rate — Percentage of searches that produce no good results
Edit on GitHub

Last updated on

On this page