Skip to content

Commit 8868652

Browse files
committed
docs: enhance usage statistics and API integration
- Update the `Usage` struct documentation to provide more detailed information about token usage statistics - Add `PromptTokensDetails` field to the `Usage` struct Signed-off-by: Bo-Yi Wu <[email protected]>
1 parent 628d3cf commit 8868652

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

core/openai.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ import (
66
"github.com/sashabaranov/go-openai"
77
)
88

9-
// Usage represents the token usage details for an OpenAI API request.
10-
// It includes the number of tokens used for the prompt, the completion,
11-
// and the total tokens used. Additionally, it may include detailed
12-
// information about the completion tokens.
9+
// Usage represents the token usage statistics for a given request.
10+
// It includes counts for the prompt tokens, the completion tokens, and the overall total tokens.
11+
// In addition, it may provide detailed breakdowns for both prompt and completion tokens,
12+
// allowing for deeper insights into token distribution if the corresponding details are available.
1313
type Usage struct {
1414
PromptTokens int
1515
CompletionTokens int
1616
TotalTokens int
17+
PromptTokensDetails *openai.PromptTokensDetails
1718
CompletionTokensDetails *openai.CompletionTokensDetails
1819
}
1920

0 commit comments

Comments
 (0)