|
|
@ -33,7 +33,7 @@ class AbstractWorker:
|
|
|
|
def send(
|
|
|
|
def send(
|
|
|
|
self,
|
|
|
|
self,
|
|
|
|
message: Union[Dict, str],
|
|
|
|
message: Union[Dict, str],
|
|
|
|
recipient: "Agent",
|
|
|
|
recipient, #add AbstractWorker
|
|
|
|
request_reply: Optional[bool] = None
|
|
|
|
request_reply: Optional[bool] = None
|
|
|
|
):
|
|
|
|
):
|
|
|
|
"""(Abstract method) Send a message to another worker."""
|
|
|
|
"""(Abstract method) Send a message to another worker."""
|
|
|
@ -41,7 +41,7 @@ class AbstractWorker:
|
|
|
|
async def a_send(
|
|
|
|
async def a_send(
|
|
|
|
self,
|
|
|
|
self,
|
|
|
|
message: Union[Dict, str],
|
|
|
|
message: Union[Dict, str],
|
|
|
|
recipient: "Agent",
|
|
|
|
recipient, #add AbstractWorker
|
|
|
|
request_reply: Optional[bool] = None
|
|
|
|
request_reply: Optional[bool] = None
|
|
|
|
):
|
|
|
|
):
|
|
|
|
"""(Aabstract async method) Send a message to another worker."""
|
|
|
|
"""(Aabstract async method) Send a message to another worker."""
|
|
|
@ -49,7 +49,7 @@ class AbstractWorker:
|
|
|
|
def receive(
|
|
|
|
def receive(
|
|
|
|
self,
|
|
|
|
self,
|
|
|
|
message: Union[Dict, str],
|
|
|
|
message: Union[Dict, str],
|
|
|
|
sender: "Agent",
|
|
|
|
sender, #add AbstractWorker
|
|
|
|
request_reply: Optional[bool] = None
|
|
|
|
request_reply: Optional[bool] = None
|
|
|
|
):
|
|
|
|
):
|
|
|
|
"""(Abstract method) Receive a message from another worker."""
|
|
|
|
"""(Abstract method) Receive a message from another worker."""
|
|
|
@ -57,7 +57,7 @@ class AbstractWorker:
|
|
|
|
async def a_receive(
|
|
|
|
async def a_receive(
|
|
|
|
self,
|
|
|
|
self,
|
|
|
|
message: Union[Dict, str],
|
|
|
|
message: Union[Dict, str],
|
|
|
|
sender: "Agent",
|
|
|
|
sender, #add AbstractWorker
|
|
|
|
request_reply: Optional[bool] = None
|
|
|
|
request_reply: Optional[bool] = None
|
|
|
|
):
|
|
|
|
):
|
|
|
|
"""(Abstract async method) Receive a message from another worker."""
|
|
|
|
"""(Abstract async method) Receive a message from another worker."""
|
|
|
@ -68,7 +68,7 @@ class AbstractWorker:
|
|
|
|
def generate_reply(
|
|
|
|
def generate_reply(
|
|
|
|
self,
|
|
|
|
self,
|
|
|
|
messages: Optional[List[Dict]] = None,
|
|
|
|
messages: Optional[List[Dict]] = None,
|
|
|
|
sender: Optional["Agent"] = None,
|
|
|
|
sender: Optional["AbstractWorker"] = None,
|
|
|
|
**kwargs,
|
|
|
|
**kwargs,
|
|
|
|
) -> Union[str, Dict, None]:
|
|
|
|
) -> Union[str, Dict, None]:
|
|
|
|
"""(Abstract method) Generate a reply based on the received messages.
|
|
|
|
"""(Abstract method) Generate a reply based on the received messages.
|
|
|
@ -83,7 +83,7 @@ class AbstractWorker:
|
|
|
|
async def a_generate_reply(
|
|
|
|
async def a_generate_reply(
|
|
|
|
self,
|
|
|
|
self,
|
|
|
|
messages: Optional[List[Dict]] = None,
|
|
|
|
messages: Optional[List[Dict]] = None,
|
|
|
|
sender: Optional["Agent"] = None,
|
|
|
|
sender: Optional["AbstractWorker"] = None,
|
|
|
|
**kwargs,
|
|
|
|
**kwargs,
|
|
|
|
) -> Union[str, Dict, None]:
|
|
|
|
) -> Union[str, Dict, None]:
|
|
|
|
"""(Abstract async method) Generate a reply based on the received messages.
|
|
|
|
"""(Abstract async method) Generate a reply based on the received messages.
|
|
|
|