CompletionsUsage Class
- java.
lang. Object - com.
azure. ai. openai. models. CompletionsUsage
- com.
Implements
public final class CompletionsUsage
implements JsonSerializable<CompletionsUsage>
Representation of the token counts processed for a completions request. Counts consider all tokens across prompts, choices, choice alternates, best_of generations, and other consumers.
Method Summary
Modifier and Type | Method and Description |
---|---|
static
Completions |
fromJson(JsonReader jsonReader)
Reads an instance of Completions |
int |
getCompletionTokens()
Get the completion |
Completions |
getCompletionTokensDetails()
Get the completion |
int |
getPromptTokens()
Get the prompt |
Completions |
getPromptTokensDetails()
Get the prompt |
int |
getTotalTokens()
Get the total |
Json |
toJson(JsonWriter jsonWriter) |
Methods inherited from java.lang.Object
Method Details
fromJson
public static CompletionsUsage fromJson(JsonReader jsonReader)
Reads an instance of CompletionsUsage from the JsonReader.
Parameters:
Returns:
Throws:
getCompletionTokens
public int getCompletionTokens()
Get the completionTokens property: The number of tokens generated across all completions emissions.
Returns:
getCompletionTokensDetails
public CompletionsUsageCompletionTokensDetails getCompletionTokensDetails()
Get the completionTokensDetails property: Breakdown of tokens used in a completion.
Returns:
getPromptTokens
public int getPromptTokens()
Get the promptTokens property: The number of tokens in the provided prompts for the completions request.
Returns:
getPromptTokensDetails
public CompletionsUsagePromptTokensDetails getPromptTokensDetails()
Get the promptTokensDetails property: Details of the prompt tokens.
Returns:
getTotalTokens
public int getTotalTokens()
Get the totalTokens property: The total number of tokens processed for the completions request and response.
Returns:
toJson
Applies to
Azure SDK for Java