OpenAI 400 Error about JSON and and String

Hi @YourAverageDev

You shouldn’t pass the tools when you are replying with the response of the function call.

Also here’s the correct way to append the function call response to the end of messages to be passed to the model:

messages.push({
        tool_call_id: toolCall.id,
        role: "tool",
        name: functionName,
        content: functionResponse,
      }); // extend conversation with function response