A hybrid search system that combines semantic search (Qdrant) and text search (Elasticsearch BM25) for enhanced retrieval augmented generation (RAG) capabilities, optimized for processing meeting data from the Vexa API.
Contextual embeddings, pioneered by Anthropic, address a critical limitation in traditional RAG systems: semantic isolation of chunks.
In conventional RAG implementations, documents are divided into chunks for vector storage and retrieval. However, this chunking process often results in the loss of contextual information, making it difficult for the retriever to determine relevance accurately. For example, a chunk containing "the function returns an error" loses crucial context about which function, what type of error, and under what conditions.
Contextual embeddings enhance document chunks by prepending relevant context from the entire document before embedding or indexing. This approach:
- Preserves Semantic Context: Each chunk retains information about its broader document context
- Improves Retrieval Accuracy: Better matching between queries and relevant content
- Reduces Retrieval Errors: More precise document selection for RAG applications
This implementation is specifically optimized to process meeting data accessed from the Vexa API. The system includes:
- Meeting Transcript Processing: Handles Vexa's meeting transcript format with segments, speakers, and timestamps
- Speaker-Aware Chunking: Groups consecutive messages by speaker and topic for better context preservation
- Contextual Processing Pipeline: Preserves conversation context and speaker information
- Optimized Indexing: Efficient processing of meeting data with metadata preservation
- Filtering: Enables filtering by specific speakers and meeting IDs for targeted retrieval
- Docker and Docker Compose
- Python 3.8+
- OpenAI API key
- Voyage API key (for embeddings)
- Access to Vexa API (optional, for meeting data processing)
-
Clone the repository
git clone https://github.com/Vexa-ai/vexa-contextual-rag cd vexa-contextual-rag
-
Set up environment variables
cp .env.example .env # Edit .env with your API keys
-
Start the services
docker-compose up -d
-
Install Python dependencies
pip install -r requirements.txt
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
MIT
For issues and questions, please open an issue on the GitHub repository.