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:
2
chat.go
2
chat.go
@@ -179,7 +179,7 @@ func (m *ChatCompletionMessage) UnmarshalJSON(bs []byte) error {
|
|||||||
type ToolCall struct {
|
type ToolCall struct {
|
||||||
// Index is not nil only in chat completion chunk object
|
// Index is not nil only in chat completion chunk object
|
||||||
Index *int `json:"index,omitempty"`
|
Index *int `json:"index,omitempty"`
|
||||||
ID string `json:"id"`
|
ID string `json:"id,omitempty"`
|
||||||
Type ToolType `json:"type"`
|
Type ToolType `json:"type"`
|
||||||
Function FunctionCall `json:"function"`
|
Function FunctionCall `json:"function"`
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user