TimeTuner is a Python application that facilitates scheduling appointments using OpenAI's GPT-3.5 model and Google Calendar API. It parses office hours, checks availability, and creates events in the calendar.
- Parses office hours from a text document.
- Interacts with users to schedule appointments within specified office hours.
- Checks availability on Google Calendar.
- Creates events in Google Calendar if the slot is available.
-
Clone the repository:
git clone https://github.com/harshithsaiv/TimeTuner.git cd TimeTuner
-
Set up environment variables: Create a
.env
file in the root directory with your OpenAI API key:OPENAI_API_KEY=your_openai_api_key
-
Run the main script:
python main.py
-
Follow the prompts to interact with the ChatGPT interface and schedule appointments.
- Google Drive API: The script downloads office hours from a Google Drive document named
office_hours
. - Office Hours: Ensure the
office_hours
document in Google Drive contains the office hours in the following format:Mon: 9:00am to 5:00pm Tue: 9:00am to 5:00pm ...
- parse_office_hours(office_hours_str): Parses office hours from a multi-line string into a dictionary.
- is_appointment_valid(day, time_str, office_hours): Checks if the proposed appointment time is within office hours.
- get_response(client, message): Gets a response from the GPT-3.5 model.
- chat_with_chatgpt(office_hours_str): Main function to interact with users and schedule appointments.
- authenticate_google_calendar(): Authenticates and returns a Google Calendar service object.
- check_availability(service, day, time_str, office_hours, next_week=False): Checks the availability of a time slot.
- create_event(service, start_time, end_time, summary, description=''): Creates a calendar event.
- get_credentials(token_file='token.json', creds_file='credentials.json'): Retrieves or creates credentials based on token and credentials files.
- download_office_hours_doc(creds): Downloads content of the
office_hours
document as plain text.
- main(): Main function that orchestrates the document download and interaction with ChatGPT.
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
- Commit your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin feature-name
- Create a new Pull Request.
This project is licensed under the MIT License. See the LICENSE file for details.
For any inquiries, please contact Harshith Sai Veeraiah at [email protected].