SmartSession.Message

Wisej.AI.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.

public class Message

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

Message()

Initializes a new instance of Message.

Properties

Binary

BinaryContent: Gets or sets the binary content of the message.

FinishReason

String: Gets the "finish_reason" returned by the model.

Image

Image: Gets or sets the image content of the message.

Role

MessageRole: Gets or sets the role associated with the message.

Text

String: Gets or sets the text content of the message.

Usage

Metrics: Gets the usage metrics associated with the message.

Methods

GetImageBase64()

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

Returns: 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.

GetImageBase64DataURL()

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

Returns: 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.

GetImageMediaType()

Returns the media type string for the image content.

Returns: String. The media type string, or an empty string if the image is null.

GetRole()

Retrieves the role of the message as a string.

Returns: 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".

Last updated