org.llm4s.llmconnect.model.Conversation
See theConversation companion object
Represents the message stream in a conversation. Typically this will be a sequence of system prompt, then a series of user message and assistant responses. After the system message we have a user message. The next message is the assistant response. If the conversation is ongoing, the next message will be a user message, or if the previous AssistantMessage requested one or more tool calls it will be followed by ToolMessages in response to each requested tool.
Value parameters
messages
Sequence of messages in the conversation.
Attributes
Companion
object
Graph
Reset zoom Hide graph Show graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Members list
Add a message and return a new Conversation. This operation is immutable - the original conversation is unchanged.
Add a message and return a new Conversation. This operation is immutable - the original conversation is unchanged.
Value parameters
message
The message to add
Attributes
Returns
A new Conversation containing all previous messages plus the new one
Add multiple messages and return a new Conversation. This operation is immutable - the original conversation is unchanged.
Add multiple messages and return a new Conversation. This operation is immutable - the original conversation is unchanged.
Value parameters
newMessages
The messages to add
Attributes
Returns
A new Conversation containing all previous messages plus the new ones
Value parameters
role
The message role to filter by
Attributes
Returns
Sequence of messages matching the role
Get the last message in the conversation.
Get the last message in the conversation.
Attributes
Returns
Some(Message) if conversation has messages, None if empty
Attributes
Returns
Number of messages in the conversation
Attributes
Inherited from:
Product
Attributes
Inherited from:
Product