Class Message
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
roleActorRolecontentMessageContent
Message(ActorRole, List<MessageContent>)
Multimodal constructor
public Message(ActorRole role, List<MessageContent> contents)
Parameters
roleActorRolecontentsList<MessageContent>
Message(ActorRole, string)
Text-only constructor (backward compatible)
public Message(ActorRole role, string content)
Parameters
Properties
Content
public string Content { get; set; }
Property Value
Contents
public List<MessageContent> Contents { get; set; }
Property Value
HasMultimodalContent
Indicates whether this message contains multimodal content
public bool HasMultimodalContent { get; }
Property Value
Id
public string Id { get; }
Property Value
Metadata
Optional metadata for the message (e.g., function call info)
public Dictionary<string, object> Metadata { get; set; }
Property Value
Role
public ActorRole Role { get; set; }
Property Value
Timestamp
public DateTime Timestamp { get; set; }
Property Value
Methods
Clone()
Creates a deep copy of the message
public Message Clone()
Returns
EstimateTokens()
Estimates the total token count for this message
public uint EstimateTokens()
Returns
GetDisplayText()
Gets a display-friendly representation of the message
public string GetDisplayText()
Returns
ToRequestFormat(string)
Converts the message to the appropriate format for the specified AI provider
public object ToRequestFormat(string provider)
Parameters
providerstring