No more forms: LLM interface for calendar events
🗓️ Scheduling calendar events from a single text field
I like my calendar. I run my life from my calendar. I just don’t like adding events to it.
Isn’t this form a bit long? ⬇️
The AI assistants of 2024 get increasingly more capable (see “In other news”), so maybe one of them will eventually take over my calendar. In the meantime, we can build a calendar assistant ourselves :)!
Single text input
I’d love something that can just take single input:
and turn it into an event on my Google Calendar.
Parsing the event
The first thing to do is to parse the event from the free-form description. This is a great fit for a Large Language Model.
Let’s try this prompt:
prompt = f"Parse the following event description into structured JSON fields: 'dinner with Mark on Jun 14'. The fields should include name, description, location, start_datetime, and end_datetime. Put an emoji relevant to the event at the beginning of the name."
We can use any of the many LLMs on the market for this.
I went for the OpenAI GPT API with its handy JSON mode. It’s a flag we can set on the request that ensures that the response produced by the model is returned as structured data, with name, description, location, etc. returned as different fields.
Give it a try
Let’s see how it goes! For “dinner with Mark on Jun 14” we get:
There is a lot to like here! The model decided that 19h to 21h is a sensible time for dinner. It left the location empty, as we didn’t mention anything about it. Most importantly: it picked the right emoji :).
Add to calendar
Adding the event to calendar is pretty straightforward coding-wise, but requires a bit of special dance to set up the API access. (Details here.)
One more button and one more click later:
Demo
Aaand it works! Here’s a quick video.
More on this
🖼️ The UI is built using Gradio.
📝 Source code: app.py, schedule.py
💡 If we include the current date in the prompt (for example: … Today's date is 14 May 2024), the app will be able to correctly schedule events such as “dinner this Friday”
In other news
A week of mind-bending demoes:
🤖 OpenAI unveiled gpt4o, featuring more natural voice conversations. The model imitates human intonation and emotion. The future from the movie Her seems to be around the corner
🤖 Google DeepMind demoed Astra, leaning more into live video understanding.
Postcard from Paris
Happy to be back ! I tried going to a Taylor Swift show as a jetlag coping strategy. It worked 💫 !
Have a great week,
– Przemek
Glad you had a great time at the Swift concert, Przemek.
Probably AI will go through the codes of the various assistants.