Invalid JSON returned by Structured Outputs response with error == nil
I am getting invalid JSON strings return using Structured Outputs. Unfortunately I cannot share the example because it contains private information. The code I am using is based on the Structured Outputs example in this repo.
The line below returns a nil error
chat, err := client.Chat.Completions.New(...)
Then when I try to unmarshal the data I get an “Unexpected end of JSON input” error from the line below
err = json.Unmarshal([]byte(chat.Choices[0].Message.Content), &...)
Inspecting the string chat.Choices[0].Message.Content I can see that it cuts off in the middle of generating a string value, before a closing brace.
Upon further inspection it look like the issue is that my response exceeds the output token limit of 16,384.
Though I think this should be indicated by the error from client.Chat.Completions.New(...)