Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
liushuangls committed May 7, 2024
1 parent 8cc1ee2 commit d026fe3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 4 additions & 1 deletion chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,10 @@ type ChatCompletionRequest struct {
}

type StreamOptions struct {
// If set, an additional chunk will be streamed before the data: [DONE] message. The usage field on this chunk shows the token usage statistics for the entire request, and the choices field will always be an empty array. All other chunks will also include a usage field, but with a null value.
// If set, an additional chunk will be streamed before the data: [DONE] message.
// The usage field on this chunk shows the token usage statistics for the entire request,
// and the choices field will always be an empty array.
// All other chunks will also include a usage field, but with a null value.
IncludeUsage bool `json:"include_usage,omitempty"`
}

Expand Down
4 changes: 3 additions & 1 deletion chat_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ type ChatCompletionStreamResponse struct {
SystemFingerprint string `json:"system_fingerprint"`
PromptAnnotations []PromptAnnotation `json:"prompt_annotations,omitempty"`
PromptFilterResults []PromptFilterResult `json:"prompt_filter_results,omitempty"`
// An optional field that will only be present when you set stream_options: {"include_usage": true} in your request. When present, it contains a null value except for the last chunk which contains the token usage statistics for the entire request.
// An optional field that will only be present when you set stream_options: {"include_usage": true} in your request.
// When present, it contains a null value except for the last chunk which contains the token usage statistics
// for the entire request.
Usage *Usage `json:"usage,omitempty"`
}

Expand Down
3 changes: 2 additions & 1 deletion chat_stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,8 @@ func compareChatResponses(r1, r2 openai.ChatCompletionStreamResponse) bool {
if r1.Usage == nil || r2.Usage == nil {
return false
}
if r1.Usage.PromptTokens != r2.Usage.PromptTokens || r1.Usage.CompletionTokens != r2.Usage.CompletionTokens || r1.Usage.TotalTokens != r2.Usage.TotalTokens {
if r1.Usage.PromptTokens != r2.Usage.PromptTokens || r1.Usage.CompletionTokens != r2.Usage.CompletionTokens ||
r1.Usage.TotalTokens != r2.Usage.TotalTokens {
return false
}
}
Expand Down

0 comments on commit d026fe3

Please sign in to comment.