Skip to main content

agora.sender.components.protocol_picker

ProtocolPicker Objects

class ProtocolPicker()

Facilitates checking and selecting protocols for a given task schema.

__init__

def __init__(toolformer: Toolformer) -> None

Initializes the ProtocolPicker.

Arguments:

  • toolformer Toolformer - The Toolformer instance used for protocol checking.

check_protocol_for_task

def check_protocol_for_task(protocol_document: str,
task_schema: TaskSchemaLike) -> bool

Checks if a given protocol is adequate for a task.

Arguments:

  • protocol_document str - The protocol document text.
  • task_schema TaskSchemaLike - The task schema.

Returns:

  • bool - True if the protocol is adequate, otherwise False.

pick_protocol

def pick_protocol(
task_schema: TaskSchemaLike, *protocol_lists:
List[Protocol]) -> Tuple[Optional[Protocol], dict]

Selects the first adequate protocol from provided lists.

Arguments:

  • task_schema TaskSchemaLike - The schema of the task.
  • *protocol_lists List[Protocol] - One or more lists of Protocol objects.

Returns:

(Optional[Protocol], dict): A tuple of the chosen protocol (if any) and a dictionary of hash evaluations.