Package com.azure.ai.inference.models
Class CompletionsUsage
java.lang.Object
com.azure.ai.inference.models.CompletionsUsage
- All Implemented Interfaces:
com.azure.json.JsonSerializable<CompletionsUsage>
public final class CompletionsUsage
extends Object
implements com.azure.json.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 TypeMethodDescriptionstatic CompletionsUsage
fromJson
(com.azure.json.JsonReader jsonReader) Reads an instance of CompletionsUsage from the JsonReader.int
Get the completionTokens property: The number of tokens generated across all completions emissions.int
Get the promptTokens property: The number of tokens in the provided prompts for the completions request.int
Get the totalTokens property: The total number of tokens processed for the completions request and response.com.azure.json.JsonWriter
toJson
(com.azure.json.JsonWriter jsonWriter) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.azure.json.JsonSerializable
toJson, toJson, toJsonBytes, toJsonString
-
Method Details
-
getCompletionTokens
public int getCompletionTokens()Get the completionTokens property: The number of tokens generated across all completions emissions.- Returns:
- the completionTokens value.
-
getPromptTokens
public int getPromptTokens()Get the promptTokens property: The number of tokens in the provided prompts for the completions request.- Returns:
- the promptTokens value.
-
getTotalTokens
public int getTotalTokens()Get the totalTokens property: The total number of tokens processed for the completions request and response.- Returns:
- the totalTokens value.
-
toJson
- Specified by:
toJson
in interfacecom.azure.json.JsonSerializable<CompletionsUsage>
- Throws:
IOException
-
fromJson
Reads an instance of CompletionsUsage from the JsonReader.- Parameters:
jsonReader
- The JsonReader being read.- Returns:
- An instance of CompletionsUsage if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
- Throws:
IllegalStateException
- If the deserialized JSON object was missing any required properties.IOException
- If an error occurs while reading the CompletionsUsage.
-