# SmartSession.Message

Namespace: **Wisej.AI**

Assembly: **Wisej.AI** (3.5.0.0)

Represents a message within a SmartSession, containing various types of content such as text, image, and binary data.

{% tabs %}
{% tab title="C#" %}

```csharp
public class Message
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class Message
```

{% endtab %}
{% endtabs %}

The `Message` class is used to encapsulate different types of content that can be part of a session. It includes properties for text, image, and binary content, as well as methods to retrieve role and image data in specific formats.

## Constructors

### ![](/files/ptrKjmmRoQB76pvrIqh0) Message()

Initializes a new instance of [Message](/ai/components/api/smartsession/wisej.ai.smartsession.message.md).

## Properties

### ![](/files/ptrKjmmRoQB76pvrIqh0) Binary

[BinaryContent](https://docs.wisej.com/api?q=wisej.ai.smartsession+binarycontent): Gets or sets the binary content of the message.

### ![](/files/ptrKjmmRoQB76pvrIqh0) FinishReason

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets the "finish\_reason" returned by the model.

### ![](/files/ptrKjmmRoQB76pvrIqh0) Image

[Image](https://docs.microsoft.com/dotnet/api/system.drawing.image): Gets or sets the image content of the message.

### ![](/files/ptrKjmmRoQB76pvrIqh0) Role

[MessageRole](/ai/components/api/smartsession/wisej.ai.smartsession.messagerole.md): Gets or sets the role associated with the message.

### ![](/files/ptrKjmmRoQB76pvrIqh0) Text

[String](https://docs.microsoft.com/dotnet/api/system.string): Gets or sets the text content of the message.

### ![](/files/ptrKjmmRoQB76pvrIqh0) Usage

[Metrics](/ai/components/api/smartendpoint/wisej.ai.smartendpoint.metrics.md): Gets the usage metrics associated with the message.

## Methods

### ![](/files/ptrKjmmRoQB76pvrIqh0) GetImageBase64()

Converts the image content of the message to a Base64 string.

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). A Base64 string representation of the image content.

If the image is null, an empty string is returned. Otherwise, the image is serialized to a Base64 string.

### ![](/files/ptrKjmmRoQB76pvrIqh0) GetImageBase64DataURL()

Converts the image content of the message to a Base64 Data URL string.

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). A Base64 Data URL string representation of the image content.

If the image is null, an empty string is returned. Otherwise, the image is serialized to a Base64 Data URL string.

### ![](/files/ptrKjmmRoQB76pvrIqh0) GetImageMediaType()

Returns the media type string for the image content.

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). The media type string, or an empty string if the image is null.

### ![](/files/ptrKjmmRoQB76pvrIqh0) GetRole()

Retrieves the role of the message as a string.

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). A string representing the role of the message.

The method returns a string representation of the message role, which can be "system", "assistant", or "user".


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/ai/components/api/smartsession/wisej.ai.smartsession.message.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
