microsoft / autogen

A programming framework for agentic AI. Discord: https://aka.ms/autogen-dc. Roadmap: https://aka.ms/autogen-roadmap
https://microsoft.github.io/autogen/
Creative Commons Attribution 4.0 International
29.89k stars 4.35k forks source link

[Bug]: Autobuilded agents with spaces in their names #941

Closed piopy closed 8 months ago

piopy commented 8 months ago

Describe the bug

AgentBuilder creates agents that contains spaces in their names.

When initializing the conversation, I receive the following error: BadRequestError: Error code: 400 - {'error': {'message': "' Content_Generator' does not match '^[a-zA-Z0-9_-]{1,64}$' - 'messages.3.name'", 'type': 'invalid_request_error', 'param': None, 'code': None}}

Steps to reproduce

Step 1: install dependencies Step 2: write API key and model (gpt-3.5-turbo) in a json for the autobuilder. Set also the llm_config dictionary for the conversation. (same gpt used) Step 3: Set AutoBuilder and write the building task Step 4: Create agent_list, agent_configs using builder.build(building_task, llm_config) Step 5: Create a GroupChat and a manager (same llm_config) Step 6: Initiate conversation with agent_list[0] to the manager defining a problem. Error will come if AutoBuilder generated wrong formatted names.

Expected Behavior

Autobuilt agents conversating each other

Screenshots and logs

image

Additional Information

openai == 1.3.8 pyautogen == 0.2.2 (pip install git+https to this repo)

I used a workaround in the AutoBuilder's prompt, adding "Generate agents without spaces in their names." command

LinxinS97 commented 8 months ago

The instruction following ability for gpt-3.5-turbo is very weak. The generated name cannot be guaranteed to follow an expected format when using gpt-3.5 series model. To ensure the quality of agents, I highly recommend using gpt-4 (or gpt-4-1106-preview) instead as the build_manager. For this issue, I will add a trigger to replace the space as underline later.