Compartir a través de


ChatResponseUpdate Class

Definition

Represents a single streaming response chunk from an IChatClient.

public ref class ChatResponseUpdate
public class ChatResponseUpdate
type ChatResponseUpdate = class
Public Class ChatResponseUpdate
Inheritance
ChatResponseUpdate

Remarks

ChatResponseUpdate is so named because it represents updates that layer on each other to form a single chat response. Conceptually, this combines the roles of ChatResponse and ChatMessage in streaming output. For ease of consumption, it also flattens the nested structure you see on streaming chunks in some AI services, so instead of a dictionary of choices, each update is part of a single choice (and hence has its own role, choice ID, etc.).

The relationship between ChatResponse and ChatResponseUpdate is codified in the ToChatResponseAsync(IAsyncEnumerable<ChatResponseUpdate>, Boolean, CancellationToken) and ToChatResponseUpdates(), which enable bidirectional conversions between the two. Note, however, that the provided conversions may be lossy, for example if multiple updates all have different RawRepresentation objects whereas there's only one slot for such an object available in RawRepresentation. Similarly, if different updates that are part of the same choice provide different values for properties like ModelId, only one of the values will be used to populate ModelId.

Constructors

ChatResponseUpdate()

Properties

AdditionalProperties

Gets or sets additional properties for the update.

AuthorName

Gets or sets the name of the author of the response update.

ChatThreadId

Gets or sets the chat thread ID associated with the chat response of which this update is a part.

ChoiceIndex

Gets or sets the zero-based index of the choice with which this update is associated in the streaming sequence.

Contents

Gets or sets the chat response update content items.

CreatedAt

Gets or sets a timestamp for the response update.

FinishReason

Gets or sets the finish reason for the operation.

ModelId

Gets or sets the model ID associated with this response update.

RawRepresentation

Gets or sets the raw representation of the response update from an underlying implementation.

ResponseId

Gets or sets the ID of the response of which this update is a part.

Role

Gets or sets the role of the author of the response update.

Text

Gets or sets the text of the first TextContent instance in Contents.

Methods

ToString()

Returns a string that represents the current object.

Applies to