CalPal is an AI calendar assistant that helps you book appointments and chat about your schedule. It features a modern, animated frontend (Streamlit) and a FastAPI backend that integrates with Google Calendar and Google Gemini (Generative AI) for natural language understanding and event management.
- Conversational Booking: Chat with CalPal to book, view, or discuss appointments in natural language.
- Google Calendar Integration: Automatically creates and manages events using your Google Calendar.
- AI-Powered Understanding: Uses Google Gemini to extract event details from free-form text.
- API Key Rotation: Supports multiple Gemini API keys for robust, quota-resistant operation.
CalPal/
backend/
agent.py # AI logic, Gemini integration, booking info extraction
calendar_utils.py # Google Calendar API utilities (event creation, free slot finding)
list_gemini_models.py # Script to list available Gemini models
main.py # FastAPI app (chat and booking endpoints)
requirements.txt # Backend dependencies
venv/ # (optional) Python virtual environment
frontend/
app.py # Streamlit app (UI, chat, starfield, input, avatars)
requirements.txt # Frontend dependencies
requirements.txt # (optional) Combined dependencies
service_account.json # Google service account credentials
git clone <your-repo-url>
cd CalPalpython -m venv .venv
# On Windows PowerShell:
.venv\Scripts\Activate.ps1
# On Windows CMD:
.venv\Scripts\activate.bat
# On Mac/Linux:
source .venv/bin/activateInstall both backend and frontend dependencies (from the project root):
pip install -r backend/requirements.txt
pip install -r frontend/requirements.txtOr, if you have a combined requirements.txt in the root:
pip install -r requirements.txt- Create a Google Cloud project and enable the Calendar API.
- Download your
service_account.jsonand place it in the project root. - Set your calendar ID as an environment variable or in
.env(see below).
Create a .env file in the backend directory with:
GEMINI_API_KEYS=your_gemini_api_key1,your_gemini_api_key2
GOOGLE_CALENDAR_ID=your_calendar_id
- You can use multiple Gemini API keys, separated by commas.
cd backend
uvicorn main:app --reloadThe backend will be available at http://localhost:8000.
In a new terminal (with the venv activated):
cd frontend
streamlit run app.pyThe frontend will open in your browser (usually at http://localhost:8501).
- Chat: Type your message in the input box and press the rocket button π.
- Book Events: Ask CalPal to book meetings, appointments, or events in natural language (e.g., "Book a meeting with John tomorrow at 2pm").
- View Responses: CalPal will reply in a modern chat interface, and events will be added to your Google Calendar.
POST /chatβ Accepts{ "message": "..." }, returns{ "response": "..." }POST /bookβ Accepts event details, creates a calendar event
- fastapi
- uvicorn
- google-api-python-client
- google-auth
- google-auth-httplib2
- google-auth-oauthlib
- langchain
- google-generativeai
- python-dotenv
- streamlit
- requests
- Space Theme: All UI elements are styled for a cosmic look (see
frontend/app.py). - Google Calendar: Change the calendar ID in your
.envor environment variables. - Gemini Model: The backend uses Gemini 1.5 Flash by default; see
agent.pyfor customization.
MIT License