class

OpenAI::CompletionUsage

Inherits JSON::Serializable < Reference < Object

Usage statistics for the completion request.

Constructors

new(completion_tokens : Int64 = 0, prompt_tokens : Int64 = 0, total_tokens : Int64 = 0, completion_tokens_details : CompletionUsageCompletionTokensDetails | Nil = nil, prompt_tokens_details : CompletionUsagePromptTokensDetails | Nil = nil)
Source
new(*, __pull_for_json_serializable pull : JSON::PullParser)
Source

Instance methods

completion_tokens

Number of tokens in the generated completion.

Source
completion_tokens=(completion_tokens : Int64)

Number of tokens in the generated completion.

Source
completion_tokens_details

Breakdown of tokens used in a completion.

Source
completion_tokens_details=(completion_tokens_details : CompletionUsageCompletionTokensDetails | Nil)

Breakdown of tokens used in a completion.

Source
prompt_tokens

Number of tokens in the prompt.

Source
prompt_tokens=(prompt_tokens : Int64)

Number of tokens in the prompt.

Source
prompt_tokens_details

Breakdown of tokens used in the prompt.

Source
prompt_tokens_details=(prompt_tokens_details : CompletionUsagePromptTokensDetails | Nil)

Breakdown of tokens used in the prompt.

Source
total_tokens

Total number of tokens used in the request (prompt + completion).

Source
total_tokens=(total_tokens : Int64)

Total number of tokens used in the request (prompt + completion).

Source