Hi guys, do we need to specify tools and functions with every call to the API if we need to make use of it?
Doesn’t it preserve the context so that we only need to specify functions once? Then when a user chat comes, it calls the the function?
Welcome to our online developer forum! We’re thrilled to have you here.
When using the chat completions endpoint, it’s essential to remember that everything the AI needs to know, including the system message with instructions and the tool specifications, must be sent with each request.
If you’re using “assistants,” which act as a layer in front of the completions AI, some aspects are remembered and automatically sent when needed after being set up as an assistant. However, these details are still sent each time the AI generates a new response, incurring token costs.
The tools are injected into the first “system” message the AI receives in each API call. This initial system message, which includes the tool specifications, past chat history, and the latest input, must be persistent and provide the AI with a clear identity or purpose.
Feel free to explore the forum, ask questions, and share your insights. We’re here to support each other in navigating these technologies. Happy coding!
Thank you for a clear reply. Appreciate it.