agora.receiver.core
Receiver Objects
class Receiver()
Handles receiving and processing protocols, including negotiation and execution.
__init__
def __init__(memory: ReceiverMemory,
responder: Responder,
protocol_checker: ReceiverProtocolChecker,
negotiator: ReceiverNegotiator,
programmer: ReceiverProgrammer,
executor: Executor,
tools: List[ToolLike],
additional_info: str = '',
implementation_threshold: int = 5)
Initializes the Receiver with needed components and configurations.
Arguments:
memoryReceiverMemory - Manages protocol memory.responderResponder - Handles responses based on protocols.protocol_checkerReceiverProtocolChecker - Checks protocol validity.negotiatorReceiverNegotiator - Manages protocol negotiations.programmerReceiverProgrammer - Generates protocol implementations.executorExecutor - Executes protocol implementations.toolsList[ToolLike] - A list of available tools.additional_infostr, optional - Extra info used during operation.implementation_thresholdint, optional - Threshold for auto-generating code.
make_default
@staticmethod
def make_default(toolformer,
storage: Storage = None,
responder: Responder = None,
protocol_checker: ReceiverProtocolChecker = None,
negotiator: ReceiverNegotiator = None,
programmer: ReceiverProgrammer = None,
executor: Executor = None,
tools: List[ToolLike] = None,
additional_info: str = '',
storage_path: str = './.agora/storage/receiver.json',
implementation_threshold: int = 5) -> 'Receiver'
Creates a default Receiver instance with customizable components.
Arguments:
toolformer- The Toolformer instance.storageStorage, optional - A storage backend or None to create a default.responderResponder, optional - The responder component.protocol_checkerReceiverProtocolChecker, optional - The protocol checker.negotiatorReceiverNegotiator, optional - The negotiator component.programmerReceiverProgrammer, optional - The programmer component.executorExecutor, optional - The executor component.toolsList[ToolLike], optional - A list of tools. Defaults to empty list.additional_infostr, optional - Extra info. Defaults to ''.storage_pathstr, optional - Path for JSON storage. Defaults to './receiver_storage.json'.storage0 int, optional - Threshold for code generation.
Returns:
storage1 - A configured Receiver instance.
create_conversation
def create_conversation(protocol_hash: str,
protocol_sources: List[str]) -> Conversation
Creates a new conversation based on the protocol hash and sources.
Arguments:
protocol_hashstr - Hash identifier for the protocol.protocol_sourcesList[str] - A list of protocol source URLs.
Returns:
Conversation- A new conversation or negotiation session.
Raises:
ProtocolRetrievalError- If unable to download the protocol.ProtocolRejectedError- If the protocol is deemed inadequate.