#malformed JSON response

1 messages · Page 1 of 1 (latest)

stray moon
#

I got this chat result:

{
  "id" : "chatcmpl-AAgIt6YKiKLdKWewL2qwDRk7923Ti",
  "model" : "gpt-4-turbo-2024-04-09",
  "object" : "chat.completion",
  "system_fingerprint" : "fp_22b855c4b7",
  "choices" : [
    {
      "message" : {
        "content" : "\n  {\n    \"message\": \"An enrollment SMS code has been sent. Please provide the code to complete the enrollment process.\"\n  }\n{\n  \"message\": \"An enrollment SMS code has been sent to Heather. Please provide the code to complete the enrollment process.\"\n}",
        "role" : "assistant"
      },
      "finish_reason" : "stop",
      "index" : 0
    }
  ],
  "created" : 1727109259,
  "usage" : {
    "total_tokens" : 8464,
    "completion_tokens" : 57,
    "prompt_tokens" : 8407
  }
}

The content field contained a malformed JSON result, it duplicated the message, which is not valid JSON, since the Swift OpenAI decoder expected one valid JSON object here. Usually it works, but sometimes I get this garbage result.

south houndBOT
#

@stray moon

Please follow the posting guidelines.

For better assistance from the community or an OpenAI team member, please follow the posting guidelines by clicking the button below.

hot sonnet
#

same here

#

with gpt-4o