Function calling using memory information instead of calling the function

My use case is that the function works correctly the first time it is called, but on subsequent calls, it seems to use memory data rather than forcing a fresh function call. The results from my function might have changed, but these changes are ignored because the assistant doesn’t recognize that it needs to perform the action again for the same query.

I’m logging whether the thread.run.requires_action event is called, and the first time, the function is called, and the answer is correct. If I ask the same question, which should trigger the function calling, the thread.run.requires_action is not triggered the second time.

I tried 'tool_choice' => 'required,' but this is not enough because it will force always calling a function, even when the answer does not need function calling.

It seems that memory is being checked before calling the function, but I need the assistant to always call the function, even if there’s a previous answer to the exact same question in the thread history.

The assistant has been created using gpt-3.5-turbo-0125.

Any suggestions?

1 Like

Hi!
Can you share your assistants’ instructions and function specifications for a more complete description of the issue at hand?
If you can’t share the whole instructions, you can provide the relevant parts only.

My first guess is that the function description needs to be more precise.
You can also run a comparison with a different model, like GPT-4 Turbo, to check if the instructions are too complex for 3.5.

I’ve only used the Langchain tooling, and not OpenAI’s proprietary function calling, so I’m guessing here, but you could try to actually just explain to the AI in the system prompt that it should never reuse cached results from prior function calls. If that doesn’t work, maybe add a ‘time’ parameter (or counter) that you increment in such a way as to make it never be the same cache key.