Backend for a versatile application combining Google Calendar and OpenAI's ChatGPT APIs, using FastAPI.
My tutorial: https://www.youtube.com/watch?v=wN4u0xLywMY
Just run main.py
and that's it!
- Chat with AI: Utilizes OpenAI's powerful models to answer queries.
- Google Calendar Integration: Manage and view your Google Calendar events.
- RESTful API: Easily integrate with frontends such as Angular or React.
VGCC_backend/
│
├── main.py # Entry point of the application, runs the FastAPI app
├── app/
│ ├── __init__.py # Initializes the FastAPI app object
│ ├── config.py # Configuration settings and constants
│ ├── dependencies.py # Dependency-related items like DB connections
│ ├── routers/ # Contains all router definitions
│ │ ├── __init__.py
│ │ ├── openai_router.py
│ │ └── calendar_router.py
│ └── services/ # Business logic/service layer
│ ├── __init__.py
│ ├── openai_service.py
│ └── calendar_service.py
└── models/
├── __init__.py
├── openAIModels.py
└── calendarModels.py
- The
calendar_service
utilizes a file namedcredentials.json
for Google Calendar API authentication:- Ensure this file is present as either
credentials.json
orsrc/credentials.json
depending on the environment setup. - The authentication flow cannot be interrupted once started, which might be cumbersome for users.
- Ensure this file is present as either
docker build -t vgcc_backend .
docker run -d --name vgcc_backend_app -p 8000:8000 vgcc_backend
Frontend requirements:
-
Conversation Chat Interface:
- Utilize the endpoint
/openAI/llm/response
for processing user inputs through ChatGPT.
- Utilize the endpoint
-
Google Calendar Account Management:
- Manage accounts using the
/calendar/authorize
endpoint. - Fetch events with
/calendar/get-calendar-events
using calendar input for dates in the formatYYYY-MM-DDThh:mm:ssZ
.
- Manage accounts using the
-
Application Context Reset:
- Reset all settings using
/calendar/delete-tokens
,/openAI/delete-text
, and/openAI/create-text
endpoints.
- Reset all settings using
To run the application:
uvicorn main:app --reload
This will host the API on http://127.0.0.1:8000
by default, accessible via your specified front-end application.
Access detailed API documentation generated by FastAPI at http://127.0.0.1:8000/docs
after running the application.