Class Message
public abstract class Message : StatefulItem, IPromptWithFiles, IPrompt, IModeratable
- Inheritance
-
objectMessage
- Implements
- Derived
- Inherited Members
- Extension Methods
Constructors
Message()
protected Message()
Message(MessageContent)
protected Message(MessageContent content = null)
Parameters
contentMessageContent
Properties
Content
The contents of the user message.
public MessageContent Content { get; set; }
Property Value
CreatedAt
public UnixTime CreatedAt { get; }
Property Value
- UnixTime
DisplayMessage
public string DisplayMessage { get; set; }
Property Value
- string
Name
Optional. An optional name for the participant. Provides the model information to differentiate between participants of the same role.
public string Name { get; set; }
Property Value
- string
PromptType
public override PromptType PromptType { get; }
Property Value
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.
public abstract ChatRole Role { get; }
Property Value
ThreadId
The conversation thread that this message belongs to.
public string ThreadId { get; set; }
Property Value
- string
Methods
Create(ChatRole, MessageContent, UnixTime?, string)
public static Message Create(ChatRole role, MessageContent content = null, UnixTime? createdAt = null, string threadId = null)
Parameters
roleChatRolecontentMessageContentcreatedAtUnixTime?threadIdstring
Returns
Create(MessageContent, UnixTime?, string)
public static Message Create(MessageContent content, UnixTime? createdAt = null, string threadId = null)
Parameters
contentMessageContentcreatedAtUnixTime?threadIdstring
Returns
GetInputFiles()
public List<IFile> GetInputFiles()
Returns
- List<IFile>
GetInputText()
public override string GetInputText()
Returns
- string
GetMessageText()
public string GetMessageText()
Returns
- string
IsValid()
public override bool IsValid()
Returns
- bool
LoadFilesAsync()
public UniTask LoadFilesAsync()
Returns
- UniTask
RequiresLoading()
public bool RequiresLoading()
Returns
- bool
ToModerationPrompt()
public ModerationPrompt ToModerationPrompt()
Returns
ToString()
public override string ToString()
Returns
- string
Operators
implicit operator string(Message)
public static implicit operator string(Message message)
Parameters
messageMessage
Returns
- string
implicit operator Message(Prompt)
public static implicit operator Message(Prompt prompt)
Parameters
promptPrompt
Returns
implicit operator Message(string)
public static implicit operator Message(string message)
Parameters
messagestring