Package com.azure.ai.inference.models
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 Summary
ConstructorsConstructorDescriptionChatCompletionsResponseFormatJsonSchemaDefinition(String name, Map<String, com.azure.core.util.BinaryData> schema) Creates an instance of ChatCompletionsResponseFormatJsonSchemaDefinition class. -
Method Summary
Modifier and TypeMethodDescriptionfromJson(com.azure.json.JsonReader jsonReader) Reads an instance of ChatCompletionsResponseFormatJsonSchemaDefinition from the JsonReader.Get the description property: A description of the response format, used by the AI model to determine how to generate responses in this format.getName()Get the name property: A name that labels this JSON schema.Get the schema property: The definition of the JSON schema.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.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.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.com.azure.json.JsonWritertoJson(com.azure.json.JsonWriter jsonWriter) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.azure.json.JsonSerializable
toJson, toJson, toJsonBytes, toJsonString
-
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
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
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
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
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
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
- Specified by:
toJsonin interfacecom.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.
-