I was tracking some weird behaviour for my agent, and noticed that when it uses the same tools twice with the open ai plugin all the tools usage are moved to the bottom of that last tool that was executed. So for example, if I have a tool to save user data, and I call it twice (let's say the second call is 1 min later to fix the name of the user), now in the chat context both tool outputs appear at the moment the second tools was executed, which might be the cause of the agent behaving weirdly. I'm printing the messages in the AsyncCompletions class, in the create method (
.../openai/resources/chat/completions/completions.py
) since that is what the LLMStream calls when using the llm through
self._client.chat.completions.create
.
Is this expected?