Skip to main content
All docs
V24.2

AIChatExtensions.ToBlazorChatMessages(IEnumerable<ChatMessage>) Method

Converts Microsoft.Extensions.AI.ChatMessage objects to BlazorChatMessage objects.

Namespace: DevExpress.AIIntegration.Blazor.Chat

Assembly: DevExpress.AIIntegration.Blazor.Chat.v24.2.dll

NuGet Package: DevExpress.AIIntegration.Blazor.Chat

Declaration

public static IEnumerable<BlazorChatMessage> ToBlazorChatMessages(
    this IEnumerable<ChatMessage> messages
)

Parameters

Name Type Description
messages IEnumerable<Microsoft.Extensions.AI.ChatMessage>

A collection of Microsoft.Extensions.AI.ChatMessage objects.

Returns

Type Description
IEnumerable<BlazorChatMessage>

A collection of BlazorChatMessage objects.

Remarks

The DxAIChat component operates with BlazorChatMessage objects while AI services operate with Microsoft.Extensions.AI.ChatMessage objects. Use the ToBlazorChatMessages(IEnumerable<ChatMessage>) and ToChatMessages(IEnumerable<BlazorChatMessage>) methods to convert message types.

See Also