Interface Conversation
-
- All Implemented Interfaces:
-
com.embabel.chat.AssetView,com.embabel.common.core.Identified,com.embabel.common.core.StableIdentified,com.embabel.common.core.types.HasInfoString
public interface Conversation implements StableIdentified, HasInfoString, AssetView
Conversation shim for agent system. Mutable. Conversation AssetView shows assets both from our AssetTracker and messages.
-
-
Method Summary
Modifier and Type Method Description UserMessagelastMessageIfBeFromUser()Non-null if the conversation has messages and the last message is from the user. abstract MessageaddMessage(Message message)Modify the state of this conversation. MessageaddMessageFrom(Message message, User author)Add a message with explicit author attribution. MessageaddMessageFromTo(Message message, User from, User to)Add a message with explicit author and recipient. PromptContributorpromptContributor(ConversationFormatter conversationFormatter)Prompt contributor that represents the conversation so far. StringinfoString(Boolean verbose, Integer indent)abstract Conversationlast(Integer n)Create a nonpersistent conversation with the last n messages from this conversation. abstract List<Message>getMessages()Messages in the conversation in chronological order. abstract AssetTrackergetAssetTracker()Assets tracked in the conversation. List<Asset>getAssets()All tracked assets, in order in which they were added -
Methods inherited from class com.embabel.common.core.Identified
persistent -
Methods inherited from class com.embabel.chat.AssetView
mostRecent, mostRecentlyAdded, references, since -
Methods inherited from class com.embabel.common.core.StableIdentified
getId -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
lastMessageIfBeFromUser
UserMessage lastMessageIfBeFromUser()
Non-null if the conversation has messages and the last message is from the user.
-
addMessage
abstract Message addMessage(Message message)
Modify the state of this conversation. Return the newly added message for convenience.
-
addMessageFrom
Message addMessageFrom(Message message, User author)
Add a message with explicit author attribution. Useful for group chats or when the author differs per message.
- Parameters:
message- the message to addauthor- the author of this message (null for system/assistant messages)- Returns:
the newly added message
-
addMessageFromTo
Message addMessageFromTo(Message message, User from, User to)
Add a message with explicit author and recipient. Use this for multi-party chats where both sender and receiver need to be specified.
- Parameters:
message- the message to addfrom- the author of this message (who sent it)to- the recipient of this message (who should receive it)- Returns:
the newly added message
-
promptContributor
PromptContributor promptContributor(ConversationFormatter conversationFormatter)
Prompt contributor that represents the conversation so far. Usually we will want to add messages from the conversation to a prompt instead of formatting the conversation
-
infoString
String infoString(Boolean verbose, Integer indent)
-
last
abstract Conversation last(Integer n)
Create a nonpersistent conversation with the last n messages from this conversation.
-
getMessages
abstract List<Message> getMessages()
Messages in the conversation in chronological order. Visible to user.
-
getAssetTracker
abstract AssetTracker getAssetTracker()
Assets tracked in the conversation.
-
-
-
-