memory
Agent Memory Plugin
Attributes
Classes
MemoryPlugin
Bases: BaseAIPlugin
Agent memory capabilities plugin.
Functions
after_new_context_created
after_new_context_created(
request: ChatCompletionRequest,
sa_session: SASession,
neo4j_session: NJSession,
context: EleanorAIRequestContext,
) -> None
Triggered when a new AI request context is created
Parameters:
-
request
(ChatCompletionRequest
) –The chat completion request.
-
session
(SASession
) –The SQLAlchemy session object.
-
context
(EleanorAIRequestContext
) –The request context.
Returns:
-
None
–None
after_response_generation
after_response_generation(
request: ChatCompletionRequest,
sa_session: SASession,
neo4j_session: NJSession,
context: EleanorAIRequestContext,
response_txt_n: List[str],
) -> None
Executes after all LLM responses have been generated
Parameters:
-
request
(ChatCompletionRequest
) –The chat completion request.
-
session
(SASession
) –The SQLAlchemy session object.
-
context
(EleanorAIRequestContext
) –The AI request context.
-
response_txt_n
(List[str]
) –The list of generated response texts.
Returns:
-
None
–None
before_prompt_rendered
before_prompt_rendered(
request: ChatCompletionRequest,
sa_session: SASession,
neo4j_session: NJSession,
context: EleanorAIRequestContext,
chat: CanonicalChat,
) -> CanonicalChat
Retrieves agent memories and injects them into chat object
Triggered before the CanonicalChat object is rendered into the LLM-specific prompt string.
Parameters:
-
request
(ChatCompletionRequest
) –The completion request object.
-
session
(SASession
) –The SQLAlchemy session object.
-
context
(EleanorAIRequestContext
) –The AI request context.
-
chat
(CanonicalChat
) –The chat object.
Returns:
-
CanonicalChat
(CanonicalChat
) –The updated chat object.
conversation_insights
conversation_insights(
sa_session: SASession,
neo4j_session: NJSession,
namespace_pkid: str,
agent_pkid: str,
conversation: str,
insight_count: int,
existing_memories: str,
context: EleanorAIRequestContext,
) -> List[str]
Retrieves conversation insights for a given agent and conversation.
Parameters:
-
agent_pkid
(str
) –The primary key of the agent.
-
conversation
(str
) –The conversation text.
-
insight_count
(int
) –The number of insights to retrieve.
Returns:
-
List[str]
–List[str]: A list of conversation insights.
Raises:
-
ServiceError
–If no insight responses are returned from the conversation insights chain or if there is an error invoking the conversation insights chain.