diff --git a/chat.go b/chat.go index 8b8172ded..2a53c1697 100644 --- a/chat.go +++ b/chat.go @@ -121,7 +121,7 @@ type ChatCompletionMessage struct { ToolCallID string `json:"tool_call_id,omitempty"` // Messari custom fields - Prefix bool `json:"prefix"` + Prefix bool `json:"prefix,omitempty"` } func (m ChatCompletionMessage) MarshalJSON() ([]byte, error) { @@ -139,6 +139,7 @@ func (m ChatCompletionMessage) MarshalJSON() ([]byte, error) { FunctionCall *FunctionCall `json:"function_call,omitempty"` ToolCalls []ToolCall `json:"tool_calls,omitempty"` ToolCallID string `json:"tool_call_id,omitempty"` + Prefix bool `json:"prefix,omitempty"` }(m) return json.Marshal(msg) } @@ -153,6 +154,7 @@ func (m ChatCompletionMessage) MarshalJSON() ([]byte, error) { FunctionCall *FunctionCall `json:"function_call,omitempty"` ToolCalls []ToolCall `json:"tool_calls,omitempty"` ToolCallID string `json:"tool_call_id,omitempty"` + Prefix bool `json:"prefix,omitempty"` }(m) return json.Marshal(msg) } @@ -168,6 +170,7 @@ func (m *ChatCompletionMessage) UnmarshalJSON(bs []byte) error { FunctionCall *FunctionCall `json:"function_call,omitempty"` ToolCalls []ToolCall `json:"tool_calls,omitempty"` ToolCallID string `json:"tool_call_id,omitempty"` + Prefix bool `json:"prefix,omitempty"` }{} if err := json.Unmarshal(bs, &msg); err == nil { @@ -184,6 +187,7 @@ func (m *ChatCompletionMessage) UnmarshalJSON(bs []byte) error { FunctionCall *FunctionCall `json:"function_call,omitempty"` ToolCalls []ToolCall `json:"tool_calls,omitempty"` ToolCallID string `json:"tool_call_id,omitempty"` + Prefix bool `json:"prefix,omitempty"` }{} if err := json.Unmarshal(bs, &multiMsg); err != nil { return err diff --git a/messages.go b/messages.go index 47eb0cd89..538833f54 100644 --- a/messages.go +++ b/messages.go @@ -26,7 +26,7 @@ type Message struct { httpHeader // Messari custom fields - Prefix bool `json:"prefix"` + Prefix bool `json:"prefix,omitempty"` } type MessagesList struct {