Hi everybody,
I have been developing an assistant using the Assistant API with GPT 4o-mini.
My assistant has about 10~ functions and I haven’t had any problems until a while ago, when I tried to ask the assistant to break its response into small chunks, separating them in XML tags or JSON.
For example:
<message_n>Hi, Matheus</message_n>
<message_n>How are you doing today?</message_n>
or a JSON with the following schema:
{
"messages": ["Hi, Matheus", "How are you doing today?"]
}
The assistant managed to respond the way I asked but for some reason, it got crazy and started calling functions totally out of context and for several times.
As soon as I remove the response format instruction from the system prompt, the assistant starts acting ‘normal’ again and only calls functions that have context with the conversation.
Another test that I do is the following: I remove the response format instructions from the prompt and ask the assistant to list products. It calls the function but I intentionally turned off the Product API from where the data comes from. The request will fail, I will return an error to the assistant and it will try once again. Once it’s failed for the second time, the assistant returns with a response saying ‘Sorry, I couldn’t list products but I can try to help you some other way bla bla bla’
Now, as soon as I add the response instructions to the prompt, either to split the messages using a JSON schema or XML tags, it calls the function non-stop, more than 15 times!
I have tried to set up the response format to JSON schema but the issue persists, the assistant is calling functions that have nothing to do with the context of the conversation, and most of the time, calls the same functions repeatedly.
My original prompt is in Portuguese but I will leave here the translation of it; anyway, it’s a very simple prompt.
**Instructions to Format Your Response:**
I want you to divide your responses into logical segments (such as at the end of sentences or paragraphs) to improve readability.
Place each response between XML tags, such as `<message_n>`, to indicate the beginning and end of each segment.
Has anybody faced the same issue??