Table of Contents

Class Message

Namespace
Mythosia.AI.Models.Messages
Assembly
Mythosia.AI.Abstractions.dll

Represents a message in a conversation, supporting both text-only and multimodal content

public class Message
Inheritance
Message
Inherited Members

Constructors

Message(ActorRole, MessageContent)

Single content constructor

public Message(ActorRole role, MessageContent content)

Parameters

role ActorRole
content MessageContent

Message(ActorRole, List<MessageContent>)

Multimodal constructor

public Message(ActorRole role, List<MessageContent> contents)

Parameters

role ActorRole
contents List<MessageContent>

Message(ActorRole, string)

Text-only constructor (backward compatible)

public Message(ActorRole role, string content)

Parameters

role ActorRole
content string

Properties

Content

public string Content { get; set; }

Property Value

string

Contents

public List<MessageContent> Contents { get; set; }

Property Value

List<MessageContent>

HasMultimodalContent

Indicates whether this message contains multimodal content

public bool HasMultimodalContent { get; }

Property Value

bool

Id

public string Id { get; }

Property Value

string

Metadata

Optional metadata for the message (e.g., function call info)

public Dictionary<string, object> Metadata { get; set; }

Property Value

Dictionary<string, object>

Role

public ActorRole Role { get; set; }

Property Value

ActorRole

Timestamp

public DateTime Timestamp { get; set; }

Property Value

DateTime

Methods

Clone()

Creates a deep copy of the message

public Message Clone()

Returns

Message

EstimateTokens()

Estimates the total token count for this message

public uint EstimateTokens()

Returns

uint

GetDisplayText()

Gets a display-friendly representation of the message

public string GetDisplayText()

Returns

string

ToRequestFormat(string)

Converts the message to the appropriate format for the specified AI provider

public object ToRequestFormat(string provider)

Parameters

provider string

Returns

object