Hello, this is my first time developing an assistant bot and I ran into a problem. Perhaps I have already solved it before, but I did not find the answer. The problem is that I’ve created a function and I’m waiting for the “year” or “month” that the user will specify, and when I test, I get incorrect data. Here’s my query: What are the free days this month? But in the argument I get: year: 2023, month: April. When, like now, January 2024.
I created an assistant in the office and specified the function there:
{
"name": "get_free_appointments",
"parameters": {
"type": "object",
"properties": {
"year": {
"type": "integer",
"description": "What year does the patient want to make an appointment for? If the patient does not specify the year, it means the current year. The specified year cannot be earlier than the current one. And the year cannot be more than 1 from the current year"
},
"month": {
"type": "integer",
"description": "For which month the patient wants to make an appointment. If the patient does not specify the month, then the month is the current month. The specified month cannot be less than the current month. And no more than 2 from the current month"
}
},
"required": []
},
"description": "Get a list of available days to record."
}
Then I wrote code in python to test (I think there is no need to write all the code):
data = run.required_action.submit_tool_outputs.tool_calls[0]
if data.function.name == "get_free_appointments":
funct_id = data.id
arguments = data.function.arguments
args = json.loads(arguments)
year = int(args['year'])
month = int(args['month'])
run = client.beta.threads.runs.submit_tool_outputs(
thread_id=thread.id,
run_id=run.id,
tool_outputs=[
{
"tool_call_id": funct_id,
"output": json.dumps({
"days": get_days(year, month)
})
}
]
)
print(run.required_action):
RequiredAction(submit_tool_outputs=RequiredActionSubmitToolOutputs(tool_calls=[RequiredActionFunctionToolCall(id=‘call_CqaiRkkqNO90EnisKWzxSdqc’, function=Function(arguments=‘{“year”:2023,“month”:4}’, name=‘get_free_appointments’), type=‘function’)]), type=‘submit_tool_outputs’)
I’m writing a request: “I want to make an appointment this month”
But for some reason, I get the wrong year and month.
I use model: gpt-4-1106-preview
Code interpreter: Off
Retrieval: On
Files: no