Skip to content

Commit

Permalink
feat: usage struct add CompletionTokensDetails (#863)
Browse files Browse the repository at this point in the history
  • Loading branch information
liushuangls authored Sep 26, 2024
1 parent e9d8485 commit fdd59d9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions common.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ package openai

// Usage Represents the total token usage per request to OpenAI.
type Usage struct {
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
PromptTokens int `json:"prompt_tokens"`
CompletionTokens int `json:"completion_tokens"`
TotalTokens int `json:"total_tokens"`
CompletionTokensDetails *CompletionTokensDetails `json:"completion_tokens_details"`
}

// CompletionTokensDetails Breakdown of tokens used in a completion.
type CompletionTokensDetails struct {
ReasoningTokens int `json:"reasoning_tokens"`
}

0 comments on commit fdd59d9

Please sign in to comment.