Skip to content

Commit b95fa74

Browse files
author
Stephen Solka
committed
move cache control into multi content
1 parent ea06dea commit b95fa74

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

chat.go

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,10 @@ const (
8787
)
8888

8989
type ChatMessagePart struct {
90-
Type ChatMessagePartType `json:"type,omitempty"`
91-
Text string `json:"text,omitempty"`
92-
ImageURL *ChatMessageImageURL `json:"image_url,omitempty"`
90+
Type ChatMessagePartType `json:"type,omitempty"`
91+
Text string `json:"text,omitempty"`
92+
ImageURL *ChatMessageImageURL `json:"image_url,omitempty"`
93+
CacheControl *CacheControl `json:"cache_control,omitempty"`
9394
}
9495

9596
type CacheControlType string
@@ -121,9 +122,6 @@ type ChatCompletionMessage struct {
121122

122123
// For Role=tool prompts this should be set to the ID given in the assistant's prior request to call a tool.
123124
ToolCallID string `json:"tool_call_id,omitempty"`
124-
125-
// CacheControl is used to control the caching behavior of the message. Used by Litellm.
126-
CacheControl *CacheControl `json:"cache_control,omitempty"`
127125
}
128126

129127
func (m ChatCompletionMessage) MarshalJSON() ([]byte, error) {
@@ -140,7 +138,6 @@ func (m ChatCompletionMessage) MarshalJSON() ([]byte, error) {
140138
FunctionCall *FunctionCall `json:"function_call,omitempty"`
141139
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
142140
ToolCallID string `json:"tool_call_id,omitempty"`
143-
CacheControl *CacheControl `json:"cache_control,omitempty"`
144141
}(m)
145142
return json.Marshal(msg)
146143
}
@@ -154,7 +151,6 @@ func (m ChatCompletionMessage) MarshalJSON() ([]byte, error) {
154151
FunctionCall *FunctionCall `json:"function_call,omitempty"`
155152
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
156153
ToolCallID string `json:"tool_call_id,omitempty"`
157-
CacheControl *CacheControl `json:"cache_control,omitempty"`
158154
}(m)
159155
return json.Marshal(msg)
160156
}
@@ -169,7 +165,6 @@ func (m *ChatCompletionMessage) UnmarshalJSON(bs []byte) error {
169165
FunctionCall *FunctionCall `json:"function_call,omitempty"`
170166
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
171167
ToolCallID string `json:"tool_call_id,omitempty"`
172-
CacheControl *CacheControl `json:"cache_control,omitempty"`
173168
}{}
174169

175170
if err := json.Unmarshal(bs, &msg); err == nil {
@@ -185,7 +180,6 @@ func (m *ChatCompletionMessage) UnmarshalJSON(bs []byte) error {
185180
FunctionCall *FunctionCall `json:"function_call,omitempty"`
186181
ToolCalls []ToolCall `json:"tool_calls,omitempty"`
187182
ToolCallID string `json:"tool_call_id,omitempty"`
188-
CacheControl *CacheControl `json:"cache_control,omitempty"`
189183
}{}
190184
if err := json.Unmarshal(bs, &multiMsg); err != nil {
191185
return err
@@ -392,7 +386,7 @@ type ChatCompletionResponse struct {
392386
PromptFilterResults []PromptFilterResult `json:"prompt_filter_results,omitempty"`
393387
// Citations is a list of URLs or references that the model used in generating its response.
394388
// This is primarily used by Perplexity AI models.
395-
Citations []string `json:"citations,omitempty"`
389+
Citations []string `json:"citations,omitempty"`
396390

397391
httpHeader
398392
}

0 commit comments

Comments
 (0)