Class RunCompletionUsage

java.lang.Object
com.azure.ai.openai.assistants.models.RunCompletionUsage
All Implemented Interfaces:
com.azure.json.JsonSerializable<RunCompletionUsage>

public final class RunCompletionUsage extends Object implements com.azure.json.JsonSerializable<RunCompletionUsage>
Usage statistics related to the run. This value will be `null` if the run is not in a terminal state (i.e. `in_progress`, `queued`, etc.).
  • Method Summary

    Modifier and Type
    Method
    Description
    fromJson(com.azure.json.JsonReader jsonReader)
    Reads an instance of RunCompletionUsage from the JsonReader.
    long
    Get the completionTokens property: Number of completion tokens used over the course of the run.
    long
    Get the promptTokens property: Number of prompt tokens used over the course of the run.
    long
    Get the totalTokens property: Total number of tokens used (prompt + completion).
    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 long getCompletionTokens()
      Get the completionTokens property: Number of completion tokens used over the course of the run.
      Returns:
      the completionTokens value.
    • getPromptTokens

      public long getPromptTokens()
      Get the promptTokens property: Number of prompt tokens used over the course of the run.
      Returns:
      the promptTokens value.
    • getTotalTokens

      public long getTotalTokens()
      Get the totalTokens property: Total number of tokens used (prompt + completion).
      Returns:
      the totalTokens value.
    • toJson

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.azure.json.JsonSerializable<RunCompletionUsage>
      Throws:
      IOException
    • fromJson

      public static RunCompletionUsage fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of RunCompletionUsage from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of RunCompletionUsage 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 RunCompletionUsage.