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

[Issue]: Qwen model doesn't match GroupChat #1203

Closed zay95 closed 8 months ago

zay95 commented 8 months ago

Describe the issue

when I use qwen to run the autogen/notebook,I got error :

File "/home/miniconda3/envs/gen/lib/python3.10/site-packages/openai/resources/chat/completions.py", line 643, in create return self._post( File "/home/miniconda3/envs/gen/lib/python3.10/site-packages/openai/_base_client.py", line 1091, in post return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) File "/home/miniconda3/envs/gen/lib/python3.10/site-packages/openai/_base_client.py", line 852, in request return self._request( File "/home/miniconda3/envs/gen/lib/python3.10/site-packages/openai/_base_client.py", line 933, in _request raise self._make_status_error_from_response(err.response) from None openai.BadRequestError: Error code: 400 - {'detail': 'Invalid request: Incorrect role system.'}

I can use it run other scripts like function_call_code_exec ..,is it the role only supports [assistant.user]?

/agentchat_groupchat.ipynb

import autogen

config_list = (
    {
        "model": "Qwen-72B-Chat",
        "base_url": "http://XXXXX:XX/v1",
        "api_key": "NULL",
    },
)

llm_config = {
    "config_list": config_list,
}

user_proxy = autogen.UserProxyAgent(
    name="User_proxy",
    system_message="A human admin.",
    code_execution_config={"last_n_messages": 2, "work_dir": "groupchat"},
    human_input_mode="TERMINATE",
)
coder = autogen.AssistantAgent(
    name="coder",
    llm_config=llm_config,
)
pm = autogen.AssistantAgent(
    name="pm",
    system_message="Creative in software product ideas.",
    llm_config=llm_config,
)
groupchat = autogen.GroupChat(agents=[user_proxy, coder, pm], messages=[], max_round=12)
manager = autogen.GroupChatManager(groupchat=groupchat, llm_config=llm_config)

user_proxy.initiate_chat(
    manager,
    message="Find a latest paper about gpt-4 on arxiv and find its potential applications in software."
)

Steps to reproduce

No response

Screenshots and logs

No response

Additional Information

No response

ekzhu commented 8 months ago

Does Qwen model support "system" role?

zay95 commented 8 months ago

Does Qwen model support "system" role?

oh,sorry, I found it doesn't support only "system" role https://github.com/QwenLM/Qwen/blob/29fea23f874e3e021e67312dba1da307a3fb5fee/openai_api.py#L281 and

image

but it can receive system role messages combined with user-role messages .

image

Fastchat api is ok.