Skip to content

shipany.bot.conversation.handlers

shipany.bot.conversation.handlers package

Submodules

shipany.bot.conversation.handlers.actions module

pydantic model shipany.bot.conversation.handlers.actions.Terminate

Bases: BaseModel

Terminate the conversation.

  • Config:
    • frozen: bool = True
    • extra: str = forbid

pydantic model shipany.bot.conversation.handlers.actions.AwaitObjectAndContinue

Bases: BaseModel

Await an object and continue the conversation.

field value : Awaitable[None] [Required]

The object to await.

pydantic model shipany.bot.conversation.handlers.actions.Continue

Bases: BaseModel

Continue the conversation.

  • Config:
    • frozen: bool = True
    • extra: str = forbid

pydantic model shipany.bot.conversation.handlers.actions.GoToStep

Bases: BaseModel

Go to the specified step.

  • Config:
    • frozen: bool = True
    • extra: str = forbid
  • Fields:

field step_id : str [Required]

The ID of the step to go to.

shipany.bot.conversation.handlers.actions.handle(action, ctx)

Handle the action.

  • Parameters:
  • Returns: The dispatched result. It can be Terminate, Continue, GoToStep, or AwaitObjectAndContinue.
  • Return type: DispatchedResult

shipany.bot.conversation.handlers.activations module

class shipany.bot.conversation.handlers.activations.ActivationHandler

Bases: object

Handles the conversation flow by executing actions and transitioning between steps.

  • Parameters:
    • context (ConversationContext) — The context of the conversation.
    • next_step (str) — The ID of the first step to begin with.

__init__(context, next_step)

traverse_actions(steps)

Traverse the actions and transition between steps.

  • Parameters:
    • steps (list[Step]) — The steps of the conversation.
    • self (Self)
  • Yields: BaseAction — The next action to execute.
  • Return type: Generator[BaseAction | None, str, None]

Module contents