Hello,
I encounter an issue with assistants api when dealing with time.
i have a custom function that is helping to assistant to access current time.
# custom function
def get_current_time():
current_time = datetime.now()
minutes = current_time.minute
hour = current_time.hour
day = current_time.day
month = current_time.month
year = current_time.year
data = {'minutes': minutes,
'hours': hour,
'day': day,
'month': month,
"year": year}
json_data = json.dumps(data)
return json_data
# Assistant code
if run.status == 'requires_action':
for tool_call in run.required_action.submit_tool_outputs.tool_calls:
if tool_call.function.name == 'get_current_time':
output = get_current_time()
client.beta.threads.runs.submit_tool_outputs(
thread_id=session["thread_id"],
run_id=run.id,
tool_outputs=[{
"tool_call_id": tool_call.id,
"output": json.dumps(output)
}]
)
but when it returns response, it is altering year and month: "datetime":"2023-11-27T18:32:00"
.
Result had to be "datetime":"2024-11-19T18:32:00"
.
I’m using gpt-4o-mini as model for assistant.
I want to know if there is a way to solve this problem.