Class ChatConversation
java.lang.Object
ecmwf.common.ai.ChatConversation
- All Implemented Interfaces:
Serializable
Represents a chat conversation between a user and the AI assistant. Maintains a limited message history to avoid
unbounded memory growth.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRepresents a single chat message.static enumRole of a message in the conversation. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor with 20 messages max.ChatConversation(int maxHistorySize) Constructor with custom max history size. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAiMessage(String message) Add an AI message.voidaddUserMessage(String message) Add a user message.Returns a copy of the conversation history.Returns the most recent AI message, if any.Returns the most recent user message, if any.
-
Constructor Details
-
ChatConversation
public ChatConversation()Default constructor with 20 messages max. -
ChatConversation
public ChatConversation(int maxHistorySize) Constructor with custom max history size.
-
-
Method Details
-
addUserMessage
Add a user message. -
addAiMessage
Add an AI message. -
getHistory
Returns a copy of the conversation history. -
getLastUserMessage
Returns the most recent user message, if any. -
getLastAiMessage
Returns the most recent AI message, if any.
-