Retrieve weekdays dates based on current date


I’m trying to develop a prompt that extracts dates based on a client availability. A client availability can be things like these:

  • I’m available tomorrow at 19h, friday all day and on the 16th from 14h to 18h
  • I’m available thursday at 14h, wednesday at 11h and next friday

For the first example, openai is capable of correctly extract all days, except “friday all day”, giving 2023-10-14, when it should be 2023-10-13. I’m passing the current date and current day of the week.
For the second example, openai can correctly extract thursday and wednesday, but friday is wrong. It says 2023-10-14, when it should be 2023-10-13.

The prompt that I’m using is the following:

"You are an assistant that helps summarize conversations from phone calls based on the transcription of these calls and collects specified information. Be brief in your responses. The current year is {}.

Example: [The current date in this example is 2023-10-02 07:00, and the day of the week is Monday.]
Customer: Good morning, I want to reschedule the delivery of my order. The order number is 406589721. I'm available tomorrow at 7 am, all day Friday, or on Wednesday starting from 2 pm, or on the 17th at 2 pm. Thank you.
Agent: {{'Customers availability': '[2023-10-03 07:00];[2023-10-06];[2023-10-04 14:00,2023-10-04 23:59];[2023-10-17 14:00]'\n}}

Respond in JSON format with the following fields. Do not include square brackets in your final response.
It is MANDATORY for all fields to be filled.
Customers availability: [Current date: 2023-10-09, monday. If the user mentions a day of the week equal to monday, consider monday of the following week. IF THE USER MENTIONS THE DAY OF THE WEEK, FIRST CALCULATE THE DATE FOR THAT DAY BASED ON THE CURRENT DATE 2023-10-09. All mentioned dates are independent, so for each, always compare with the current date. If the user does not mention availability, return ''. The week starts on Monday. Each date must be individually surrounded by []]

Example of one of the wrong results:

{'role': 'user', 'content': 'Good morning, I want to reschedule the delivery of my order. The order number is 406589721. Ill be at home two days from now starting at 7 pm, all day Friday, and on the 16th from 2 pm to 6 pm. Thank you.'}
{'role': 'assistant', 'content': '{\n "Customers availability": "[2023-10-11 19:00];[2023-10-14];[2023-10-16 14:00,2023-10-16 18:00]" \n}'}

It seems like it has difficulty to extract dates when there are weekdays mixed with other date formats. Is there any way to make gpt model process and retrieve each date individually?

OpenAI is set with a temperature of 0.7 and the model used is ‘gpt-35-turbo’.

Thank you,
Maria Santos