ChatResponseExtensions.AddMessages Method
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.
Overloads
| AddMessages(IList<ChatMessage>, ChatResponse) |
Adds all of the messages from |
| AddMessages(IList<ChatMessage>, IEnumerable<ChatResponseUpdate>) |
Converts the |
| AddMessages(IList<ChatMessage>, ChatResponseUpdate, Func<AIContent,Boolean>) |
Converts the |
AddMessages(IList<ChatMessage>, ChatResponse)
- Source:
- ChatResponseExtensions.cs
Adds all of the messages from response into list.
public:
[System::Runtime::CompilerServices::Extension]
static void AddMessages(System::Collections::Generic::IList<Microsoft::Extensions::AI::ChatMessage ^> ^ list, Microsoft::Extensions::AI::ChatResponse ^ response);
public static void AddMessages(this System.Collections.Generic.IList<Microsoft.Extensions.AI.ChatMessage> list, Microsoft.Extensions.AI.ChatResponse response);
static member AddMessages : System.Collections.Generic.IList<Microsoft.Extensions.AI.ChatMessage> * Microsoft.Extensions.AI.ChatResponse -> unit
<Extension()>
Public Sub AddMessages (list As IList(Of ChatMessage), response As ChatResponse)
Parameters
- list
- IList<ChatMessage>
The destination list to which the messages from response should be added.
- response
- ChatResponse
The response containing the messages to add.
Exceptions
response is null.
Applies to
AddMessages(IList<ChatMessage>, IEnumerable<ChatResponseUpdate>)
- Source:
- ChatResponseExtensions.cs
Converts the updates into ChatMessage instances and adds them to list.
public:
[System::Runtime::CompilerServices::Extension]
static void AddMessages(System::Collections::Generic::IList<Microsoft::Extensions::AI::ChatMessage ^> ^ list, System::Collections::Generic::IEnumerable<Microsoft::Extensions::AI::ChatResponseUpdate ^> ^ updates);
public static void AddMessages(this System.Collections.Generic.IList<Microsoft.Extensions.AI.ChatMessage> list, System.Collections.Generic.IEnumerable<Microsoft.Extensions.AI.ChatResponseUpdate> updates);
static member AddMessages : System.Collections.Generic.IList<Microsoft.Extensions.AI.ChatMessage> * seq<Microsoft.Extensions.AI.ChatResponseUpdate> -> unit
<Extension()>
Public Sub AddMessages (list As IList(Of ChatMessage), updates As IEnumerable(Of ChatResponseUpdate))
Parameters
- list
- IList<ChatMessage>
The destination list to which the newly constructed messages should be added.
- updates
- IEnumerable<ChatResponseUpdate>
The ChatResponseUpdate instances to convert to messages and add to the list.
Exceptions
updates is null.
Remarks
As part of combining updates into a series of ChatMessage instances, the method may use MessageId to determine message boundaries, as well as coalesce contiguous AIContent items where applicable, e.g. multiple TextContent instances in a row may be combined into a single TextContent.
Applies to
AddMessages(IList<ChatMessage>, ChatResponseUpdate, Func<AIContent,Boolean>)
- Source:
- ChatResponseExtensions.cs
Converts the update into a ChatMessage instance and adds it to list.
public static void AddMessages(this System.Collections.Generic.IList<Microsoft.Extensions.AI.ChatMessage> list, Microsoft.Extensions.AI.ChatResponseUpdate update, Func<Microsoft.Extensions.AI.AIContent,bool>? filter = default);
static member AddMessages : System.Collections.Generic.IList<Microsoft.Extensions.AI.ChatMessage> * Microsoft.Extensions.AI.ChatResponseUpdate * Func<Microsoft.Extensions.AI.AIContent, bool> -> unit
<Extension()>
Public Sub AddMessages (list As IList(Of ChatMessage), update As ChatResponseUpdate, Optional filter As Func(Of AIContent, Boolean) = Nothing)
Parameters
- list
- IList<ChatMessage>
The destination list to which the newly constructed message should be added.
- update
- ChatResponseUpdate
The ChatResponseUpdate instance to convert to a message and add to the list.
Exceptions
update is null.
Remarks
If the ChatResponseUpdate has no content, or all its content gets excluded by filter, then no ChatMessage will be added to the list.