aiq.builder.context#
Classes#
Module Contents#
- class AIQContextState#
- input_message: contextvars.ContextVar[Any]#
- user_manager: contextvars.ContextVar[Any]#
- event_stream: contextvars.ContextVar[aiq.utils.reactive.subject.Subject[aiq.data_models.intermediate_step.IntermediateStep] | None]#
- active_function: contextvars.ContextVar[aiq.data_models.invocation_node.InvocationNode]#
- user_input_callback: contextvars.ContextVar[collections.abc.Callable[[aiq.data_models.interactive.InteractionPrompt], collections.abc.Awaitable[aiq.data_models.interactive.HumanResponse | None]] | None]#
- static get() AIQContextState #
- class AIQContext(context: AIQContextState)#
- _context_state#
- property input_message#
Retrieves the input message from the context state.
The input_message property is used to access the message stored in the context state. This property returns the message as it is currently maintained in the context.
- Returns:
str: The input message retrieved from the context state.
- property user_manager#
Retrieves the user manager instance from the current context state.
This property provides access to the user manager through the context state, allowing interaction with user management functionalities.
- Returns:
- UserManager: The instance of the user manager retrieved from the
context state.
- property user_interaction_manager: aiq.builder.user_interaction_manager.AIQUserInteractionManager#
Return an instance of AIQUserInteractionManager that uses the current context’s user_input_callback.
- property intermediate_step_manager: aiq.builder.intermediate_step_manager.IntermediateStepManager#
Retrieves the intermediate step manager instance from the current context state.
This property provides access to the intermediate step manager through the context state, allowing interaction with intermediate step management functionalities.
- Returns:
- IntermediateStepManager: The instance of the intermediate step manager retrieved
from the context state.
- push_active_function(function_name: str, input_data: Any | None)#
Set the ‘active_function’ in context, push an invocation node, AND create an OTel child span for that function call.
- property active_function: aiq.data_models.invocation_node.InvocationNode#
Retrieves the active function from the context state.
This property is used to access the active function stored in the context state. The active function is the function that is currently being executed.
- static get() AIQContext #
Static method to retrieve the current AIQContext instance.
This method creates and returns an instance of the AIQContext class by obtaining the current state from the AIQContextState.
- Returns:
AIQContext: The created AIQContext instance.