AI DevKit
Search Results for

    Show / Hide Table of Contents

    Class ChatMessage

    Inheritance
    object
    ChatMessage
    AssistantMessage
    ThreadMessage
    SystemMessage
    UserMessage
    Namespace: Glitch9.AIDevKit
    Assembly: .dll
    Syntax
    public abstract class ChatMessage

    Constructors

    ChatMessage(ChatContent)

    Declaration
    protected ChatMessage(ChatContent content = null)
    Parameters
    Type Name Description
    ChatContent content

    Properties

    Content

    The contents of the user message.

    Declaration
    public ChatContent Content { get; set; }
    Property Value
    Type Description
    ChatContent

    Name

    Optional. An optional name for the participant. Provides the model information to differentiate between participants of the same role.

    Declaration
    public string Name { get; set; }
    Property Value
    Type Description
    string

    Role

    The role of the messages author.

    Role is abstract and overridden in derived classes to enforce consistency.
    This avoids relying on constructor or deserialization logic to set the role.
    JSON.NET does not call parameterized constructors or set get-only properties during deserialization.

    Declaration
    public abstract ChatRole Role { get; }
    Property Value
    Type Description
    ChatRole

    Timestamp

    Declaration
    public UnixTime Timestamp { get; }
    Property Value
    Type Description
    UnixTime

    Methods

    Create(ChatRole, ChatContent)

    Declaration
    public static ChatMessage Create(ChatRole role, ChatContent content = null)
    Parameters
    Type Name Description
    ChatRole role
    ChatContent content
    Returns
    Type Description
    ChatMessage

    ToString()

    Returns a string that represents the current object.

    Declaration
    public override string ToString()
    Returns
    Type Description
    string

    A string that represents the current object.

    Overrides
    object.ToString()

    Operators

    implicit operator string(ChatMessage)

    Declaration
    public static implicit operator string(ChatMessage message)
    Parameters
    Type Name Description
    ChatMessage message
    Returns
    Type Description
    string

    implicit operator ChatMessage(string)

    Declaration
    public static implicit operator ChatMessage(string message)
    Parameters
    Type Name Description
    string message
    Returns
    Type Description
    ChatMessage

    Extension Methods

    ConverterExtensions.ToAnthropicMessage(ChatMessage)
    ChatMessageExtensions.IsNullOrEmpty(ChatMessage)
    ThreadMessageExtensions.ToThreadMessageRequest(ChatMessage)
    In this article
    Back to top Generated by DocFX