Interface ContextManager
- All Known Implementing Classes:
SimpleContextManager
public interface ContextManager
Manages conversation context and state for AI agents.
Handles session data, conversation history, and contextual information.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddToHistory(String sessionId, com.google.gson.JsonObject message) Add a message to the conversation history.voidclearContext(String sessionId) Clear context data for a session.getContext(String sessionId, String key) Retrieve context data for a session.com.google.gson.JsonObjectgetHistory(String sessionId) Get the conversation history for a session.com.google.gson.JsonObjectgetSessionContext(String sessionId) Get all context data for a session as a JSON object.voidsetContext(String sessionId, String key, Object value) Store context data for a session.
-
Method Details
-
setContext
Store context data for a session.- Parameters:
sessionId- The session identifierkey- The context keyvalue- The context value
-
getContext
Retrieve context data for a session.- Parameters:
sessionId- The session identifierkey- The context key- Returns:
- The context value, or null if not found
-
getSessionContext
Get all context data for a session as a JSON object.- Parameters:
sessionId- The session identifier- Returns:
- All context data for the session
-
clearContext
Clear context data for a session.- Parameters:
sessionId- The session identifier
-
addToHistory
Add a message to the conversation history.- Parameters:
sessionId- The session identifiermessage- The message to add to history
-
getHistory
Get the conversation history for a session.- Parameters:
sessionId- The session identifier- Returns:
- The conversation history
-