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.
This commit is contained in:
Tim Misiak
2024-12-08 05:12:05 -08:00
committed by GitHub
parent c203ca001f
commit af5355f5b1

View File

@@ -179,7 +179,7 @@ func (m *ChatCompletionMessage) UnmarshalJSON(bs []byte) error {
type ToolCall struct {
// Index is not nil only in chat completion chunk object
Index *int `json:"index,omitempty"`
ID string `json:"id"`
ID string `json:"id,omitempty"`
Type ToolType `json:"type"`
Function FunctionCall `json:"function"`
}