Skip to content

AssistantAgent handoffs The content of attribute assignment is not allowed to be a list of Chinese string characters. #6967

@y26s4824k264

Description

@y26s4824k264

What happened?

ERROR: Exception in ASGI application

  • Exception Group Traceback (most recent call last):
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/_utils.py", line 76, in collapse_excgroups
    | yield
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 174, in call
    | async with anyio.create_task_group() as task_group:
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 772, in aexit
    | raise BaseExceptionGroup(
    | exceptiongroup.ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 409, in run_asgi
    | result = await app( # type: ignore[func-returns-value]
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
    | return await self.app(scope, receive, send)
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in call
    | await super().call(scope, receive, send)
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/applications.py", line 112, in call
    | await self.middleware_stack(scope, receive, send)
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 187, in call
    | raise exc
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 165, in call
    | await self.app(scope, receive, _send)
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 173, in call
    | with recv_stream, send_stream, collapse_excgroups():
    | File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 153, in exit
    | self.gen.throw(typ, value, traceback)
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/_utils.py", line 82, in collapse_excgroups
    | raise exc
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 175, in call
    | response = await self.dispatch_func(request, call_next)
    | File "/Users/puzzle/PycharmProjects/ai-manage/core/app/system_layer/service/jwt.py", line 62, in dispatch
    | return await self.jwt_middleware(request, call_next)
    | File "/Users/puzzle/PycharmProjects/ai-manage/core/app/system_layer/service/jwt.py", line 88, in jwt_middleware
    | return await call_next(request)
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 153, in call_next
    | raise app_exc
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 140, in coro
    | await self.app(scope, receive_or_disconnect, send_no_error)
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 173, in call
    | with recv_stream, send_stream, collapse_excgroups():
    | File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 153, in exit
    | self.gen.throw(typ, value, traceback)
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/_utils.py", line 82, in collapse_excgroups
    | raise exc
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/sse_starlette/sse.py", line 240, in cancel_on_finish
    | await coro()
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/sse_starlette/sse.py", line 159, in _stream_response
    | async for data in self.body_iterator:
    | File "/Users/puzzle/PycharmProjects/ai-manage/ai_addons/llm_core/route/llm_chat.py", line 56, in process_stream
    | async for message in team.run_stream(task=info.question):
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/autogen_agentchat/teams/_group_chat/base_group_chat.py", line 554, in run_stream
    | raise RuntimeError(str(message.error))
    | RuntimeError: ValueError: Invalid name: transfer_to_规划. Only letters, numbers, '
    ' and '-' are allowed.
    | Traceback:
    | Traceback (most recent call last):
    |
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/autogen_agentchat/teams/_group_chat/_chat_agent_container.py", line 133, in handle_request
    | async for msg in self._agent.on_messages_stream(self._message_buffer, ctx.cancellation_token):
    |
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/autogen_agentchat/agents/_assistant_agent.py", line 953, in on_messages_stream
    | async for inference_output in self._call_llm(
    |
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/autogen_agentchat/agents/_assistant_agent.py", line 1091, in _call_llm
    | async for chunk in model_client.create_stream(
    |
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/autogen_ext/models/openai/_openai_client.py", line 837, in create_stream
    | create_params = self._process_create_args(
    |
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/autogen_ext/models/openai/_openai_client.py", line 618, in _process_create_args
    | converted_tools = convert_tools(tools)
    |
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/autogen_ext/models/openai/openai_client.py", line 270, in convert_tools
    | assert_valid_name(tool_param["function"]["name"])
    |
    | File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/autogen_ext/models/openai/utils.py", line 11, in assert_valid_name
    | raise ValueError(f"Invalid name: {name}. Only letters, numbers, '
    ' and '-' are allowed.")
    |
    | ValueError: Invalid name: transfer_to_规划. Only letters, numbers, '
    ' and '-' are allowed.
    |
    +------------------------------------

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 409, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 60, in call
return await self.app(scope, receive, send)
File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in call
await super().call(scope, receive, send)
File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/applications.py", line 112, in call
await self.middleware_stack(scope, receive, send)
File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 187, in call
raise exc
File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/middleware/errors.py", line 165, in call
await self.app(scope, receive, _send)
File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 173, in call
with recv_stream, send_stream, collapse_excgroups():
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 153, in exit
self.gen.throw(typ, value, traceback)
File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/_utils.py", line 82, in collapse_excgroups
raise exc
File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 175, in call
response = await self.dispatch_func(request, call_next)
File "/Users/puzzle/PycharmProjects/ai-manage/core/app/system_layer/service/jwt.py", line 62, in dispatch
return await self.jwt_middleware(request, call_next)
File "/Users/puzzle/PycharmProjects/ai-manage/core/app/system_layer/service/jwt.py", line 88, in jwt_middleware
return await call_next(request)
File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 153, in call_next
raise app_exc
File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 140, in coro
await self.app(scope, receive_or_disconnect, send_no_error)
File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/middleware/base.py", line 173, in call
with recv_stream, send_stream, collapse_excgroups():
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 153, in exit
self.gen.throw(typ, value, traceback)
File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/starlette/_utils.py", line 82, in collapse_excgroups
raise exc
File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/sse_starlette/sse.py", line 240, in cancel_on_finish
await coro()
File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/sse_starlette/sse.py", line 159, in _stream_response
async for data in self.body_iterator:
File "/Users/puzzle/PycharmProjects/ai-manage/ai_addons/llm_core/route/llm_chat.py", line 56, in process_stream
async for message in team.run_stream(task=info.question):
File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/autogen_agentchat/teams/_group_chat/base_group_chat.py", line 554, in run_stream
raise RuntimeError(str(message.error))
RuntimeError: ValueError: Invalid name: transfer_to_规划. Only letters, numbers, '
' and '-' are allowed.
Traceback:
Traceback (most recent call last):

File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/autogen_agentchat/teams/_group_chat/_chat_agent_container.py", line 133, in handle_request
async for msg in self._agent.on_messages_stream(self._message_buffer, ctx.cancellation_token):

File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/autogen_agentchat/agents/_assistant_agent.py", line 953, in on_messages_stream
async for inference_output in self._call_llm(

File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/autogen_agentchat/agents/_assistant_agent.py", line 1091, in _call_llm
async for chunk in model_client.create_stream(

File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/autogen_ext/models/openai/_openai_client.py", line 837, in create_stream
create_params = self._process_create_args(

File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/autogen_ext/models/openai/_openai_client.py", line 618, in _process_create_args
converted_tools = convert_tools(tools)

File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/autogen_ext/models/openai/_openai_client.py", line 270, in convert_tools
assert_valid_name(tool_param["function"]["name"])

File "/Users/puzzle/PycharmProjects/ai-manage/.venv/lib/python3.10/site-packages/autogen_ext/models/openai/utils.py", line 11, in assert_valid_name
raise ValueError(f"Invalid name: {name}. Only letters, numbers, '
' and '-' are allowed.")

ValueError: Invalid name: transfer_to_规划. Only letters, numbers, '_' and '-' are allowed.

AssistantAgent(
"规划",
model_client=model_client,
handoffs=agents_name,
model_client_stream=True,
system_message="""你是一个AI集群的主规划师与调度官 (Master Planner and Orchestrator),只负责调度不输出任何对话。你的核心使命是:
理解用户的复杂需求。
制定一个分步的、逻辑清晰的执行计划。
调度团队中的专家智能体(通过调用工具)去执行计划中的每一步。
监控执行过程,并在所有步骤完成后进行最终审核。
审核通过后,必须严格按照格式,在最后另起一行输出'TERMINATE'。""",

    )

handoffs The content of attribute assignment is not allowed to be a list of Chinese string characters.

Which packages was the bug in?

Python Extensions (autogen-ext)

AutoGen library version.

Python 0.7.4

Other library version.

No response

Model used

No response

Model provider

None

Other model provider

No response

Python version

3.10

.NET version

None

Operating system

MacOS

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions