Hello, I am currently developing an AI calendar which is a widget based on ChatGPT.
My problem is simple. When I ask for the date on chatgpt directly it gives me today’s date without any problem. When I make an API call, it is unable to give me today’s date.
My question is simple. Why and how can I solve that ??
Thanks in advance. Looking forward to reading you.
You have to supply the date and other relevant information yourself before the AI can make use of it. I recommend putting the date in the system prompt.
There’s no need for a “function call” for a date - although dealing with dates you will find it beneficial to add some functions that can compute or display calendars, because the AI won’t do a good job of querying for a question of “got any available appointments next tuesday?”.
Instead, I’d recommend two system prompt dates to keep the AI straight, because a system prompt that appears earlier than later chat exchanges can also serve to confuse the understanding of what’s going on if you provide the precision of time: “Conversation session start time” AND “current time”.
Concur with the other answers that just inserting it into prompt from your system is better and it should be able to recall it when requested. Does use a bit more tokens, but the cost is dropping all the time.
Ohh, now I understand. If you are using the api in a programming setup, you can just send the current date using the libraries from the programming language. If I may help, please tell me what you are using!
I am working with the assistant api. And had the best results with a function call that the assistant can use to request the time. Because assistants don’t have system prompt to my knowledge, and I still am debating your approach using prompts with session and current time. I was wondering if you have any success with such an approach for assistants?