A file attached to a ChatMessage, for example an image the user sends to a multimodal model.
Object
Namespace: Radzen.Blazor
Assembly: Radzen.Blazor.dll
public class ChatAttachmentA file attached to a ChatMessage, for example an image the user sends to a multimodal model.
public ChatAttachment()Gets or sets the file content.
public ReadOnlyMemory<byte> Data { get; set; }
| Type | Description |
|---|---|
| ReadOnlyMemory<byte> | Gets or sets the file content. |
Gets whether the attachment is an image.
public bool IsImage { get; }
| Type | Description |
|---|---|
| bool | Gets whether the attachment is an image. |
Gets or sets the media type, for example image/png.
public string MediaType { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the media type, for example image/png. |
Gets or sets the file name.
public string Name { get; set; }
| Type | Description |
|---|---|
| string | Gets or sets the file name. |
Gets the content as a data URI, usable as an image source.
public string Url { get; }
| Type | Description |
|---|---|
| string | Gets the content as a data URI, usable as an image source. |
Creates an attachment from the DataContent of a message.
public static ChatAttachment FromDataContent(Microsoft.Extensions.AI.DataContent content)
| Type | Name | Description |
|---|---|---|
| Microsoft.Extensions.AI.DataContent | content | The content. |
| Type | Description |
|---|---|
| ChatAttachment |
Gets the media type for a file name from its extension, or application/octet-stream when unknown.
public static string GetMediaType(string fileName)
| Type | Name | Description |
|---|---|---|
| string | fileName | The file name. |
| Type | Description |
|---|---|
| string |
Converts the attachment to the DataContent sent to the model.
public Microsoft.Extensions.AI.DataContent ToDataContent()
| Type | Description |
|---|---|
| Microsoft.Extensions.AI.DataContent |