Skip to content

shipany.bot.conversation

shipany.bot.conversation package

Subpackages

Submodules

shipany.bot.conversation.context module

shipany.bot.conversation.context.conversation_context(event=None)

Provide the conversation context as a context manager.

  • Parameters: event (Any, default: None) — The event that triggered the conversation.
  • Yields: ConversationContext — The conversation context.
  • Return type: AsyncIterator[ConversationContext]

pydantic model shipany.bot.conversation.context.ConversationContext

Bases: BaseModel

The context of the conversation.

field runtime : RuntimeContext [Required]

The runtime context.

field captures : CapturesModifier [Required]

The captures modifier.

field event : t.Any [Required]

The event that triggered the conversation.

shipany.bot.conversation.errors module

exception shipany.bot.conversation.errors.ConversationRuntimeError

Bases: RuntimeError

Base class for all conversation runtime errors.

exception shipany.bot.conversation.errors.NoStepFoundError

Bases: ConversationRuntimeError

Raised when a step with a given ID is not found.

  • Parameters: step_id (str) — The ID of the step that was not found.

__init__(step_id)

  • Parameters:
    • self (Self)
    • step_id (str)
  • Return type: None

exception shipany.bot.conversation.errors.ActionNotImplementedError

Bases: ConversationRuntimeError

Raised when an action is not implemented.

  • Parameters:
    • action_name (str) — The name of the action that is not implemented.
    • details (str) — Additional details about the action.

__init__(action_name, details)

  • Parameters:
    • self (Self)
    • action_name (str)
    • details (str)
  • Return type: None

exception shipany.bot.conversation.errors.ActivationPreconditionNotMeetError

Bases: ConversationRuntimeError

Raised when the activation precondition does not meet expectations.

  • Parameters:
    • action_name — The name of the action that is not implemented.
    • details — Additional details about the action

__init__()

  • Parameters: self (Self)
  • Return type: None

shipany.bot.conversation.loader module

shipany.bot.conversation.loader.load(json_data)

Load a conversation flow from a JSON string.

  • Parameters: json_data (str | bytes | bytearray) — The JSON string to load.
  • Returns: The loaded conversation flow.
  • Return type: Flow
  • Raises: ValidationError — If the JSON data is invalid.

Module contents