Automatuc Function Calling bug

Currently, I am working on a chat-based model, but I am facing an issue. For example, I send my query, and the LLM responds with a specific function call, such as web_search. However, when I send a “hi” message afterwards, it automatically triggers the web_search function call again. Additionally, sometimes when I ask a different query, it returns the response from an earlier conversation, appending it to the response for the current query.

How can I resolve this issue of sticking to one context? Ideally, the system should maintain context correctly and respond to new questions appropriately, similar to how OpenAI’s chat maintains context and answers based on the newly asked question.