go-openai
go-openai copied to clipboard
support ChatCompletionStreamResponse Usage
https://github.com/sashabaranov/go-openai/blob/master/chat_stream.go#L22
type ChatCompletionStreamResponse struct {
ID string `json:"id"`
Object string `json:"object"`
Created int64 `json:"created"`
Model string `json:"model"`
Choices []ChatCompletionStreamChoice `json:"choices"`
PromptAnnotations []PromptAnnotation `json:"prompt_annotations,omitempty"`
Usage Usage `json:"usage"`
}
// ChatCompletionStream
// Note: Perhaps it is more elegant to abstract Stream using generics.
type ChatCompletionStream struct {
*streamReader[ChatCompletionStreamResponse]
}