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.
- Config:
- frozen: bool = True
- arbitrary_types_allowed: bool = True
- extra: str = forbid
- Fields:
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:
- action (
BaseAction) — The action to handle. - ctx (
ConversationContext) — The conversation context.
- action (
- 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.
- context (
__init__(context, next_step)
- Parameters:
- self (Self)
- context (ConversationContext)
- next_step (str)
- Return type: None
traverse_actions(steps)
Traverse the actions and transition between steps.
- Parameters:
- steps (
list[Step]) — The steps of the conversation. - self (Self)
- steps (
- Yields: BaseAction — The next action to execute.
- Return type: Generator[BaseAction | None, str, None]