Skip to content

RAG Flows

Retrieval-Augmented Generation (RAG) is an advanced AI technique that combines the strengths of retrieval-based and generation-based models. In a RAG flow, relevant documents or data are first retrieved from a knowledge base and then used to inform the generation of more accurate and contextually relevant responses. This method enhances the capability of AI models to provide detailed and precise information by leveraging extensive pre-existing data.

Simple RAG Flows

A simple RAG flow on kis.ai involves integrating retrieval and generation steps seamlessly. Here’s how it can be done:

  1. Document Storage: Use the Content block to store documents, manuals, and other relevant data.
  2. Retrieval Step: Implement an AI Flow to retrieve the most relevant documents based on user queries. This can be achieved using the AI Gateway to define paths and models for retrieval.
  3. Generation Step: Once the relevant documents are retrieved, use an AI model (through Prompts and the AI Gateway) to generate responses based on the retrieved data.
  4. Output: The final response is a combination of the retrieved information and the generative model’s processing, providing a contextually rich answer.

Complex RAG Flows

For more complex scenarios, RAG flows can involve multiple layers and additional processing steps:

  1. Advanced Document Storage and Indexing: Store and index large volumes of data using the Content block and custom indexing mechanisms.
  2. Multi-Stage Retrieval: Implement multi-stage retrieval processes where initial retrievals are refined through additional querying, ensuring the most relevant documents are selected.
  3. Integration with AI Flows: Use AI Flows to manage the orchestration of retrieval and generation stages. This can involve conditional logic to handle different types of queries and context-specific processing.
  4. Enhanced Generation: Utilize advanced models through the AI Gateway, incorporating A/B testing, load balancing, and optimal response selection from multiple models.
  5. Security and Rate Limiting: Secure the flow with access rules and implement rate limiting at the user, team, or route level to ensure robust and controlled access.

By leveraging kis.ai’s comprehensive suite of tools, developers can build both simple and complex RAG flows, enhancing the capabilities of their AI applications to deliver precise and contextually accurate information.