Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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)
}
Expand All @@ -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)
}
Expand All @@ -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 {
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ type Message struct {
httpHeader

// Messari custom fields
Prefix bool `json:"prefix"`
Prefix bool `json:"prefix,omitempty"`
}

type MessagesList struct {
Expand Down