from naptha_sdk.utils import get_logger | |
from naptha_sdk.agent_service import AgentService | |
logger = get_logger(__name__) | |
async def run(inputs, worker_nodes = None, orchestrator_node = None, flow_run = None, cfg: dict = None): | |
from naptha_sdk.agent_service import AgentService | |
chat_initiator = AgentService(name="chat_initiator", fn="chat", worker_node=worker_nodes[0], orchestrator_node=orchestrator_node, flow_run=flow_run) | |
chat_receiver = AgentService(name="chat_receiver", fn="chat", worker_node=worker_nodes[1], orchestrator_node=orchestrator_node, flow_run=flow_run) | |
response = await chat_initiator(prompt=inputs.prompt) | |
for i in range(10): | |
response = await chat_receiver(prompt=response) | |
response = await chat_initiator(prompt=response) | |
return response |