#Register_reply_func

1 messages · Page 1 of 1 (latest)

tame hound
#

Is there a way to reliably set the agent that sends the message back to user? In my scenario I have an API, and I want to:

  1. Stream intermediate responses
  2. Send back the final response

I can stream the intermediate recipients / senders, but I'm having a hard time understand what determines who the "final assistant" is. Any tips would be appreciated!

#

For more context I have


# REPLY FUNCTION
def handle_messages(recipient, messages, sender, config):
    if "callback" in config and config["callback"] is not None:
        callback = config["callback"]
        asyncio.create_task(callback(recipient, messages[-1], sender, config["queue"]))

    return False, None

# CALLBACK
async def message_parser(recipient, message, sender, queue):
    logger.info(f"RECIPIENT: {recipient.name} : SENDER:{sender.name} : DATA:{message}")
    await queue.put(f"event: TOOL\ndata: {recipient.name}\n\n")
# AGENTS
group_chat = GroupChat(
        agents=[
            user_proxy,
            general_assistant,
            software_assistant,
        ],
        messages=message_history,
    )

    manager = GroupChatManager(groupchat=group_chat, llm_config=llm_config)
    return {
        "user": user_proxy,
        "chat_manager": manager,
        "assistants": [
            general_assistant,
            software_assistant,
        ],
    }
    manager.register_reply(
        [Agent, None],
        reply_func=reply_func,
        config={"callback": message_parser, "queue": queue},
    )
nimble bridge
#

Once the group chat session finishes, you can find all of the messages in the groupchatmanager's chat_messages property. From there perhaps you can add reflection stage to generate a final answer. It is currently not in the library. There is a PR that implements this feature: https://github.com/microsoft/autogen/pull/890

GitHub

Why are these changes needed?
This PR adds a SocietyOfMindAgent. The idea is to have a single point of contact to represent a Group Chat. The Group chat runs as an internal monologue, but externall...

tame hound
#

@nimble bridge , thanks a lot this looks great; how are you tracking the end of the group chat?