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 Details

    • CreateResponsesRequest

      public CreateResponsesRequest(CreateResponsesRequestModel model, String input)
      Creates an instance of CreateResponsesRequest class.
      Parameters:
      model - the model value to set.
      input - the input value to set.
    • CreateResponsesRequest

      public CreateResponsesRequest(CreateResponsesRequestModel model, List<ResponsesMessage> input)
      Creates an instance of CreateResponsesRequest class.
      Parameters:
      model - the model value to set.
      input - the input value to set.
  • Method Details

    • getModel

      public CreateResponsesRequestModel 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

      public Map<String,String> 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

      public CreateResponsesRequest setMetadata(Map<String,String> metadata)
      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

      public Double 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

      public CreateResponsesRequest setTemperature(Double temperature)
      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

      public Double 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

      public CreateResponsesRequest setTopP(Double topP)
      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

      public String 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

      public CreateResponsesRequest setPreviousResponseId(String previousResponseId)
      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

      public ResponsesReasoningConfiguration 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

      public Integer 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

      public CreateResponsesRequest 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).
      Parameters:
      maxOutputTokens - the maxOutputTokens value to set.
      Returns:
      the CreateResponsesRequest object itself.
    • getInstructions

      public String getInstructions()
      Get the instructions property: The instructions property.
      Returns:
      the instructions value.
    • setInstructions

      public CreateResponsesRequest setInstructions(String instructions)
      Set the instructions property: The instructions property.
      Parameters:
      instructions - the instructions value to set.
      Returns:
      the CreateResponsesRequest object itself.
    • getText

      public ResponseTextOptions 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

      public List<ResponsesTool> getTools()
      Get the tools property: The tools to use to generate a response.
      Returns:
      the tools value.
    • setTools

      public CreateResponsesRequest setTools(List<ResponsesTool> tools)
      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

      public CreateResponsesRequest 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.
      Parameters:
      toolChoice - the toolChoice value to set.
      Returns:
      the CreateResponsesRequest object itself.
    • getTruncation

      public ResponseTruncation 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

      public CreateResponsesRequest setTruncation(ResponseTruncation truncation)
      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

      public String 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

      public CreateResponsesRequest setUser(String user)
      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

      public List<CreateResponsesRequestIncludable> 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

      public Boolean isParallelToolCalls()
      Get the parallelToolCalls property: Specifies whether parallel tool calling should be enabled for this response.
      Returns:
      the parallelToolCalls value.
    • setParallelToolCalls

      public CreateResponsesRequest setParallelToolCalls(Boolean parallelToolCalls)
      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

      public Boolean isStore()
      Get the store property: The store property.
      Returns:
      the store value.
    • setStore

      public CreateResponsesRequest setStore(Boolean store)
      Set the store property: The store property.
      Parameters:
      store - the store value to set.
      Returns:
      the CreateResponsesRequest object itself.
    • isStream

      public Boolean 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

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.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.