You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
messageParams := []anthropic.MessageParam{
anthropic.NewUserMessage(anthropic.NewTextBlock("What is this control character: \u0002?")),
}
// invoke with streaming, or non-streaming and get a 400 back.
This results in a JSON payload like:
{\"messages\":[{\"content\":[{\"text\":\"What is this control character: \\x02.\",\"type\":\"text\"}],\"role\":\"user\"}]}
Which results in a 400 returned by Anthropic's APIs.
This JSON cannot be parsed in all cases, for example:
anthropicBody := "{\"messages\":[{\"content\":[{\"text\":\"What is this control character: \\x02.\",\"type\":\"text\"}],\"role\":\"user\"}]}"
var data map[string]interface{}
err := json.Unmarshal([]byte(anthropicBody), &data)
results in an error:
invalid character 'x' in string escape code
When testing other model SDKs the resulting JSON payload for a message like this is of the form:
{\"messages\":[{\"content\":\"What is this control character: \\u0002.\",\"role\":\"user\"}]}
Which can be parsed using the strategy above.
The text was updated successfully, but these errors were encountered:
Consider these messageParams:
This results in a JSON payload like:
Which results in a 400 returned by Anthropic's APIs.
This JSON cannot be parsed in all cases, for example:
results in an error:
When testing other model SDKs the resulting JSON payload for a message like this is of the form:
Which can be parsed using the strategy above.
The text was updated successfully, but these errors were encountered: