formatMessages(messages) {
    if (!NO_SYSTEM_PROMPT_MODELS.includes(this.model)) return messages;

    // Replace the system message with a user/assistant message pair
    const formattedMessages = [];
    for (const message of messages) {
      if (message.role === "system") {
        formattedMessages.push({
          role: "user",
          content: message.content,
        });
        formattedMessages.push({
          role: "assistant",
          content: "Okay, I'll follow your instructions.",
        });
        continue;
      }
      formattedMessages.push(message);
    }
    return formattedMessages;
  }
Format the messages to the format required by the Gemini API since some models do not support system prompts.
@see {NO_SYSTEM_PROMPT_MODELS}
@param {import("openai").OpenAI.ChatCompletionMessage[]} messages
@returns {import("openai").OpenAI.ChatCompletionMessage[]}