I’ve been experimenting with the GPT-4 model (gpt-4-1106-preview) and integrating custom tools in my API. In certain scenarios, the model needs to both trigger a tools and generate a narrative text response simultaneously in one API request.
So far, my tests have resulted in either a regular text response or a tool invocations response, but never both at the same time. I’m wondering if it’s possible to achieve this simultaneous action within a single request. If so, could you provide guidance or examples on how to format such a request correctly? Are there specific considerations or limitations in the API that I should be aware of?
Any insights or suggestions would be greatly appreciated.
It is possible for the AI to generate both content and tool call.
It is just something that AI models have become resistant to since release, even with the exact same model name.
You just need lots of system prompt language that explains that any API function must only be invoked as the final part of response output after providing a description explaining what the AI is doing.
Thank you! System language did the trick for me.
This is what I included as the last sentence in system:
“Important: Each round you first answer the user. At the very end of your response, you invoke any function call.”
You can give the assistant a tool called say() that it can use to say things to the user. You can then further simplify your logic by mapping text responses from the model to say() calls