Openai tools does not work as expected

Today’s date does not need to be a function (where an iteration can be thousands of context tokens). That can just be injected into the system prompt.

import time

struct_time_local = time.localtime()
struct_time_utc = time.gmtime()
local_time = time.strftime("Session start time (local): %Y-%m-%d %H:%M", struct_time_local)
utc_time = time.strftime("Session start time (UTC): %Y-%m-%d %H:%M", struct_time_utc)

system = [{"role": "system", "content": 'You are an AI assistant.'},
    {"role": "user", "content": 'As a connection debugger, you only reply with the date.'}]

system[0]['content'] += f"\n{local_time}"

The descriptions of functions and their parameters can be longer and multi-line.

It seems what you need is that if the user requests something fulfilled by the final function, it must state in the description where those parameters come from, and that the function cannot be used alone. Ambiguous fields can even have the AI making up stuff to send. I recommend:

“name”: “send_birthday_greetings”,
“description”: “Requires AI knowledge of today’s date and AI knowledge of friend list and friend birthdays. AI does not have pretrained knowledge of these events. Parameters must be obtained by function calls invoked immediately before.”,