Functions response sometimes come out of place

From time to time, instead of the function calling coming in the correct “tool_calls”, it comes in a weird way inside the content, like the below:

  "id": "chatcmpl-9SqVjNJZpOji0YmL2jLfUDeaWUJWu",
  "object": "chat.completion",
  "created": 1716662063,
  "model": "gpt-3.5-turbo-0125",
  "choices": [
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "```json\n{\n  \"tool_uses\": [\n    {\n      \"recipient_name\": \"functions.jump\",\n      \"parameters\": {}\n    }\n  ]\n}\n```"
      "logprobs": null,
      "finish_reason": "stop"
  "usage": {
    "prompt_tokens": 758,
    "completion_tokens": 34,
    "total_tokens": 792
  "system_fingerprint": null
1 Like

Do you have JSON mode on and is the function calling at least correct.

JSON mode isn’t necessary though. I prefer not to use so the model can “reason” out the creation.

1 Like

JSON mode is not on, and yes, the function calling is ‘correct’ in the sense that I did want to call the function called ‘jump’.

I thing it’s worth saying this starts to happen after some back and forth messages, when the conversation history has ~15 elements (counting both assistant and user messages)