Class CreateResponsesRequest
java.lang.Object
com.azure.ai.openai.responses.models.CreateResponsesRequest
- All Implemented Interfaces:
com.azure.json.JsonSerializable<CreateResponsesRequest>
public final class CreateResponsesRequest
extends Object
implements com.azure.json.JsonSerializable<CreateResponsesRequest>
The CreateResponsesRequest model.
-
Constructor Summary
ConstructorsConstructorDescriptionCreateResponsesRequest(CreateResponsesRequestModel model, String input) Creates an instance of CreateResponsesRequest class.CreateResponsesRequest(CreateResponsesRequestModel model, List<ResponsesMessage> input) Creates an instance of CreateResponsesRequest class. -
Method Summary
Modifier and TypeMethodDescriptionstatic CreateResponsesRequestfromJson(com.azure.json.JsonReader jsonReader) Reads an instance of CreateResponsesRequest from the JsonReader.Get the include property: Specifies additional output data to include in the model response.com.azure.core.util.BinaryDatagetInput()Get the input property: Text, image, or audio inputs to the model, used to generate a response.Get the instructions property: The instructions property.Get the maxOutputTokens property: An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).Get the metadata property: Set of 16 key-value pairs that can be attached to an object.getModel()Get the model property: Model ID used to generate the response, like `gpt-4o` or `o1`.Get the previousResponseId property: The unique ID of the previous response to the model.Get the reasoning property: The reasoning property.Get the temperature property: What sampling temperature to use, between 0 and 2.getText()Get the text property: The text property.com.azure.core.util.BinaryDataGet the toolChoice property: How the model should select which tool (or tools) to use when generating a response.getTools()Get the tools property: The tools to use to generate a response.getTopP()Get the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.Get the truncation property: The truncation strategy to use for the model responsegetUser()Get the user property: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.Get the parallelToolCalls property: Specifies whether parallel tool calling should be enabled for this response.isStore()Get the store property: The store property.isStream()Get the stream property: If set to true, the model response data will be streamed to the client as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format).setInclude(List<CreateResponsesRequestIncludable> include) Set the include property: Specifies additional output data to include in the model response.setInstructions(String instructions) Set the instructions property: The instructions property.setMaxOutputTokens(Integer maxOutputTokens) Set the maxOutputTokens property: An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).setMetadata(Map<String, String> metadata) Set the metadata property: Set of 16 key-value pairs that can be attached to an object.setParallelToolCalls(Boolean parallelToolCalls) Set the parallelToolCalls property: Specifies whether parallel tool calling should be enabled for this response.setPreviousResponseId(String previousResponseId) Set the previousResponseId property: The unique ID of the previous response to the model.setReasoning(ResponsesReasoningConfiguration reasoning) Set the reasoning property: The reasoning property.Set the store property: The store property.setTemperature(Double temperature) Set the temperature property: What sampling temperature to use, between 0 and 2.setText(ResponseTextOptions text) Set the text property: The text property.setToolChoice(com.azure.core.util.BinaryData toolChoice) Set the toolChoice property: How the model should select which tool (or tools) to use when generating a response.setTools(List<ResponsesTool> tools) Set the tools property: The tools to use to generate a response.Set the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.setTruncation(ResponseTruncation truncation) Set the truncation property: The truncation strategy to use for the model responseSet the user property: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.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
-
CreateResponsesRequest
Creates an instance of CreateResponsesRequest class.- Parameters:
model- the model value to set.input- the input value to set.
-
CreateResponsesRequest
Creates an instance of CreateResponsesRequest class.- Parameters:
model- the model value to set.input- the input value to set.
-
-
Method Details
-
getModel
Get the model property: Model ID used to generate the response, like `gpt-4o` or `o1`. Refer to the [model guide](/docs/models) for more information and supported features for each model.- Returns:
- the model value.
-
getMetadata
Get the metadata property: Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.- Returns:
- the metadata value.
-
setMetadata
Set the metadata property: Set of 16 key-value pairs that can be attached to an object. This can be useful for storing additional information about the object in a structured format, and querying for objects via API or the dashboard. Keys are strings with a maximum length of 64 characters. Values are strings with a maximum length of 512 characters.- Parameters:
metadata- the metadata value to set.- Returns:
- the CreateResponsesRequest object itself.
-
getTemperature
Get the temperature property: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both.- Returns:
- the temperature value.
-
setTemperature
Set the temperature property: What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic. We generally recommend altering this or `top_p` but not both.- Parameters:
temperature- the temperature value to set.- Returns:
- the CreateResponsesRequest object itself.
-
getTopP
Get the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.- Returns:
- the topP value.
-
setTopP
Set the topP property: An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. We generally recommend altering this or `temperature` but not both.- Parameters:
topP- the topP value to set.- Returns:
- the CreateResponsesRequest object itself.
-
getPreviousResponseId
Get the previousResponseId property: The unique ID of the previous response to the model. Use this to create multi-turn conversations.- Returns:
- the previousResponseId value.
-
setPreviousResponseId
Set the previousResponseId property: The unique ID of the previous response to the model. Use this to create multi-turn conversations.- Parameters:
previousResponseId- the previousResponseId value to set.- Returns:
- the CreateResponsesRequest object itself.
-
getReasoning
Get the reasoning property: The reasoning property.- Returns:
- the reasoning value.
-
setReasoning
Set the reasoning property: The reasoning property.- Parameters:
reasoning- the reasoning value to set.- Returns:
- the CreateResponsesRequest object itself.
-
getMaxOutputTokens
Get the maxOutputTokens property: An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).- Returns:
- the maxOutputTokens value.
-
setMaxOutputTokens
Set the maxOutputTokens property: An upper bound for the number of tokens that can be generated for a response, including visible output tokens and [reasoning tokens](/docs/guides/reasoning).- Parameters:
maxOutputTokens- the maxOutputTokens value to set.- Returns:
- the CreateResponsesRequest object itself.
-
getInstructions
Get the instructions property: The instructions property.- Returns:
- the instructions value.
-
setInstructions
Set the instructions property: The instructions property.- Parameters:
instructions- the instructions value to set.- Returns:
- the CreateResponsesRequest object itself.
-
getText
Get the text property: The text property.- Returns:
- the text value.
-
setText
Set the text property: The text property.- Parameters:
text- the text value to set.- Returns:
- the CreateResponsesRequest object itself.
-
getTools
Get the tools property: The tools to use to generate a response.- Returns:
- the tools value.
-
setTools
Set the tools property: The tools to use to generate a response.- Parameters:
tools- the tools value to set.- Returns:
- the CreateResponsesRequest object itself.
-
getToolChoice
public com.azure.core.util.BinaryData getToolChoice()Get the toolChoice property: How the model should select which tool (or tools) to use when generating a response.- Returns:
- the toolChoice value.
-
setToolChoice
Set the toolChoice property: How the model should select which tool (or tools) to use when generating a response.- Parameters:
toolChoice- the toolChoice value to set.- Returns:
- the CreateResponsesRequest object itself.
-
getTruncation
Get the truncation property: The truncation strategy to use for the model response. - `auto`: If the context of this response and previous ones exceeds the model's context window size, the model will truncate the response to fit the context window by dropping input items in the middle of the conversation. - `disabled`: If a model response will exceed the context window size for a model, the request will fail with a 400 error.- Returns:
- the truncation value.
-
setTruncation
Set the truncation property: The truncation strategy to use for the model response. - `auto`: If the context of this response and previous ones exceeds the model's context window size, the model will truncate the response to fit the context window by dropping input items in the middle of the conversation. - `disabled`: If a model response will exceed the context window size for a model, the request will fail with a 400 error.- Parameters:
truncation- the truncation value to set.- Returns:
- the CreateResponsesRequest object itself.
-
getUser
Get the user property: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).- Returns:
- the user value.
-
setUser
Set the user property: A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. [Learn more](/docs/guides/safety-best-practices#end-user-ids).- Parameters:
user- the user value to set.- Returns:
- the CreateResponsesRequest object itself.
-
getInput
public com.azure.core.util.BinaryData getInput()Get the input property: Text, image, or audio inputs to the model, used to generate a response. Can also contain previous assistant responses and tool call outputs. Learn more about prompting a model with the [Responses API](/docs/guides/responses).- Returns:
- the input value.
-
getInclude
Get the include property: Specifies additional output data to include in the model response.- Returns:
- the include value.
-
setInclude
Set the include property: Specifies additional output data to include in the model response.- Parameters:
include- the include value to set.- Returns:
- the CreateResponsesRequest object itself.
-
isParallelToolCalls
Get the parallelToolCalls property: Specifies whether parallel tool calling should be enabled for this response.- Returns:
- the parallelToolCalls value.
-
setParallelToolCalls
Set the parallelToolCalls property: Specifies whether parallel tool calling should be enabled for this response.- Parameters:
parallelToolCalls- the parallelToolCalls value to set.- Returns:
- the CreateResponsesRequest object itself.
-
isStore
Get the store property: The store property.- Returns:
- the store value.
-
setStore
Set the store property: The store property.- Parameters:
store- the store value to set.- Returns:
- the CreateResponsesRequest object itself.
-
isStream
Get the stream property: If set to true, the model response data will be streamed to the client as it is generated using [server-sent events](https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Event_stream_format). See the "Streaming" section below for more information.- Returns:
- the stream value.
-
toJson
- Specified by:
toJsonin interfacecom.azure.json.JsonSerializable<CreateResponsesRequest>- Throws:
IOException
-
fromJson
public static CreateResponsesRequest fromJson(com.azure.json.JsonReader jsonReader) throws IOException Reads an instance of CreateResponsesRequest from the JsonReader.- Parameters:
jsonReader- The JsonReader being read.- Returns:
- An instance of CreateResponsesRequest 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 CreateResponsesRequest.
-