diff --git a/message.go b/message.go index 052dc114..4ff28a1b 100644 --- a/message.go +++ b/message.go @@ -3359,7 +3359,7 @@ func (r *InputJSONDelta) UnmarshalJSON(data []byte) error { // The properties Schema, Type are required. type JSONOutputFormatParam struct { // The JSON schema of the format - Schema map[string]any `json:"schema,omitzero,required"` + Schema json.RawMessage `json:"schema,omitzero,required"` // This field can be elided, and will marshal its zero value as "json_schema". Type constant.JSONSchema `json:"type,required"` paramObj @@ -6367,7 +6367,6 @@ func (u ThinkingConfigParamUnion) GetType() *string { return nil } - type ThinkingDelta struct { Thinking string `json:"thinking,required"` Type constant.ThinkingDelta `json:"type,required"` diff --git a/message_test.go b/message_test.go index 9062a015..f934694e 100644 --- a/message_test.go +++ b/message_test.go @@ -62,9 +62,7 @@ func TestMessageNewWithOptionalParams(t *testing.T) { OutputConfig: anthropic.OutputConfigParam{ Effort: anthropic.OutputConfigEffortLow, Format: anthropic.JSONOutputFormatParam{ - Schema: map[string]any{ - "foo": "bar", - }, + Schema: json.RawMessage(`{"foo": "bar"}`), }, }, ServiceTier: anthropic.MessageNewParamsServiceTierAuto, @@ -171,9 +169,7 @@ func TestMessageCountTokensWithOptionalParams(t *testing.T) { OutputConfig: anthropic.OutputConfigParam{ Effort: anthropic.OutputConfigEffortLow, Format: anthropic.JSONOutputFormatParam{ - Schema: map[string]any{ - "foo": "bar", - }, + Schema: json.RawMessage(`{"foo": "bar"}`), }, }, System: anthropic.MessageCountTokensParamsSystemUnion{ diff --git a/messagebatch_test.go b/messagebatch_test.go index f0d609fe..4bd4b39f 100644 --- a/messagebatch_test.go +++ b/messagebatch_test.go @@ -4,6 +4,7 @@ package anthropic_test import ( "context" + "encoding/json" "errors" "os" "testing" @@ -62,9 +63,7 @@ func TestMessageBatchNew(t *testing.T) { OutputConfig: anthropic.OutputConfigParam{ Effort: anthropic.OutputConfigEffortLow, Format: anthropic.JSONOutputFormatParam{ - Schema: map[string]any{ - "foo": "bar", - }, + Schema: json.RawMessage(`{"foo": "bar"}`), }, }, ServiceTier: "auto",