base
Agent Base Plugin
Classes
BaseAIPlugin
Bases: BaseDataModel
Due to the complexity of the OpenAI API implementation within the Eleanor backend, capabilities should be added via this callback interface.
This interface should be agnostic to the underlying AI model as well as how it is called (chat, chat streaming, completion, etc.)
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 respones 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
Triggered before the CananicalChat 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.