Class ChatCompletions

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

public final class ChatCompletions extends Object implements com.azure.json.JsonSerializable<ChatCompletions>
Representation of the response data from a chat completions request. Completions support a wide variety of tasks and generate text that continues from or "completes" provided prompt data.
  • Method Summary

    Modifier and Type
    Method
    Description
    fromJson(com.azure.json.JsonReader jsonReader)
    Reads an instance of ChatCompletions from the JsonReader.
    Get the choices property: The collection of completions choices associated with this completions response.
    Get the createdAt property: The first timestamp associated with generation activity for this completions response, represented as seconds since the beginning of the Unix epoch of 00:00 on 1 Jan 1970.
    Get the id property: A unique identifier associated with this chat completions response.
    Get the model property: The model name used for this completions request.
    Get the promptFilterResults property: Content filtering results for zero or more prompts in the request.
    Get the systemFingerprint property: Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.
    Get the usage property: Usage information for tokens processed and generated as part of this completions operation.
    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
  • Method Details

    • getId

      public String getId()
      Get the id property: A unique identifier associated with this chat completions response.
      Returns:
      the id value.
    • getChoices

      public List<ChatChoice> getChoices()
      Get the choices property: The collection of completions choices associated with this completions response. Generally, `n` choices are generated per provided prompt with a default value of 1. Token limits and other settings may limit the number of choices generated.
      Returns:
      the choices value.
    • getUsage

      public CompletionsUsage getUsage()
      Get the usage property: Usage information for tokens processed and generated as part of this completions operation.
      Returns:
      the usage value.
    • getCreatedAt

      public OffsetDateTime getCreatedAt()
      Get the createdAt property: The first timestamp associated with generation activity for this completions response, represented as seconds since the beginning of the Unix epoch of 00:00 on 1 Jan 1970.
      Returns:
      the createdAt value.
    • getPromptFilterResults

      public List<ContentFilterResultsForPrompt> getPromptFilterResults()
      Get the promptFilterResults property: Content filtering results for zero or more prompts in the request. In a streaming request, results for different prompts may arrive at different times or in different orders.
      Returns:
      the promptFilterResults value.
    • getSystemFingerprint

      public String getSystemFingerprint()
      Get the systemFingerprint property: Can be used in conjunction with the `seed` request parameter to understand when backend changes have been made that might impact determinism.
      Returns:
      the systemFingerprint value.
    • getModel

      public String getModel()
      Get the model property: The model name used for this completions request.
      Returns:
      the model value.
    • toJson

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

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