Share via


Response Class

Definition

The Response.

public class Response : Azure.AI.AgentServer.Contracts.Generated.Common.IUtf8JsonSerializable, System.ClientModel.Primitives.IJsonModel<Azure.AI.AgentServer.Contracts.Generated.Responses.Response>, System.ClientModel.Primitives.IPersistableModel<Azure.AI.AgentServer.Contracts.Generated.Responses.Response>
type Response = class
    interface IUtf8JsonSerializable
    interface IJsonModel<Response>
    interface IPersistableModel<Response>
Public Class Response
Implements IJsonModel(Of Response), IPersistableModel(Of Response), IUtf8JsonSerializable
Inheritance
Response
Implements

Constructors

Name Description
Response()

Initializes a new instance of Response for deserialization.

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>)

Initializes a new instance of Response.

Response(IReadOnlyDictionary<String,String>, Nullable<Single>, Nullable<Single>, String, String, DateTimeOffset, ResponseError, ResponseIncompleteDetails1, IEnumerable<ItemResource>, BinaryData, Boolean, ResponseConversation1)

Initializes a new instance of Response.

Properties

Name Description
Agent

The agent used for this response.

Background

Whether to run the model response in the background. Learn more.

Conversation

Gets the conversation.

CreatedAt

Unix timestamp (in seconds) of when this Response was created.

Error

Gets the error.

Id

Unique identifier for this Response.

IncompleteDetails

Details about why the response is incomplete.

Instructions

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.

To assign an object to this property use FromObjectAsJson<T>(T, JsonSerializerOptions).

To assign an already formatted json string to this property use FromString(String).

<remarks> Supported types:

</remarks> Examples:
  • BinaryData.FromObjectAsJson("foo"): Creates a payload of "foo".
  • BinaryData.FromString("\"foo\""): Creates a payload of "foo".
  • BinaryData.FromObjectAsJson(new { key = "value" }): Creates a payload of { "key": "value" }.
  • BinaryData.FromString("{\"key\": \"value\"}"): Creates a payload of { "key": "value" }.

MaxOutputTokens

An upper bound for the number of tokens that can be generated for a response, including visible output tokens and reasoning tokens.

MaxToolCalls

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.

Metadata

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.

Model

The model deployment to use for the creation of this response.

Object

The object type of this resource - always set to response.

Output

An array of content items generated by the model.

OutputText

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.

ParallelToolCalls

Whether to allow the model to run tool calls in parallel.

PreviousResponseId

The unique ID of the previous response to the model. Use this to create multi-turn conversations. Learn more about conversation state.

Prompt

Gets the prompt.

Reasoning

Gets the reasoning.

ServiceTier

Note: service_tier is not applicable to Azure OpenAI.

Status

The status of the response generation. One of completed, failed, in_progress, cancelled, queued, or incomplete.

StructuredInputs

The structured inputs to the response that can participate in prompt template substitution or tool argument bindings.

To assign an object to the value of this property use FromObjectAsJson<T>(T, JsonSerializerOptions).

To assign an already formatted json string to this property use FromString(String).

Examples:

  • BinaryData.FromObjectAsJson("foo"): Creates a payload of "foo".
  • BinaryData.FromString("\"foo\""): Creates a payload of "foo".
  • BinaryData.FromObjectAsJson(new { key = "value" }): Creates a payload of { "key": "value" }.
  • BinaryData.FromString("{\"key\": \"value\"}"): Creates a payload of { "key": "value" }.

Temperature

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.

Text

Configuration options for a text response from the model. Can be plain text or structured JSON data. Learn more:

ToolChoice

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.

To assign an object to this property use FromObjectAsJson<T>(T, JsonSerializerOptions).

To assign an already formatted json string to this property use FromString(String).

<remarks> Supported types:

</remarks> Examples:
  • BinaryData.FromObjectAsJson("foo"): Creates a payload of "foo".
  • BinaryData.FromString("\"foo\""): Creates a payload of "foo".
  • BinaryData.FromObjectAsJson(new { key = "value" }): Creates a payload of { "key": "value" }.
  • BinaryData.FromString("{\"key\": \"value\"}"): Creates a payload of { "key": "value" }.

Tools

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:

TopLogprobs

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.

TopP

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.

Truncation

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.
Usage

Gets the usage.

User

A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse. Learn more.

Methods

Name Description
DeserializeResponse(JsonElement, ModelReaderWriterOptions)
FromResponse(Response)

Deserializes the model from a raw response.

JsonModelWriteCore(Utf8JsonWriter, ModelReaderWriterOptions)
ToRequestContent()

Convert into a RequestContent.

Explicit Interface Implementations

Name Description
IJsonModel<Response>.Create(Utf8JsonReader, ModelReaderWriterOptions)

Reads one JSON value (including objects or arrays) from the provided reader and converts it to a model.

IJsonModel<Response>.Write(Utf8JsonWriter, ModelReaderWriterOptions)

Writes the model to the provided Utf8JsonWriter.

IPersistableModel<Response>.Create(BinaryData, ModelReaderWriterOptions)

Converts the provided BinaryData into a model.

IPersistableModel<Response>.GetFormatFromOptions(ModelReaderWriterOptions)

Gets the data interchange format (JSON, Xml, etc) that the model uses when communicating with the service.

IPersistableModel<Response>.Write(ModelReaderWriterOptions)

Writes the model into a BinaryData.

IUtf8JsonSerializable.Write(Utf8JsonWriter)

Applies to