Skip to main content

agora.common.core

Suitability Objects

class Suitability(str, Enum)

Enumeration of protocol suitability statuses.

Conversation Objects

class Conversation(ABC)

Abstract base class representing a conversation.

__call__

@abstractmethod
def __call__(message: str, print_output: bool = True) -> Any

Processes a message within the conversation.

Arguments:

  • message str - The message to process.
  • print_output bool - Whether to print the response.

Returns:

  • Any - The response generated by processing the message.

close

def close() -> None

Closes the conversation.

Returns:

None

__enter__

def __enter__() -> "Conversation"

Enters the conversation context.

Returns:

  • Conversation - The current conversation instance.

__exit__

def __exit__(exc_type: Optional[type], exc_value: Optional[BaseException],
traceback: Optional[TracebackType]) -> None

Exits the conversation context, ensuring closure.

Arguments:

  • exc_type Optional[type] - The exception type if an error occurred.
  • exc_value Optional[BaseException] - The exception instance if raised.
  • traceback Optional[TracebackType] - The traceback object.

Returns:

None

Protocol Objects

class Protocol()

Represents a protocol document with associated sources and metadata.

__init__

def __init__(protocol_document: str, sources: List[str],
metadata: Optional[Dict[str, str]]) -> None

Initializes a Protocol.

Arguments:

  • protocol_document str - The document detailing the protocol.
  • sources List[str] - Sources where the protocol is referenced.
  • metadata Optional[Dict[str, str]] - Additional metadata for the protocol.

hash

@property
def hash() -> str

Computes and returns the hash of the protocol document.

Returns:

  • str - The computed hash value.

__str__

def __str__() -> str

Returns a string representation of the Protocol.

Returns:

  • str - The string representation including hash, sources, metadata, and document.