microsoft / autogen

A programming framework for agentic AI 🤖
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
30.73k stars 4.48k forks source link

[Bug] [autogenstudio]: duplicate part of prompt when use groupchat #2110

Open nicho2 opened 5 months ago

nicho2 commented 5 months ago

Describe the bug

In case where you use a group chat workflow, the part with skill is duplicate:

i found two times :

While solving the task you may use functions below which will be available in a file called skills.py .\nTo use a function skill.py in code, IMPORT THE FUNCTION FROM skills.py and then use the function.\nIf you need to install python packages, write shell code to\ninstall via pip and use --quiet option.\n\n \n\n##### Begin of get_browse_service_in_the_network ##### ...................n\n#### End of get_browse_service_in_the_network ####

with same skill

it seems that it caused by the load function in class AutoGenWorkFlowManager


    agent_spec = self.sanitize_agent_spec(agent_spec)
    if agent_spec.type == "groupchat":
        agents = [
            self.load(self.sanitize_agent_spec(agent_config))
            for agent_config in agent_spec.groupchat_config.agents
        ]

it's because load function call it self. and sanitize_agent_spec insert the skill prompt

Steps to reproduce

use a goup chat with agent with a skill

Model Used

No response

Expected Behavior

No response

Screenshots and logs

No response

Additional Information

No response

ekzhu commented 5 months ago

@victordibia is it possible that a skill is registered twice?

victordibia commented 5 months ago

@nicho2, Thanks for noting this. There indeed was a bug where sanitize_agent_config was called twice for agents in groupchat leading to the duplicate message. I pushed a fix which should be available in v0.0.56

pip install -U autogenstudio