Skip to content

Commit af5355f

Browse files
authored
Fix ID field to be optional (#911)
The ID field is not always present for streaming responses. Without omitempty, the entire ToolCall struct will be missing.
1 parent c203ca0 commit af5355f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

chat.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func (m *ChatCompletionMessage) UnmarshalJSON(bs []byte) error {
179179
type ToolCall struct {
180180
// Index is not nil only in chat completion chunk object
181181
Index *int `json:"index,omitempty"`
182-
ID string `json:"id"`
182+
ID string `json:"id,omitempty"`
183183
Type ToolType `json:"type"`
184184
Function FunctionCall `json:"function"`
185185
}

0 commit comments

Comments
 (0)