ResponseEventStream Class
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.
Top-level scope for building a streaming response event sequence. Manages the global sequence counter and output index counter, and provides factory methods for creating child scopes (message builders, function call builders). Owns a private Response object that is embedded in emitted events.
public class ResponseEventStream
type ResponseEventStream = class
Public Class ResponseEventStream
- Inheritance
-
ResponseEventStream
Constructors
| Name | Description |
|---|---|
| ResponseEventStream() |
Initializes a new instance of ResponseEventStream for mocking. |
| ResponseEventStream(ResponseContext, CreateResponse) |
Creates a new event stream that builds its own Response from the request. |
Properties
| Name | Description |
|---|---|
| Response |
Gets the ResponseObject object being constructed.
Allows the handler to set any ResponseObject property
(e.g. |
Methods
| Name | Description |
|---|---|
| AddOutputItem<T>(String) |
Creates an output item scope with the next output index.
Use for output item types that have no dedicated |
| AddOutputItemApplyPatchCall() |
Creates an apply-patch call output item scope with the next output index and an auto-generated item ID. |
| AddOutputItemApplyPatchCallOutput() |
Creates an apply-patch call output result scope with the next output index and an auto-generated item ID. |
| AddOutputItemCodeInterpreterCall() |
Creates a code interpreter call output item scope with the next output index and an auto-generated item ID. |
| AddOutputItemCompaction() |
Creates a compaction output item scope with the next output index and an auto-generated item ID. |
| AddOutputItemComputerCall() |
Creates a computer tool call output item scope with the next output index and an auto-generated item ID. |
| AddOutputItemComputerCallOutput() |
Creates a computer tool call output result scope with the next output index and an auto-generated item ID. |
| AddOutputItemCustomToolCall(String, String) |
Creates a custom tool call output item scope with the next output index and an auto-generated item ID. |
| AddOutputItemCustomToolCallOutput() |
Creates a custom tool call output result scope with the next output index and an auto-generated item ID. |
| AddOutputItemFileSearchCall() |
Creates a file search call output item scope with the next output index and an auto-generated item ID. |
| AddOutputItemFunctionCall(String, String) |
Creates a function call output item scope with the next output index and an auto-generated item ID. |
| AddOutputItemFunctionShellCall() |
Creates a function shell call output item scope with the next output index and an auto-generated item ID. |
| AddOutputItemFunctionShellCallOutput() |
Creates a function shell call output result scope with the next output index and an auto-generated item ID. |
| AddOutputItemImageGenCall() |
Creates an image generation call output item scope with the next output index and an auto-generated item ID. |
| AddOutputItemLocalShellCall() |
Creates a local shell call output item scope with the next output index and an auto-generated item ID. |
| AddOutputItemLocalShellCallOutput() |
Creates a local shell call output result scope with the next output index and an auto-generated item ID. |
| AddOutputItemMcpApprovalRequest() |
Creates an MCP approval request output item scope with the next output index and an auto-generated item ID. |
| AddOutputItemMcpApprovalResponse() |
Creates an MCP approval response output item scope with the next output index and an auto-generated item ID. |
| AddOutputItemMcpCall(String, String) |
Creates an MCP tool call output item scope with the next output index and an auto-generated item ID. |
| AddOutputItemMcpListTools(String) |
Creates an MCP list-tools output item scope with the next output index and an auto-generated item ID. |
| AddOutputItemMessage() |
Creates a message output item scope with the next output index and an auto-generated item ID. |
| AddOutputItemReasoningItem() |
Creates a reasoning output item scope with the next output index and an auto-generated item ID. |
| AddOutputItemStructuredOutputs() |
Creates a structured outputs item scope with the next output index and an auto-generated item ID. |
| AddOutputItemWebSearchCall() |
Creates a web search call output item scope with the next output index and an auto-generated item ID. |
| EmitCompleted(ResponseUsage) |
Produces a |
| EmitCreated(ResponseStatus) |
Produces a |
| EmitFailed(ResponseErrorCode, String, ResponseUsage) |
Produces a |
| EmitFailed(String, ResponseUsage) |
Produces a |
| EmitIncomplete(Nullable<ResponseIncompleteDetailsReason>, ResponseUsage) |
Produces a |
| EmitInProgress() |
Produces a |
| EmitQueued() |
Produces a |
| NextSequenceNumber() |
Returns the next sequence number for use with manually constructed events. Uses post-increment semantics: returns the current value and then increments. |
| OutputItemApplyPatchCall(String, ApplyPatchCallStatus, ApplyPatchFileOperation) |
Convenience generator that yields the complete apply-patch tool call lifecycle.
Apply-patch calls have no intermediate events — only |
| OutputItemApplyPatchCallOutput(String, ApplyPatchCallOutputStatus) |
Convenience generator that yields the complete apply-patch tool call output lifecycle.
Apply-patch call outputs have no intermediate events — only |
| OutputItemCompaction(String) |
Convenience generator that yields the complete compaction output-item lifecycle.
Compaction items have no intermediate events — only |
| OutputItemComputerCall(String, ComputerAction, IEnumerable<ComputerCallSafetyCheckParam>, ItemComputerToolCallStatus) |
Convenience generator that yields the complete computer tool call output-item lifecycle.
Computer call outputs have no intermediate events — only |
| OutputItemComputerCallOutput(String, ComputerScreenshotImage) |
Convenience generator that yields the complete computer tool call output resource lifecycle.
Computer call outputs have no intermediate events — only |
| OutputItemCustomToolCallOutput(String, BinaryData) |
Convenience generator that yields the complete custom tool call output lifecycle.
Custom tool call outputs have no intermediate events — only |
| OutputItemFunctionCall(String, String, IAsyncEnumerable<String>, CancellationToken) |
Convenience generator that yields the complete function call output-item lifecycle with arguments from streaming chunks (S-056, S-058). |
| OutputItemFunctionCall(String, String, String) |
Convenience generator that yields the complete function call output-item lifecycle with arguments from a complete string (S-056). |
| OutputItemFunctionCallOutput(String, BinaryData) |
Convenience generator that yields the complete function call output item lifecycle
(S-056). Function call outputs have no deltas — only |
| OutputItemFunctionShellCall(String, FunctionShellAction, LocalShellCallStatus, FunctionShellCallEnvironment) |
Convenience generator that yields the complete function shell call lifecycle.
Function shell calls have no intermediate events — only |
| OutputItemFunctionShellCallOutput(String, LocalShellCallOutputStatusEnum, IEnumerable<FunctionShellCallOutputContent>, Nullable<Int64>) |
Convenience generator that yields the complete function shell call output lifecycle.
Function shell call outputs have no intermediate events — only |
| OutputItemImageGenCall(String) |
Convenience generator that yields the complete image generation call output-item lifecycle from a final base64-encoded image result. |
| OutputItemLocalShellCall(String, LocalShellExecAction, ItemLocalShellToolCallStatus) |
Convenience generator that yields the complete local shell tool call lifecycle.
Local shell calls have no intermediate events — only |
| OutputItemLocalShellCallOutput(String) |
Convenience generator that yields the complete local shell tool call output lifecycle.
Local shell call outputs have no intermediate events — only |
| OutputItemMcpApprovalRequest(String, String, String) |
Convenience generator that yields the complete MCP approval request lifecycle.
MCP approval requests have no intermediate events — only |
| OutputItemMcpApprovalResponse(String, Boolean) |
Convenience generator that yields the complete MCP approval response lifecycle.
MCP approval responses have no intermediate events — only |
| OutputItemMessage(IAsyncEnumerable<String>, CancellationToken) |
Convenience generator that yields the complete message output-item lifecycle with a single text content part from streaming chunks (S-056, S-058). |
| OutputItemMessage(String, IEnumerable<Annotation>) |
Convenience generator that yields the complete message output-item lifecycle with a single text content part and annotations (S-056). |
| OutputItemMessage(String) |
Convenience generator that yields the complete message output-item lifecycle with a single text content part from a complete string (S-056). |
| OutputItemReasoningItem(IAsyncEnumerable<String>, CancellationToken) |
Convenience generator that yields the complete reasoning output-item lifecycle with a single summary part from streaming chunks (S-056, S-058). |
| OutputItemReasoningItem(String) |
Convenience generator that yields the complete reasoning output-item lifecycle with a single summary part from a complete string (S-056). |
| OutputItemStructuredOutputs(BinaryData) |
Convenience generator that yields the complete structured outputs item lifecycle. Use this to return any open-ended structured information as a JSON object. This is useful when none of the existing output item types (message, function call, image, etc.) fit your use case — for example, returning analytics results, classification labels, form data, or any custom JSON payload. |