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:
memory
ReceiverMemory - Manages protocol memory.responder
Responder - Handles responses based on protocols.protocol_checker
ReceiverProtocolChecker - Checks protocol validity.negotiator
ReceiverNegotiator - Manages protocol negotiations.programmer
ReceiverProgrammer - Generates protocol implementations.executor
Executor - Executes protocol implementations.tools
List[ToolLike] - A list of available tools.additional_info
str, optional - Extra info used during operation.implementation_threshold
int, 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.storage
Storage, optional - A storage backend or None to create a default.responder
Responder, optional - The responder component.protocol_checker
ReceiverProtocolChecker, optional - The protocol checker.negotiator
ReceiverNegotiator, optional - The negotiator component.programmer
ReceiverProgrammer, optional - The programmer component.executor
Executor, optional - The executor component.tools
List[ToolLike], optional - A list of tools. Defaults to empty list.additional_info
str, optional - Extra info. Defaults to ''.storage_path
str, optional - Path for JSON storage. Defaults to './receiver_storage.json'.storage
0 int, optional - Threshold for code generation.
Returns:
storage
1 - 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_hash
str - Hash identifier for the protocol.protocol_sources
List[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.