Enable streaming UI updates for chat responses
This commit is contained in:
@@ -37,6 +37,19 @@ type ChatCompletionResponse struct {
|
||||
Usage Usage `json:"usage"`
|
||||
}
|
||||
|
||||
// ChatCompletionStreamEvent represents a single chunk in a streaming chat completion.
|
||||
type ChatCompletionStreamEvent struct {
|
||||
ID string `json:"-"`
|
||||
Role string `json:"-"`
|
||||
Content string `json:"-"`
|
||||
FinishReason string `json:"-"`
|
||||
Usage *Usage `json:"-"`
|
||||
Done bool `json:"-"`
|
||||
}
|
||||
|
||||
// ChatCompletionStreamHandler consumes streaming completion events.
|
||||
type ChatCompletionStreamHandler func(ChatCompletionStreamEvent) error
|
||||
|
||||
// APIError captures structured error responses returned by the API.
|
||||
type APIError struct {
|
||||
Message string `json:"message"`
|
||||
|
Reference in New Issue
Block a user