Response Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
Response()
- Source:
- Response.cs
Initializes a new instance of Response for deserialization.
public Response();
Public Sub New ()
Applies to
Response(IReadOnlyDictionary<String,String>, Nullable<Single>, Nullable<Single>, String, String, DateTimeOffset, ResponseError, ResponseIncompleteDetails1, IEnumerable<ItemResource>, BinaryData, Boolean, ResponseConversation1)
- Source:
- Response.cs
Initializes a new instance of Response.
public Response(System.Collections.Generic.IReadOnlyDictionary<string,string> metadata, float? temperature, float? topP, string user, string id, DateTimeOffset createdAt, Azure.AI.AgentServer.Contracts.Generated.OpenAI.ResponseError error, Azure.AI.AgentServer.Contracts.Generated.OpenAI.ResponseIncompleteDetails1 incompleteDetails, System.Collections.Generic.IEnumerable<Azure.AI.AgentServer.Contracts.Generated.OpenAI.ItemResource> output, BinaryData instructions, bool parallelToolCalls, Azure.AI.AgentServer.Contracts.Generated.Conversations.ResponseConversation1 conversation);
new Azure.AI.AgentServer.Contracts.Generated.Responses.Response : System.Collections.Generic.IReadOnlyDictionary<string, string> * Nullable<single> * Nullable<single> * string * string * DateTimeOffset * Azure.AI.AgentServer.Contracts.Generated.OpenAI.ResponseError * Azure.AI.AgentServer.Contracts.Generated.OpenAI.ResponseIncompleteDetails1 * seq<Azure.AI.AgentServer.Contracts.Generated.OpenAI.ItemResource> * BinaryData * bool * Azure.AI.AgentServer.Contracts.Generated.Conversations.ResponseConversation1 -> Azure.AI.AgentServer.Contracts.Generated.Responses.Response
Public Sub New (metadata As IReadOnlyDictionary(Of String, String), temperature As Nullable(Of Single), topP As Nullable(Of Single), user As String, id As String, createdAt As DateTimeOffset, error As ResponseError, incompleteDetails As ResponseIncompleteDetails1, output As IEnumerable(Of ItemResource), instructions As BinaryData, parallelToolCalls As Boolean, conversation As ResponseConversation1)
Parameters
- metadata
- IReadOnlyDictionary<String,String>
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.
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.
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.
- user
- String
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.
- id
- String
Unique identifier for this Response.
- createdAt
- DateTimeOffset
Unix timestamp (in seconds) of when this Response was created.
- error
- ResponseError
- incompleteDetails
- ResponseIncompleteDetails1
Details about why the response is incomplete.
- output
- IEnumerable<ItemResource>
An array of content items generated by the model.
- The length and order of items in the
outputarray is dependent on the model's response. - Rather than accessing the first item in the
outputarray and assuming it's anassistantmessage with the content generated by the model, you might consider using theoutput_textproperty where supported in SDKs. Please note ItemResource is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. The available derived classes include ResponsesAssistantMessageItemResource, CodeInterpreterToolCallItemResource, ComputerToolCallItemResource, ComputerToolCallOutputItemResource, ResponsesDeveloperMessageItemResource, FileSearchToolCallItemResource, FunctionToolCallItemResource, FunctionToolCallOutputItemResource, ImageGenToolCallItemResource, InvokeAzureAgentWorkflowActionOutputItemResource, LocalShellToolCallItemResource, LocalShellToolCallOutputItemResource, MCPApprovalRequestItemResource, MCPApprovalResponseItemResource, MCPCallItemResource, MCPListToolsItemResource, MemorySearchToolCallItemResource, ResponsesMessageItemResource, OAuthConsentRequestItemResource, ReasoningItemResource, StructuredOutputsItemResource, ResponsesSystemMessageItemResource, ResponsesUserMessageItemResource, WebSearchToolCallItemResource and WorkflowActionOutputItemResource.
- instructions
- BinaryData
A system (or developer) message inserted into the model's context.
When using along with previous_response_id, the instructions from a previous
response will not be carried over to the next response. This makes it simple
to swap out system (or developer) messages in new responses.
- parallelToolCalls
- Boolean
Whether to allow the model to run tool calls in parallel.
- conversation
- ResponseConversation1
Exceptions
id or output is null.
Applies to
Response(IReadOnlyDictionary<String,String>, Nullable<Single>, Nullable<Single>, String, Nullable<ServiceTier>, Nullable<Int32>, String, String, Reasoning, Nullable<Boolean>, Nullable<Int32>, Nullable<Int32>, CreateResponseRequestText, IReadOnlyList<Tool>, BinaryData, Prompt, Nullable<CreateResponseRequestTruncation>, String, ResponseObject, Nullable<ResponseStatus>, DateTimeOffset, ResponseError, ResponseIncompleteDetails1, IReadOnlyList<ItemResource>, BinaryData, String, ResponseUsage, Boolean, ResponseConversation1, AgentId, IReadOnlyDictionary<String,BinaryData>, IDictionary<String, BinaryData>)
- Source:
- Response.cs
Initializes a new instance of Response.
public Response(System.Collections.Generic.IReadOnlyDictionary<string,string> metadata, float? temperature, float? topP, string user, Azure.AI.AgentServer.Contracts.Generated.OpenAI.ServiceTier? serviceTier, int? topLogprobs, string previousResponseId, string model, Azure.AI.AgentServer.Contracts.Generated.OpenAI.Reasoning reasoning, bool? background, int? maxOutputTokens, int? maxToolCalls, Azure.AI.AgentServer.Contracts.Generated.Responses.CreateResponseRequestText text, System.Collections.Generic.IReadOnlyList<Azure.AI.AgentServer.Contracts.Generated.OpenAI.Tool> tools, BinaryData toolChoice, Azure.AI.AgentServer.Contracts.Generated.OpenAI.Prompt prompt, Azure.AI.AgentServer.Contracts.Generated.Responses.CreateResponseRequestTruncation? truncation, string id, Azure.AI.AgentServer.Contracts.Generated.Responses.ResponseObject object, Azure.AI.AgentServer.Contracts.Generated.OpenAI.ResponseStatus? status, DateTimeOffset createdAt, Azure.AI.AgentServer.Contracts.Generated.OpenAI.ResponseError error, Azure.AI.AgentServer.Contracts.Generated.OpenAI.ResponseIncompleteDetails1 incompleteDetails, System.Collections.Generic.IReadOnlyList<Azure.AI.AgentServer.Contracts.Generated.OpenAI.ItemResource> output, BinaryData instructions, string outputText, Azure.AI.AgentServer.Contracts.Generated.OpenAI.ResponseUsage usage, bool parallelToolCalls, Azure.AI.AgentServer.Contracts.Generated.Conversations.ResponseConversation1 conversation, Azure.AI.AgentServer.Contracts.Generated.Agents.AgentId agent, System.Collections.Generic.IReadOnlyDictionary<string,BinaryData> structuredInputs, System.Collections.Generic.IDictionary<string,BinaryData> serializedAdditionalRawData);
new Azure.AI.AgentServer.Contracts.Generated.Responses.Response : System.Collections.Generic.IReadOnlyDictionary<string, string> * Nullable<single> * Nullable<single> * string * Nullable<Azure.AI.AgentServer.Contracts.Generated.OpenAI.ServiceTier> * Nullable<int> * string * string * Azure.AI.AgentServer.Contracts.Generated.OpenAI.Reasoning * Nullable<bool> * Nullable<int> * Nullable<int> * Azure.AI.AgentServer.Contracts.Generated.Responses.CreateResponseRequestText * System.Collections.Generic.IReadOnlyList<Azure.AI.AgentServer.Contracts.Generated.OpenAI.Tool> * BinaryData * Azure.AI.AgentServer.Contracts.Generated.OpenAI.Prompt * Nullable<Azure.AI.AgentServer.Contracts.Generated.Responses.CreateResponseRequestTruncation> * string * Azure.AI.AgentServer.Contracts.Generated.Responses.ResponseObject * Nullable<Azure.AI.AgentServer.Contracts.Generated.OpenAI.ResponseStatus> * DateTimeOffset * Azure.AI.AgentServer.Contracts.Generated.OpenAI.ResponseError * Azure.AI.AgentServer.Contracts.Generated.OpenAI.ResponseIncompleteDetails1 * System.Collections.Generic.IReadOnlyList<Azure.AI.AgentServer.Contracts.Generated.OpenAI.ItemResource> * BinaryData * string * Azure.AI.AgentServer.Contracts.Generated.OpenAI.ResponseUsage * bool * Azure.AI.AgentServer.Contracts.Generated.Conversations.ResponseConversation1 * Azure.AI.AgentServer.Contracts.Generated.Agents.AgentId * System.Collections.Generic.IReadOnlyDictionary<string, BinaryData> * System.Collections.Generic.IDictionary<string, BinaryData> -> Azure.AI.AgentServer.Contracts.Generated.Responses.Response
Public Sub New (metadata As IReadOnlyDictionary(Of String, String), temperature As Nullable(Of Single), topP As Nullable(Of Single), user As String, serviceTier As Nullable(Of ServiceTier), topLogprobs As Nullable(Of Integer), previousResponseId As String, model As String, reasoning As Reasoning, background As Nullable(Of Boolean), maxOutputTokens As Nullable(Of Integer), maxToolCalls As Nullable(Of Integer), text As CreateResponseRequestText, tools As IReadOnlyList(Of Tool), toolChoice As BinaryData, prompt As Prompt, truncation As Nullable(Of CreateResponseRequestTruncation), id As String, object As ResponseObject, status As Nullable(Of ResponseStatus), createdAt As DateTimeOffset, error As ResponseError, incompleteDetails As ResponseIncompleteDetails1, output As IReadOnlyList(Of ItemResource), instructions As BinaryData, outputText As String, usage As ResponseUsage, parallelToolCalls As Boolean, conversation As ResponseConversation1, agent As AgentId, structuredInputs As IReadOnlyDictionary(Of String, BinaryData), serializedAdditionalRawData As IDictionary(Of String, BinaryData))
Parameters
- metadata
- IReadOnlyDictionary<String,String>
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.
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.
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.
- user
- String
A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.
- serviceTier
- Nullable<ServiceTier>
Note: service_tier is not applicable to Azure OpenAI.
An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability.
- previousResponseId
- String
The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about conversation state.
- model
- String
The model deployment to use for the creation of this response.
- reasoning
- Reasoning
Whether to run the model response in the background. Learn more.
An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.
The maximum number of total calls to built-in tools that can be processed in a response. This maximum number applies across all built-in tool calls, not per individual tool. Any further attempts to call a tool by the model will be ignored.
Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:
- tools
- IReadOnlyList<Tool>
An array of tools the model may call while generating a response. You
can specify which tool to use by setting the tool_choice parameter.
The two categories of tools you can provide the model are:
- Built-in tools: Tools that are provided by OpenAI that extend the model's capabilities, like web search or file search. Learn more about built-in tools.
- Function calls (custom tools): Functions that are defined by you, enabling the model to call your own code. Learn more about function calling. Please note Tool is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. The available derived classes include A2ATool, AzureAISearchAgentTool, AzureFunctionAgentTool, BingCustomSearchAgentTool, BingGroundingAgentTool, BrowserAutomationAgentTool, CaptureStructuredOutputsTool, CodeInterpreterTool, ComputerUsePreviewTool, MicrosoftFabricAgentTool, FileSearchTool, FunctionTool, ImageGenTool, LocalShellTool, MCPTool, MemorySearchTool, OpenApiAgentTool, SharepointAgentTool and WebSearchPreviewTool.
- toolChoice
- BinaryData
How the model should select which tool (or tools) to use when generating
a response. See the tools parameter to see how to specify which tools
the model can call.
- prompt
- Prompt
- truncation
- Nullable<CreateResponseRequestTruncation>
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(default): If a model response will exceed the context window size for a model, the request will fail with a 400 error.
- id
- String
Unique identifier for this Response.
- object
- ResponseObject
The object type of this resource - always set to response.
- status
- Nullable<ResponseStatus>
The status of the response generation. One of completed, failed,
in_progress, cancelled, queued, or incomplete.
- createdAt
- DateTimeOffset
Unix timestamp (in seconds) of when this Response was created.
- error
- ResponseError
- incompleteDetails
- ResponseIncompleteDetails1
Details about why the response is incomplete.
- output
- IReadOnlyList<ItemResource>
An array of content items generated by the model.
- The length and order of items in the
outputarray is dependent on the model's response. - Rather than accessing the first item in the
outputarray and assuming it's anassistantmessage with the content generated by the model, you might consider using theoutput_textproperty where supported in SDKs. Please note ItemResource is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. The available derived classes include ResponsesAssistantMessageItemResource, CodeInterpreterToolCallItemResource, ComputerToolCallItemResource, ComputerToolCallOutputItemResource, ResponsesDeveloperMessageItemResource, FileSearchToolCallItemResource, FunctionToolCallItemResource, FunctionToolCallOutputItemResource, ImageGenToolCallItemResource, InvokeAzureAgentWorkflowActionOutputItemResource, LocalShellToolCallItemResource, LocalShellToolCallOutputItemResource, MCPApprovalRequestItemResource, MCPApprovalResponseItemResource, MCPCallItemResource, MCPListToolsItemResource, MemorySearchToolCallItemResource, ResponsesMessageItemResource, OAuthConsentRequestItemResource, ReasoningItemResource, StructuredOutputsItemResource, ResponsesSystemMessageItemResource, ResponsesUserMessageItemResource, WebSearchToolCallItemResource and WorkflowActionOutputItemResource.
- instructions
- BinaryData
A system (or developer) message inserted into the model's context.
When using along with previous_response_id, the instructions from a previous
response will not be carried over to the next response. This makes it simple
to swap out system (or developer) messages in new responses.
- outputText
- String
SDK-only convenience property that contains the aggregated text output
from all output_text items in the output array, if any are present.
Supported in the Python and JavaScript SDKs.
- usage
- ResponseUsage
- parallelToolCalls
- Boolean
Whether to allow the model to run tool calls in parallel.
- conversation
- ResponseConversation1
- agent
- AgentId
The agent used for this response.
- structuredInputs
- IReadOnlyDictionary<String,BinaryData>
The structured inputs to the response that can participate in prompt template substitution or tool argument bindings.
- serializedAdditionalRawData
- IDictionary<String,BinaryData>
Keeps track of any properties unknown to the library.