Overview
Retrieval-Augmented Generation (RAG) is a powerful paradigm that enhances large language models by providing them with relevant information from external knowledge sources. This approach has become essential for enterprise AI applications that need to work with specific, up-to-date, or domain-specific information that wasn’t part of the model’s training data. RAG addresses key limitations of traditional LLMs:- Knowledge cutoffs - Access the most current information
- Domain expertise - Integrate specialized knowledge bases
- Factual accuracy - Reduce hallucinations with grounded responses
- Scalability - Work with vast document collections efficiently
Location within the framework: beeai_framework/rag.
Philosophy
BeeAI Framework’s approach to RAG emphasizes integration over invention. Rather than building RAG components from scratch, we provide seamless adapters for proven, production-ready solutions from leading platforms like LangChain and Llama-Index. This philosophy offers several advantages:- Leverage existing expertise - Use battle-tested implementations
- Faster time-to-market - Focus on your application logic, not infrastructure
- Community support - Benefit from extensive documentation and community
- Flexibility - Switch between providers as needs evolve
Installation
To use RAG components, install the framework with the RAG extras:RAG Components
The following table outlines the key RAG components available in the BeeAI Framework:| Component | Description | Compatibility | Future Compatibility |
|---|---|---|---|
| Document Loaders | Responsible for loading content from different formats and sources such as PDFs, web pages, and structured text files | LangChain | BeeAI |
| Text Splitters | Splits long documents into workable chunks using various strategies, e.g. fixed length or preserving context | LangChain | BeeAI |
| Document | The basic data structure to house text content, metadata, and relevant scores for retrieval operations | BeeAI | - |
| Vector Store | Used to store document embeddings and retrieve them based on semantic similarity using embedding distance | LangChain | BeeAI, Llama-Index |
| Document Processors | Used to process and refine documents during the retrieval-generation lifecycle including reranking and filtering | Llama-Index | - |
Dynamic Module Loading
BeeAI Framework provides a dynamic module loading system that allows you to instantiate RAG components using string identifiers. This approach enables configuration-driven architectures and easy provider switching. Thefrom_name method uses the format provider:ClassName where:
provideridentifies the integration module (e.g., “beeai”, “langchain”)ClassNamespecifies the exact class to instantiate
BeeAI Vector Store
Python
Supported Provider’s Vector Store
RAG as Tools
Vector store population (loading and chunking documents) is typically handled offline in production applications, making Vector Store the prominent RAG building block utilized as a tool.VectorStoreSearchTool enables any agent to perform semantic search against a pre-populated vector store. This provides flexibility for agents that need retrieval capabilities alongside other functionalities.