Class ChatCompletionsResponseFormatJsonSchemaDefinition

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

public final class ChatCompletionsResponseFormatJsonSchemaDefinition extends Object implements com.azure.json.JsonSerializable<ChatCompletionsResponseFormatJsonSchemaDefinition>
Defines the response format for chat completions as JSON with a given schema. The AI model will need to adhere to this schema when generating completions.
  • Constructor Details

    • ChatCompletionsResponseFormatJsonSchemaDefinition

      public ChatCompletionsResponseFormatJsonSchemaDefinition(String name, Map<String,com.azure.core.util.BinaryData> schema)
      Creates an instance of ChatCompletionsResponseFormatJsonSchemaDefinition class.
      Parameters:
      name - the name value to set.
      schema - the schema value to set.
  • Method Details

    • getName

      public String getName()
      Get the name property: A name that labels this JSON schema. Must be a-z, A-Z, 0-9, or contain underscores and dashes, with a maximum length of 64.
      Returns:
      the name value.
    • getSchema

      public Map<String,com.azure.core.util.BinaryData> getSchema()
      Get the schema property: The definition of the JSON schema. See https://json-schema.org/overview/what-is-jsonschema. Note that AI models usually only support a subset of the keywords defined by JSON schema. Consult your AI model documentation to determine what is supported.
      Returns:
      the schema value.
    • getDescription

      public String getDescription()
      Get the description property: A description of the response format, used by the AI model to determine how to generate responses in this format.
      Returns:
      the description value.
    • setDescription

      public ChatCompletionsResponseFormatJsonSchemaDefinition setDescription(String description)
      Set the description property: A description of the response format, used by the AI model to determine how to generate responses in this format.
      Parameters:
      description - the description value to set.
      Returns:
      the ChatCompletionsResponseFormatJsonSchemaDefinition object itself.
    • isStrict

      public Boolean isStrict()
      Get the strict property: If set to true, the service will error out if the provided JSON schema contains keywords not supported by the AI model. An example of such keyword may be `maxLength` for JSON type `string`. If false, and the provided JSON schema contains keywords not supported by the AI model, the AI model will not error out. Instead it will ignore the unsupported keywords.
      Returns:
      the strict value.
    • setStrict

      Set the strict property: If set to true, the service will error out if the provided JSON schema contains keywords not supported by the AI model. An example of such keyword may be `maxLength` for JSON type `string`. If false, and the provided JSON schema contains keywords not supported by the AI model, the AI model will not error out. Instead it will ignore the unsupported keywords.
      Parameters:
      strict - the strict value to set.
      Returns:
      the ChatCompletionsResponseFormatJsonSchemaDefinition object itself.
    • toJson

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

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