Class AssistantsApiResponseFormatOption
java.lang.Object
com.azure.ai.openai.assistants.models.AssistantsApiResponseFormatOption
Specifies the format that the model must output. Compatible with GPT-4 Turbo and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`.
Setting to `{ "type": "json_object" }` enables JSON mode, which guarantees the message the model generates is valid JSON.
**Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message.
Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit,
resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off
if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of AssistantsApiResponseFormatOption.Creates a new instance of AssistantsApiResponseFormatOption. -
Method Summary
Modifier and TypeMethodDescriptionfromBinaryData
(com.azure.core.util.BinaryData responseFormatBinaryData) Creates a new instance of AssistantsApiResponseFormatOption based on a JSON string.Gets the format in which the model will handle the return format of a tool call.getMode()
Gets the mode in which the model will handle the return format of a tool call.
-
Constructor Details
-
AssistantsApiResponseFormatOption
Creates a new instance of AssistantsApiResponseFormatOption.- Parameters:
mode
- The mode in which the model will handle the return format of a tool call.
-
AssistantsApiResponseFormatOption
Creates a new instance of AssistantsApiResponseFormatOption.- Parameters:
format
- The format in which the model will handle the return format of a tool call.
-
-
Method Details
-
getMode
Gets the mode in which the model will handle the return format of a tool call.- Returns:
- The mode in which the model will handle the return format of a tool call.
-
getFormat
Gets the format in which the model will handle the return format of a tool call.- Returns:
- The format in which the model will handle the return format of a tool call.
-
fromBinaryData
public static AssistantsApiResponseFormatOption fromBinaryData(com.azure.core.util.BinaryData responseFormatBinaryData) Creates a new instance of AssistantsApiResponseFormatOption based on a JSON string.- Parameters:
responseFormatBinaryData
- input JSON string- Returns:
- a new instance of AssistantsApiResponseFormatOption
- Throws:
IllegalArgumentException
- If the provided JSON string does not match the expected format.
-