Actor#

Actor is a component of Pipeline, that processes the Script.

It is responsible for determining the next node and getting response from it.

The actor acts as a bridge between the user’s input and the dialog graph, making sure that the conversation follows the expected flow.

More details on the processing can be found in the documentation for Actor.run_component().

class Actor(**data)[source]#

Bases: PipelineComponent

The class which is used to process Context according to the Script.

property computed_name: str#

Default name that is used if name is not defined. In case two components in a ServiceGroup have the same computed_name an incrementing number is appended to the name.

async run_component(ctx, pipeline)[source]#

Process the context in the following way: :rtype: None

  1. Run pre-transition of the Context.current_node.

  2. Determine and save the next node based on transitions of the Context.current_node.

  3. Run pre-response of the Context.current_node.

  4. Determine and save the response of the Context.current_node

async static _run_processing_parallel(processing, ctx)[source]#

Execute BaseProcessing functions simultaneously, independent of the order.

Picked depending on the value of the Pipeline’s parallelize_processing flag.

Return type:

None

async static _run_processing_sequential(processing, ctx)[source]#

Execute BaseProcessing functions in-order.

Picked depending on the value of the Pipeline’s parallelize_processing flag.

Return type:

None

async static _run_processing(processing, ctx)[source]#

Run BaseProcessing functions.

The execution order depends on the value of the Pipeline’s parallelize_processing flag.

Return type:

None

before_handler: BeforeHandler#

BeforeHandler, associated with this component.

after_handler: AfterHandler#

AfterHandler, associated with this component.

timeout: Optional[float]#

(for asynchronous only!) Maximum component execution time (in seconds), if it exceeds this time, it is interrupted.

requested_async_flag: Optional[bool]#

Requested asynchronous property; if not defined, calculated_async_flag is used instead.

calculated_async_flag: bool#

Whether the component can be asynchronous or not.

start_condition: StartConditionCheckerFunction#

StartConditionCheckerFunction that is invoked before each component execution; component is executed only if it returns True.

name: Optional[str]#

Component name (should be unique in a single ServiceGroup), should not be blank or contain the . character.

path: Optional[str]#

Separated by dots path to component, is universally unique.