RAG
Retrieval-Augmented Generation (RAG)
Overview of Retrieval-Augmented Generation and how Lyzr leverages it for accurate, context-rich responses.
RAG Workflow in Lyzr
- Query Reception The user’s question or request is received by the agent.
- Document Retrieval The agent queries configured vector stores or knowledge bases to fetch top-N relevant passages.
- Reranking & Filtering Retrieved passages are optionally reranked and filtered for relevance and quality.
- Prompt Assembly Selected passages are inserted into a structured prompt template alongside the original query.
- Generation The LLM processes the prompt and generates a response that references the retrieved context.
- Citation & Delivery Final answers include citations or links to the source documents, enhancing transparency and traceability.
Core Components
- Vector Store: A scalable database for embedding vectors (e.g., FAISS, Pinecone, Weaviate).
- Embedding Model: Converts text into high-dimensional vectors reflective of semantic meaning.
- Reranker: Reorders retrieved results to surface the most relevant information.
- Prompt Template: Defines how retrieved context and user input are combined to form the LLM prompt.
- Citation Module: Automatically formats and attaches source references to generated outputs.