Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[<Agent component: framework|tool|llm|etc...>] 执行simple_chat_with_local.py文件报错 openai.BadRequestError: Error code: 400 #574

Open
3 tasks done
bairuifengmaggie opened this issue Aug 13, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@bairuifengmaggie
Copy link

bairuifengmaggie commented Aug 13, 2024

Initial Checks

  • I have searched GitHub for a duplicate issue and I'm sure this is something new
  • I have read and followed the docs & demos and still think this is a bug
  • I am confident that the issue is with modelscope-agent (not my code, or another library in the ecosystem)

What happened + What you expected to happen

openai.BadRequestError: Error code: 400 - {'object': 'error', 'message': '[{'type': 'literal_error', 'loc': ('body', 'messages', 1, 'typed-dict', 'role'), 'msg': "Input should be 'system'", 'input': 'user', 'ctx': {'expected': "'system'"}, 'url': 'https://errors.pydantic.dev/2.6/v/literal_error'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 1, 'typed-dict', 'sent_from'), 'msg': 'Extra inputs are not permitted', 'input': 'role_play1', 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 1, 'typed-dict', 'send_to'), 'msg': 'Extra inputs are not permitted', 'input': ['all'], 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 1, 'typed-dict', 'sent_from'), 'msg': 'Extra inputs are not permitted', 'input': 'role_play1', 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 1, 'typed-dict', 'send_to'), 'msg': 'Extra inputs are not permitted', 'input': ['all'], 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'literal_error', 'loc': ('body', 'messages', 1, 'typed-dict', 'role'), 'msg': "Input should be 'assistant'", 'input': 'user', 'ctx': {'expected': "'assistant'"}, 'url': 'https://errors.pydantic.dev/2.6/v/literal_error'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 1, 'typed-dict', 'sent_from'), 'msg': 'Extra inputs are not permitted', 'input': 'role_play1', 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 1, 'typed-dict', 'send_to'), 'msg': 'Extra inputs are not permitted', 'input': ['all'], 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'literal_error', 'loc': ('body', 'messages', 1, 'typed-dict', 'role'), 'msg': "Input should be 'tool'", 'input': 'user', 'ctx': {'expected': "'tool'"}, 'url': 'https://errors.pydantic.dev/2.6/v/literal_error'}, {'type': 'missing', 'loc': ('body', 'messages', 1, 'typed-dict', 'tool_call_id'), 'msg': 'Field required', 'input': {'role': 'user', 'content': 'user_requirement: who are u', 'sent_from': 'role_play1', 'send_to': ['all']}, 'url': 'https://errors.pydantic.dev/2.6/v/missing'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 1, 'typed-dict', 'sent_from'), 'msg': 'Extra inputs are not permitted', 'input': 'role_play1', 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 1, 'typed-dict', 'send_to'), 'msg': 'Extra inputs are not permitted', 'input': ['all'], 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'missing', 'loc': ('body', 'messages', 1, 'typed-dict', 'name'), 'msg': 'Field required', 'input': {'role': 'user', 'content': 'user_requirement: who are u', 'sent_from': 'role_play1', 'send_to': ['all']}, 'url': 'https://errors.pydantic.dev/2.6/v/missing'}, {'type': 'literal_error', 'loc': ('body', 'messages', 1, 'typed-dict', 'role'), 'msg': "Input should be 'function'", 'input': 'user', 'ctx': {'expected': "'function'"}, 'url': 'https://errors.pydantic.dev/2.6/v/literal_error'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 1, 'typed-dict', 'sent_from'), 'msg': 'Extra inputs are not permitted', 'input': 'role_play1', 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 1, 'typed-dict', 'send_to'), 'msg': 'Extra inputs are not permitted', 'input': ['all'], 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 1, 'typed-dict', 'sent_from'), 'msg': 'Extra inputs are not permitted', 'input': 'role_play1', 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 1, 'typed-dict', 'send_to'), 'msg': 'Extra inputs are not permitted', 'input': ['all'], 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'literal_error', 'loc': ('body', 'messages', 2, 'typed-dict', 'role'), 'msg': "Input should be 'system'", 'input': 'assistant', 'ctx': {'expected': "'system'"}, 'url': 'https://errors.pydantic.dev/2.6/v/literal_error'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 2, 'typed-dict', 'sent_from'), 'msg': 'Extra inputs are not permitted', 'input': 'role_play1', 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 2, 'typed-dict', 'send_to'), 'msg': 'Extra inputs are not permitted', 'input': ['all'], 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'literal_error', 'loc': ('body', 'messages', 2, 'typed-dict', 'role'), 'msg': "Input should be 'user'", 'input': 'assistant', 'ctx': {'expected': "'user'"}, 'url': 'https://errors.pydantic.dev/2.6/v/literal_error'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 2, 'typed-dict', 'sent_from'), 'msg': 'Extra inputs are not permitted', 'input': 'role_play1', 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 2, 'typed-dict', 'send_to'), 'msg': 'Extra inputs are not permitted', 'input': ['all'], 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 2, 'typed-dict', 'sent_from'), 'msg': 'Extra inputs are not permitted', 'input': 'role_play1', 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 2, 'typed-dict', 'send_to'), 'msg': 'Extra inputs are not permitted', 'input': ['all'], 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'literal_error', 'loc': ('body', 'messages', 2, 'typed-dict', 'role'), 'msg': "Input should be 'tool'", 'input': 'assistant', 'ctx': {'expected': "'tool'"}, 'url': 'https://errors.pydantic.dev/2.6/v/literal_error'}, {'type': 'missing', 'loc': ('body', 'messages', 2, 'typed-dict', 'tool_call_id'), 'msg': 'Field required', 'input': {'role': 'assistant', 'content': "I'm an AI assistant designed to provide information and help answer a wide range of questions. My capabilities include accessing vast databases, executing computational tasks, and interacting through various media formats. If you have any specific questions or tasks, feel free to ask!", 'sent_from': 'role_play1', 'send_to': ['all']}, 'url': 'https://errors.pydantic.dev/2.6/v/missing'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 2, 'typed-dict', 'sent_from'), 'msg': 'Extra inputs are not permitted', 'input': 'role_play1', 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 2, 'typed-dict', 'send_to'), 'msg': 'Extra inputs are not permitted', 'input': ['all'], 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'missing', 'loc': ('body', 'messages', 2, 'typed-dict', 'name'), 'msg': 'Field required', 'input': {'role': 'assistant', 'content': "I'm an AI assistant designed to provide information and help answer a wide range of questions. My capabilities include accessing vast databases, executing computational tasks, and interacting through various media formats. If you have any specific questions or tasks, feel free to ask!", 'sent_from': 'role_play1', 'send_to': ['all']}, 'url': 'https://errors.pydantic.dev/2.6/v/missing'}, {'type': 'literal_error', 'loc': ('body', 'messages', 2, 'typed-dict', 'role'), 'msg': "Input should be 'function'", 'input': 'assistant', 'ctx': {'expected': "'function'"}, 'url': 'https://errors.pydantic.dev/2.6/v/literal_error'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 2, 'typed-dict', 'sent_from'), 'msg': 'Extra inputs are not permitted', 'input': 'role_play1', 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 2, 'typed-dict', 'send_to'), 'msg': 'Extra inputs are not permitted', 'input': ['all'], 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 2, 'typed-dict', 'sent_from'), 'msg': 'Extra inputs are not permitted', 'input': 'role_play1', 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}, {'type': 'extra_forbidden', 'loc': ('body', 'messages', 2, 'typed-dict', 'send_to'), 'msg': 'Extra inputs are not permitted', 'input': ['all'], 'url': 'https://errors.pydantic.dev/2.6/v/extra_forbidden'}]', 'type': 'BadRequestError', 'param': None, 'code': 400}

Versions / Dependencies

Modelscope-agent 0.21

Reproduction script

import logging
import os
import time

from modelscope_agent import create_component
from modelscope_agent.agents import RolePlay
from modelscope_agent.task_center import TaskCenter

REMOTE_MODE = False

llm_config = {
"model": "qwen_7B_chat",
"model_server": "openai",
"api_base": "url",
"stream":True
}

function_list = []

task_center = create_component(
TaskCenter, name='task_center', remote=REMOTE_MODE)

logging.warning(msg=f'time:{time.time()} done create task center')

role_play1 = create_component(
RolePlay,
name='role_play1',
remote=REMOTE_MODE,
llm=llm_config,
function_list=function_list)

role_play2 = create_component(
RolePlay,
name='role_play2',
remote=REMOTE_MODE,
llm=llm_config,
function_list=function_list)

task_center.add_agents([role_play1, role_play2])

n_round = 2
task = 'who are u'
task_center.send_task_request(task)
while n_round > 0:

for frame in task_center.step():
    print(frame)

time.sleep(3)

n_round -= 1

Issue Severity

None

@bairuifengmaggie bairuifengmaggie added the bug Something isn't working label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants