Package com.embabel.chat
Interface ConversationFactory
-
- All Implemented Interfaces:
public interface ConversationFactoryFactory for creating and loading Conversation instances.
Implementations provide different storage strategies (in-memory, persistent, etc.). Use ConversationFactoryProvider to obtain factories by type.
-
-
Method Summary
Modifier and Type Method Description abstract Conversationcreate(String id)Create a new conversation with the given ID. Conversationload(String id)Load an existing conversation from storage. ConversationcreateForParticipants(String id, User user, User agent, String title)Create a conversation for a 1-1 chat between a user and an agent. abstract ConversationStoreTypegetStoreType()The storage type this factory provides. -
-
Method Detail
-
create
abstract Conversation create(String id)
Create a new conversation with the given ID.
- Parameters:
id- unique identifier for the conversation- Returns:
a new Conversation instance
-
load
Conversation load(String id)
Load an existing conversation from storage.
For persistent implementations, this restores a conversation with its message history from the backing store. For in-memory implementations, this returns null (nothing to restore).
- Parameters:
id- the conversation ID to load- Returns:
the conversation if found, null otherwise
-
createForParticipants
Conversation createForParticipants(String id, User user, User agent, String title)
Create a conversation for a 1-1 chat between a user and an agent.
Messages can be automatically attributed based on role when participants are set.
- Parameters:
id- the conversation/session IDuser- the human user participantagent- the AI/system user participant (optional)title- the session title (optional)- Returns:
a new Conversation instance
-
getStoreType
abstract ConversationStoreType getStoreType()
The storage type this factory provides.
-
-
-
-