Class ChatMessage
public abstract class ChatMessage
- Inheritance
-
objectChatMessage
- Derived
- Extension Methods
Constructors
ChatMessage(ChatContent)
protected ChatMessage(ChatContent content = null)
Parameters
contentChatContent
Properties
Content
The contents of the user message.
public ChatContent Content { get; set; }
Property Value
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
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
Timestamp
public UnixTime Timestamp { get; }
Property Value
- UnixTime
Methods
Create(ChatRole, ChatContent)
public static ChatMessage Create(ChatRole role, ChatContent content = null)
Parameters
roleChatRolecontentChatContent
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Operators
implicit operator string(ChatMessage)
public static implicit operator string(ChatMessage message)
Parameters
messageChatMessage
Returns
- string
implicit operator ChatMessage(string)
public static implicit operator ChatMessage(string message)
Parameters
messagestring