LlamaMessage class abstract

An abstract class representing a chat message.

This class provides a base for different types of chat messages, each with a specific role and content.

Properties:

  • role: A string representing the role of the message sender.
  • content: The content of the message.

Constructors:

  • LlamaMessage(String content): Initializes a chat message with the given content.
  • LlamaMessage.withRole({required String role, required String content}): Factory constructor that creates a chat message based on the specified role. Throws an ArgumentError if the role is invalid.
  • LlamaMessage._fromRecord(_LlamaMessageRecord record): Factory constructor that creates a chat message from a record.
  • LlamaMessage.fromNative(llama_chat_message message): Factory constructor that creates a chat message from a native llama_chat_message.

Methods:

  • llama_chat_message toNative(): Converts the chat message to a native llama_chat_message.
  • _LlamaMessageRecord _toRecord(): Converts the chat message to a record.
Implementers

Constructors

LlamaMessage.new(String content)
Creates a new instance of LlamaMessage with the given content.
LlamaMessage.fromMap(Map<String, dynamic> map)
Creates a LlamaMessage instance from a map.
factory
LlamaMessage.withRole({required String role, required String content})
Factory constructor to create a LlamaMessage instance based on the provided role.
factory

Properties

content String
The content of the chat message.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
role String
The role of the chat message sender.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toMap() Map<String, String>
Converts the current LlamaMessage instance to a map.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

messageToMap(LlamaMessage message) Map<String, String>
Converts a LlamaMessage object to a map representation.