A complete backend API built with FastAPI that implements a Retrieval-Augmented Generation (RAG) pipeline. This system ingests text documents, converts them into vector embeddings using Google's Gemini API, stores them in a Pinecone vector database, and allows users to ask context-aware questions based on the ingested data.
- Framework: Python, FastAPI, Uvicorn
- AI/LLM: Google Gemini API (
gemini-embedding-001for vectors,gemini-2.5-flashfor text) - Database: Pinecone
- Data Processing: NumPy, python-dotenv, UUID
Before running the code, you need:
- Pinecone API Key: Create a free account at pinecone.io. Create an index named
rag-agentwith Dimensions: 768 and Metric: cosine. - Google Gemini API Key: Get this from Google AI Studio.
Open your terminal and run the following commands to set up the project and install all required libraries:
# Clone your repository (or just navigate to your project folder)
# git clone <your-repo-link>
# cd <your-project-folder>
# Install all required Python packages
pip install fastapi uvicorn pydantic python-dotenv pinecone-client google-generativeai numpy