Share via


ChatResponseExtensions.ToChatResponse Method

Definition

Combines ChatResponseUpdate instances into a single ChatResponse.

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::AI::ChatResponse ^ ToChatResponse(System::Collections::Generic::IEnumerable<Microsoft::Extensions::AI::ChatResponseUpdate ^> ^ updates);
public static Microsoft.Extensions.AI.ChatResponse ToChatResponse(this System.Collections.Generic.IEnumerable<Microsoft.Extensions.AI.ChatResponseUpdate> updates);
static member ToChatResponse : seq<Microsoft.Extensions.AI.ChatResponseUpdate> -> Microsoft.Extensions.AI.ChatResponse
<Extension()>
Public Function ToChatResponse (updates As IEnumerable(Of ChatResponseUpdate)) As ChatResponse

Parameters

updates
IEnumerable<ChatResponseUpdate>

The updates to be combined.

Returns

The combined ChatResponse.

Exceptions

updates is null.

Remarks

As part of combining updates into a single ChatResponse, the method will attempt to reconstruct ChatMessage instances. This includes using MessageId to determine message boundaries, as well as coalescing contiguous AIContent items where applicable, e.g. multiple TextContent instances in a row may be combined into a single TextContent.

Applies to