A FastAPI application that provides RAG (Retrieval-Augmented Generation) capabilities over your Google Drive files using ChromaDB vector storage and Google's Gemini AI.
Mainly built this just to get a little bit of familiarity with basic RAG architecture, nothing too fancy, but works. Plenty of potential improvements here, but not bad for a quick weekend project.
- Google OAuth2 authentication with Drive access
- Browse and index Google Drive files and folders
- Vector search across indexed documents
- AI-powered chat interface using Google Gemini
- Support for multiple file formats
- Currently supports Google Doc, Google Slides, PDF, MS DOC/DOCX, MS PPT/PPTX, TXT
- Chat history for contextual conversations
- Python 3.8+
- uv package manager
- Google Cloud Platform account
- Google AI Studio account (for Gemini API)
See the uv installation guide.
git clone [email protected]:babusid/DrivePilot.git
cd DrivePilotInstall dependencies with uv:
uv sync- Go to the Google Cloud Console
- Click "Select a project" → "New Project"
- Enter a project name and click "Create"
- In the Google Cloud Console, go to "APIs & Services" → "Library"
- Search for Google Drive API
- Click on it, and then click enable
- Go to "APIs & Services" → "Credentials" → "OAuth consent screen" (on the sidebar)
- Click on Get Started
- Enter App Name as
DrivePilotand User support email as your own. - Select
ExternalAudience (Internal may work properly, but has not been tested) - Enter your email address in the Contact Information section
- Agree to the Data policy hit Continue, and then Create.
- In the sidebar, click Clients, and then click Create Client
- Select Web Application for the Application type. Name it DrivePilot.
- IMPORTANT Add
http://localhost:8000as a "Authorized JavaScript Origin" - IMPORTANT Add
http://localhost:8000/authas an "Authorized Redirect URI" - Hit create
- IMPORTANT Copy the Client Secret and Client ID to a safe scratchpad
- Recommended Download the JSON (to have a backup)
- Click on "Data Access" on the left sidebar, and then "Add or remove scopes"
- Add the following scopes:
- Hit Save.
- Click on "Audience" on the left sidebar, and then "Add users" under Test users. Add yourself (and any other google accounts that you want to test the application with.)
For more details, see the Google OAuth2 documentation.
- Go to Google AI Studio
- Click "Create API Key"
- Choose your Google Cloud project
- Copy the generated API key
For more information, see the Gemini API key documentation.
Create a .env file in the app/ directory:
cd app
cp .env.example .env Fill in the following environment variables to app/.env:
CLIENT_ID=your_google_client_id_here
CLIENT_SECRET=your_google_client_secret_here
# Gemini API Key
GEMINI_API_KEY=your_gemini_api_key_hereStart the FastAPI application:
cd app
uv run fastapi run- Login: Navigate to
http://localhost:8000and click "Login with Google" - Authorize: Grant permissions for Drive access and user info.
- Index Files: Browse your Google Drive files and click "Add to index" for files/folders you want to search
- Chat: Use the search box to ask questions about your indexed documents
- View History: See your conversation history in the chat window above the search box
Note: Sign in may be a little slow, this is due to initial file downloading.
- Text files (
.txt) - PDF files (
.pdf) - Microsoft Word documents (
.docx) - Microsoft PowerPoint presentations (
.pptx) - Google Docs, Slides (downloaded as
.txt)
app/
├── main.py # FastAPI application and routes
├── rag.py # Vector database and RAG operations
├── gdrive.py # Google Drive API integration
├── config.py # Configuration management
├── logging.py # Logging utilities
├── frontend/ # HTML templates
│ ├── home.html # Main application interface
│ └── index.html # Login page
└── appdata/ # Downloaded files storage
- OAuth Error: Ensure redirect URIs match exactly in Google Cloud Console
- API Key Error: Verify Gemini API key is set correctly in
.env - Permission Error: Check that required Google APIs are enabled
- File Download Error: Ensure your Google account has access to the files