TextResponse Constructors

Definition

Overloads

Name Description
TextResponse(ResponseContext, CreateResponse, Func<CancellationToken,IAsyncEnumerable<String>>, Action<ResponseObject>)

Creates a TextResponse that produces a text message from a stream of text chunks (e.g., tokens from an LLM). Each chunk is emitted as a response.output_text.delta event.

TextResponse(ResponseContext, CreateResponse, Func<CancellationToken,Task<String>>, Action<ResponseObject>)

Creates a TextResponse that produces a single text message from a complete string.

TextResponse(ResponseContext, CreateResponse, Func<CancellationToken,IAsyncEnumerable<String>>, Action<ResponseObject>)

Source:
TextResponse.cs

Creates a TextResponse that produces a text message from a stream of text chunks (e.g., tokens from an LLM). Each chunk is emitted as a response.output_text.delta event.

public TextResponse(Azure.AI.AgentServer.Responses.ResponseContext context, Azure.AI.AgentServer.Responses.Models.CreateResponse request, Func<System.Threading.CancellationToken,System.Collections.Generic.IAsyncEnumerable<string>> createTextStream, Action<Azure.AI.AgentServer.Responses.Models.ResponseObject>? configure = default);
new Azure.AI.AgentServer.Responses.TextResponse : Azure.AI.AgentServer.Responses.ResponseContext * Azure.AI.AgentServer.Responses.Models.CreateResponse * Func<System.Threading.CancellationToken, System.Collections.Generic.IAsyncEnumerable<string>> * Action<Azure.AI.AgentServer.Responses.Models.ResponseObject> -> Azure.AI.AgentServer.Responses.TextResponse
Public Sub New (context As ResponseContext, request As CreateResponse, createTextStream As Func(Of CancellationToken, IAsyncEnumerable(Of String)), Optional configure As Action(Of ResponseObject) = Nothing)

Parameters

context
ResponseContext

The response context (provides the response ID).

request
CreateResponse

The incoming create-response request.

createTextStream
Func<CancellationToken,IAsyncEnumerable<String>>

A delegate that returns an async enumerable of text chunks. Called after response.created and response.in_progress have been emitted.

configure
Action<ResponseObject>

An optional callback to configure the ResponseObject before response.created is emitted.

Applies to

TextResponse(ResponseContext, CreateResponse, Func<CancellationToken,Task<String>>, Action<ResponseObject>)

Source:
TextResponse.cs

Creates a TextResponse that produces a single text message from a complete string.

public TextResponse(Azure.AI.AgentServer.Responses.ResponseContext context, Azure.AI.AgentServer.Responses.Models.CreateResponse request, Func<System.Threading.CancellationToken,System.Threading.Tasks.Task<string>> createText, Action<Azure.AI.AgentServer.Responses.Models.ResponseObject>? configure = default);
new Azure.AI.AgentServer.Responses.TextResponse : Azure.AI.AgentServer.Responses.ResponseContext * Azure.AI.AgentServer.Responses.Models.CreateResponse * Func<System.Threading.CancellationToken, System.Threading.Tasks.Task<string>> * Action<Azure.AI.AgentServer.Responses.Models.ResponseObject> -> Azure.AI.AgentServer.Responses.TextResponse
Public Sub New (context As ResponseContext, request As CreateResponse, createText As Func(Of CancellationToken, Task(Of String)), Optional configure As Action(Of ResponseObject) = Nothing)

Parameters

context
ResponseContext

The response context (provides the response ID).

request
CreateResponse

The incoming create-response request.

createText
Func<CancellationToken,Task<String>>

An async delegate that produces the complete response text. Called after response.created and response.in_progress have been emitted, so the client sees progress before the potentially slow text generation begins.

configure
Action<ResponseObject>

An optional callback to configure the ResponseObject (e.g., set Temperature, Instructions, Metadata) before response.created is emitted.

Applies to