nemoguardrails.colang.v2_x.runtime.runtime
nemoguardrails.colang.v2_x.runtime.runtime
Module Contents
Classes
Functions
Data
API
Bases: Runtime
Runtime for executing the guardrails.
Helper to return the ActionFinished event from the result of running a local action.
Interact with actions and get response from action-server and system actions.
Helper to return the ActionFinished events for the local async actions that finished.
Args main_flow_uid: The UID of the main flow.
Returns (action_finished_events, pending_counter) The array of *ActionFinished events and the pending counter
Initializes the flow configs based on the config.
Helper to construct an action result for an internal error.
Starts the specified action, waits for it to finish and posts back the result.
Runs the locally registered action.
Args action_name: The name of the action to be executed. start_action_event: The event that triggered the action. events_history: The recent history of events that led to the action being triggered.
Process a sequence of events in a given state.
Runs an “event processing cycle”, i.e., process all input events in the given state, and return the new state and the output events.
The events will be processed one by one, in the input order. If new events are generated as part of the processing, they will be appended to the input events.
By default, a processing cycle only waits for the local actions to finish, i.e, if after processing all the input events, there are local actions in progress, the event processing will wait for them to finish.
In blocking mode, the event processing will also wait for the local async actions.
Parameters:
A sequence of events that needs to be processed.
The state that should be used as the starting point. If not provided, a clean state will be used.
If set, in blocking mode, the processing cycle will wait for all the local async actions as well.
The name of the actions which should finish instantly, i.e., the start event will not be returned to the user and wait for the finish event.
Returns: Tuple[List[Dict[str, Any]], State]
(output_events, output_state) Returns a sequence of output events and an output state.
Convert list of decorators to a dictionary merging the parameters of decorators with same name.
Create a flow config dictionary and resolves flow overriding.