This project implements an advanced Retrieval-Augmented Generation (RAG) system based on the LlamaIndex library. The system enables querying and generating insights from a repository of Markdown documents collected during the development of the "Text Analyzer" project.".
The uniqueness of the system lies in its integration of two data channels:
- Semantic Search (Vector Store): Utilizing Pinecone to retrieve information from free text and articles.
- Structured Data: Extracting data into a MongoDB database and querying specific data points.
The system is built upon two primary data processing paths activated during system initialization:
In this path, the system ingests Markdown files, breaks them into information units (Nodes), and indexes them in a vector database.
-
Ingestion: Reading and preparing the data.
-
Pinecone Engine: Creating the semantic query engine.
In this path, the system uses an LLM to extract entities, decisions, and technical data from the text, saving them as structured data in MongoDB.
-
Extractor Workflow: The extraction process and schema definition.
-
Mongo Engine: Creating an engine that allows complex queries on the extracted data.
- Framework: LlamaIndex (Core, LLMs, Embeddings, Vector Stores)
- LLM & Embeddings: Google Gemini (GoogleGenAI)
- Vector Database: Pinecone
- NoSQL Database: MongoDB (AsyncIOMotorClient)
- UI: Gradio
- Environment Management: python-dotenv
main.py: Entry point for the application, system initialization, and Router management.src/config.py: Central configurations for the LLM, Embeddings model, and Pinecone connectivity.src/mongo_workflow_engine.py: Utility engine for running queries against the MongoDB Workflow asynchronously.src/agent_events.py&src/extractor_events.py: Definition of the various workflows for data processing.data/: Folder containing the Markdown files (such as the Text Analyzer README) used as the knowledge base.
- Python 3.12 or higher.
- API keys for Google Gemini and Pinecone.
- An active MongoDB database.
-
Clone the project to your local computer.
clone https://github.com/naama-git/RAG-project-with-llamaIndex
-
Create a
.envfile and enter the following variables:GEMINI_API_KEY=your_key LLM=gemini-1.5-flash EMBEDDING_LLM=models/text-embedding-004 PINECONE_API_KEY=your_key PINECONE_INDEX_NAME=your_index MONGO_URI=your_mongodb_uri DB_NAME=your_db COLLECTION_NAME=your_collection
-
Install the dependencies using your preferred manager (pip/uv).
-
Run the application:
python main.py
The system will launch a Gradio UI at the local address.
- The system includes a specific SSL certificate configuration in
config.pyfor compatibility with the NetFree network when working with Pinecone. - Communication with MongoDB is fully asynchronous for optimal performance.
Note: This project was conducted for educational purposes only.



