Skip to main content
RAG (Retrieval-Augmented Generation) connects an agent to external knowledge so its responses are grounded in documents, websites, databases, and structured sources rather than relying on the LLM’s training data alone.

Knowledge options

Lyzr provides three Knowledge Base types. Choose based on your data structure and query patterns.
OptionBest for
Classic Knowledge BaseDocument Q&A: PDFs, DOCX, websites, and plain text
Knowledge GraphRelationship-heavy questions and entity traversal
Semantic ModelNatural-language queries over structured (tabular) data

How RAG works

  1. The user asks a question.
  2. Lyzr retrieves relevant chunks, graph facts, or schema context from the Knowledge Base.
  3. The retrieved context is added to the agent’s prompt.
  4. The LLM generates an answer grounded in the retrieved material.
  5. Citations or trace data are available for validation.

Classic Knowledge Base

The Classic Knowledge Base indexes unstructured content (PDFs, DOCX files, plain text, and websites) using vector embeddings for semantic search. Supported sources: PDF, DOCX, TXT, websites (live crawl or snapshot), SharePoint, S3, Google Drive (upcoming), Notion, Confluence. Live sources re-sync on a schedule (minimum one-hour interval), detecting only the changes since the last sync. Live sync is available for SharePoint and websites today; Google Drive support is upcoming. Retrieval types:
  • Basic: Vector similarity search. The default and best starting point for most document Q&A.
  • MMR (Maximal Marginal Relevance): Balances relevance and diversity in retrieved results, reducing duplicate content.
  • HyDE (Hypothetical Document Embeddings): Generates a synthetic hypothetical answer to use as the retrieval query, improving results on open-ended questions.
Chunking splits documents into smaller sections for indexing. Configure chunk size, chunk count, and overlap to control retrieval quality. Smaller chunks improve precision; larger chunks improve context continuity. Score threshold filters out results below a similarity score you set, so the agent only sees high-confidence matches. Adjust this when your agent returns off-topic chunks.

Knowledge Graph

The Knowledge Graph module indexes data as a graph of entities and relationships rather than flat text chunks. It is backed by Neo4j. Use a Knowledge Graph when your data has complex relationships: org charts, product dependencies, regulatory trees, or any domain where the connection between entities matters as much as the content itself. The Knowledge Graph improves accuracy on questions like “Which policies apply to teams that report to the CISO?” where a Classic Knowledge Base would return disconnected text chunks.

Semantic Model

The Semantic Model connects an agent to a relational database and lets users query it in plain English. The agent translates the natural-language question into a SQL SELECT query, runs it, and returns the result. Supported databases: PostgreSQL, MySQL, BigQuery, Snowflake, and others. What’s required: a schema definition covering tables, columns, and a business glossary that maps user-facing terms to database column names. The richer the glossary, the more accurately the agent generates SQL. By default, the Semantic Model generates read-only SELECT queries. Write access is configurable for internal tooling use cases.

Connecting a Knowledge Base to an agent

Knowledge bases are organizational resources, not per-agent. Any agent in your workspace can connect to any Knowledge Base. To connect a Knowledge Base to an agent: open the agent, enable Knowledge Base in the core features section, and select the Knowledge Base from the dropdown. The agent will use the connected Knowledge Base for Retrieval-Augmented Generation on every subsequent request.

Design guidance

  • Build and test with a small, high-quality source set before ingesting your full corpus.
  • Keep chunk sizes aligned to your document’s natural sections.
  • Use a Knowledge Graph when your questions require following relationships.
  • Use a Semantic Model when the answer requires querying live tabular data.
  • Combine RAG with groundedness checks for production agents that must not hallucinate.

Next steps