AI DevKit
Search Results for

    Show / Hide Table of Contents

    Class UserMessage

    Inheritance
    object
    ChatMessage
    UserMessage
    Inherited Members
    ChatMessage.Content
    ChatMessage.Name
    ChatMessage.Timestamp
    ChatMessage.Create(ChatRole, ChatContent)
    ChatMessage.ToString()
    Namespace: Glitch9.AIDevKit
    Assembly: .dll
    Syntax
    public class UserMessage : ChatMessage

    Constructors

    UserMessage()

    Declaration
    public UserMessage()

    UserMessage(ChatContent)

    Declaration
    public UserMessage(ChatContent content)
    Parameters
    Type Name Description
    ChatContent content

    Properties

    AttachedFiles

    [Local-only. This is not sent to the model.]

    A list of files attached to the user message.

    This property serves two purposes:

    • To temporarily hold files before sending them to the model.
    • To locally store files that are part of the user message.
    Declaration
    public List<IFile> AttachedFiles { get; set; }
    Property Value
    Type Description
    List<IFile>

    Moderations

    [Local-only. This is not sent to the model.]

    A list of safety ratings (moderations) for the user message.

    This property serves two purposes:

    • To temporarily hold moderation results for local processing (e.g., blocking messages, filtering content, UI display).
    • To locally store safety ratings that are part of the user message.
    Declaration
    public List<SafetyRating> Moderations { get; set; }
    Property Value
    Type Description
    List<SafetyRating>

    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 override ChatRole Role { get; }
    Property Value
    Type Description
    ChatRole
    Overrides
    ChatMessage.Role

    Methods

    AttachFiles(params IFile[])

    Adds a file to the user message's attachments.

    Declaration
    public void AttachFiles(params IFile[] files)
    Parameters
    Type Name Description
    IFile[] files

    AttachFiles(IEnumerable<IFile>)

    Adds multiple files to the user message's attachments.

    Declaration
    public void AttachFiles(IEnumerable<IFile> files)
    Parameters
    Type Name Description
    IEnumerable<IFile> files

    SetMessageText(string)

    Declaration
    public void SetMessageText(string text)
    Parameters
    Type Name Description
    string text

    Operators

    implicit operator string(UserMessage)

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

    Extension Methods

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