Freigeben über


ResponseObject Class

Definition

Layer 3 convenience extensions for ResponseObject.

public class ResponseObject : System.ClientModel.Primitives.IJsonModel<Azure.AI.AgentServer.Responses.Models.ResponseObject>, System.ClientModel.Primitives.IPersistableModel<Azure.AI.AgentServer.Responses.Models.ResponseObject>
type ResponseObject = class
    interface IJsonModel<ResponseObject>
    interface IPersistableModel<ResponseObject>
Public Class ResponseObject
Implements IJsonModel(Of ResponseObject), IPersistableModel(Of ResponseObject)
Inheritance
ResponseObject
Implements

Constructors

Name Description
ResponseObject(String, DateTimeOffset, ResponseErrorInfo, ResponseIncompleteDetails, IEnumerable<OutputItem>, BinaryData, Boolean, AgentReference)

Initializes a new instance of ResponseObject.

ResponseObject(String, String)

Creates a new ResponseObject with minimal required fields.

Properties

Name Description
Agent

(Deprecated) Use agent_reference instead. The agent used for this response

AgentReference

The agent used for this response.

AgentSessionId

The session identifier for this response. Currently only relevant for hosted agents. Always returned for hosted agents — either the caller-provided value, the auto-derived value, or an auto-generated UUID. Use for session-scoped operations and to maintain sandbox affinity in follow-up calls.

Background

Gets or sets the Background.

CompletedAt

Gets or sets the CompletedAt.

Conversation

Gets or sets the Conversation.

CreatedAt

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

Error

Gets or sets the Error.

Id

Unique identifier for this Response.

IncompleteDetails

Gets or sets the IncompleteDetails.

Instructions

Gets or sets the Instructions.

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

Gets or sets the MaxOutputTokens.

MaxToolCalls

Gets or sets the MaxToolCalls.

Metadata

Gets or sets the Metadata.

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.

  • The length and order of items in the `output` array is dependent
on the model's response.
  • Rather than accessing the first item in the `output` array and
assuming it's an `assistant` message with the content generated by the model, you might consider using the `output_text` property where supported in SDKs.
OutputText

Gets or sets the OutputText.

ParallelToolCalls

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

PreviousResponseId

Gets or sets the PreviousResponseId.

Prompt

Gets or sets the Prompt.

PromptCacheKey

Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the user field. Learn more.

PromptCacheRetention

Gets or sets the PromptCacheRetention.

Reasoning

Gets or sets the Reasoning.

SafetyIdentifier

A stable identifier used to help detect users of your application that may be violating OpenAI's usage policies. The IDs should be a string that uniquely identifies each user. We recommend hashing their username or email address, in order to avoid sending us any identifying information. Learn more.

ServiceTier

Gets or sets the ServiceTier.

Status

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

Temperature

Gets or sets the Temperature.

Text

Gets or sets the Text.

ToolChoice

Gets or sets the ToolChoice.

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

Gets the Tools.

TopLogprobs

Gets or sets the TopLogprobs.

TopP

Gets or sets the TopP.

Truncation

Gets or sets the Truncation.

Usage

Gets or sets the Usage.

User

This field is being replaced by safety_identifier and prompt_cache_key. Use prompt_cache_key instead to maintain caching optimizations. A stable identifier for your end-users. Used to boost cache hit rates by better bucketing similar requests and to help OpenAI detect and prevent abuse. Learn more.

Methods

Name Description
JsonModelCreateCore(Utf8JsonReader, ModelReaderWriterOptions)
JsonModelWriteCore(Utf8JsonWriter, ModelReaderWriterOptions)
PersistableModelCreateCore(BinaryData, ModelReaderWriterOptions)
PersistableModelWriteCore(ModelReaderWriterOptions)

Operators

Name Description
Explicit(ClientResult to ResponseObject)

Explicit Interface Implementations

Name Description
IJsonModel<ResponseObject>.Create(Utf8JsonReader, ModelReaderWriterOptions)
IJsonModel<ResponseObject>.Write(Utf8JsonWriter, ModelReaderWriterOptions)
IPersistableModel<ResponseObject>.Create(BinaryData, ModelReaderWriterOptions)
IPersistableModel<ResponseObject>.GetFormatFromOptions(ModelReaderWriterOptions)
IPersistableModel<ResponseObject>.Write(ModelReaderWriterOptions)

Extension Methods

Name Description
GetInstructionItems(ResponseObject)

Expands the Instructions BinaryData into a typed list of Item objects. A plain string is wrapped as a single ItemMessage with Developer role and the instruction text.

GetToolChoiceExpanded(ResponseObject)

Expands the ToolChoice BinaryData into a typed ToolChoiceParam. String shorthands ("auto", "required") are expanded to ToolChoiceAllowed with the corresponding mode. "none" returns null.

SetInstructions(ResponseObject, IList<Item>)

Sets the Instructions property from a list of Item objects.

SetInstructions(ResponseObject, String)

Sets the Instructions property from a plain text string.

SetToolChoice(ResponseObject, ToolChoiceOptions)

Sets the ToolChoice property from a ToolChoiceOptions enum value (string shorthand).

SetToolChoice(ResponseObject, ToolChoiceParam)

Sets the ToolChoice property from a typed ToolChoiceParam object.

Snapshot(ResponseObject)

Creates an immutable deep copy of the ResponseObject via ModelReaderWriter round-trip serialization.

Applies to