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

qwen1.5和qwen2调用agent方式不一样吗?? #479

Open
njhouse365 opened this issue Jun 12, 2024 · 5 comments
Open

qwen1.5和qwen2调用agent方式不一样吗?? #479

njhouse365 opened this issue Jun 12, 2024 · 5 comments
Assignees

Comments

@njhouse365
Copy link

Description

qwen1.5和qwen2调用agent方式不一样吗??

Link

1

@zzhangpurdue
Copy link
Collaborator

zzhangpurdue commented Jun 12, 2024

文档中qwen2 调用方式是以vllm开源模型方式支持的,该方式可以兼容qwen1.5。
qwen1.5用的是dashscope的接口方式支持的。需要依赖dashscope的sdk。

@njhouse365
Copy link
Author

role_template = '你是一个agent小助手,你需要根据用户的要求来回答他们的问题'
function_list = ['similar_text', 'mortgage_calculator', 'house_rent', 'house_price', 'property_purchase_discounts',
'property_assessment', 'estate_ranking', 'property_inquiry']

bot = RolePlay(function_list=function_list, llm=llm_config, instruction=role_template)
bot.run(query, history=history)

model为qwen2-7b-instruct,第一轮正常,但是第二轮就报错了
INFO: 192.168.204.99:46180 - "POST /query_agent HTTP/1.1" 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/uvicorn/protocols/http/httptools_impl.py", line 399, in run_asgi
result = await app( # type: ignore[func-returns-value]
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in call
return await self.app(scope, receive, send)
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/fastapi/applications.py", line 1054, in call
await super().call(scope, receive, send)
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/starlette/applications.py", line 123, in call
await self.middleware_stack(scope, receive, send)
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/starlette/middleware/errors.py", line 186, in call
raise exc
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/starlette/middleware/errors.py", line 164, in call
await self.app(scope, receive, _send)
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/starlette/middleware/exceptions.py", line 65, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/starlette/routing.py", line 756, in call
await self.middleware_stack(scope, receive, send)
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/starlette/routing.py", line 776, in app
await route.handle(scope, receive, send)
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/starlette/routing.py", line 297, in handle
await self.app(scope, receive, send)
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/starlette/routing.py", line 77, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/starlette/_exception_handler.py", line 64, in wrapped_app
raise exc
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/starlette/_exception_handler.py", line 53, in wrapped_app
await app(scope, receive, sender)
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/starlette/routing.py", line 72, in app
response = await func(request)
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/fastapi/routing.py", line 278, in app
raw_response = await run_endpoint_function(
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/fastapi/routing.py", line 193, in run_endpoint_function
return await run_in_threadpool(dependant.call, **values)
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/starlette/concurrency.py", line 42, in run_in_threadpool
return await anyio.to_thread.run_sync(func, *args)
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/anyio/to_thread.py", line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
return await future
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/anyio/_backends/_asyncio.py", line 859, in run
result = context.run(func, *args)
File "/home/house365ai/xxm/modelscope-agent2/examples/agent_server2.py", line 46, in query_agent
for chunk in response:
File "/home/house365ai/xxm/modelscope-agent2/modelscope_agent/agents/role_play.py", line 289, in _run
for s in output:
File "/home/house365ai/xxm/modelscope-agent2/modelscope_agent/llm/openai.py", line 42, in _chat_stream
response = self.client.chat.completions.create(
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/openai/_utils/_utils.py", line 277, in wrapper
return func(*args, **kwargs)
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/openai/resources/chat/completions.py", line 606, in create
return self._post(
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/openai/_base_client.py", line 1240, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/openai/_base_client.py", line 921, in request
return self._request(
File "/home/house365ai/anaconda3/envs/agent2/lib/python3.10/site-packages/openai/_base_client.py", line 1020, in _request
raise self._make_status_error_from_response(err.response) from None

@zzhangpurdue zzhangpurdue self-assigned this Jun 12, 2024
@zzhangpurdue
Copy link
Collaborator

llm_config 是怎么写的发我一下

@njhouse365
Copy link
Author

llm_config = {
'model': 'qwen',
'model_server': 'openai',
'api_base': 'http://192.168.204.120:8084/v1',
'api_key': 'EMPTY',
}

@njhouse365
Copy link
Author

@zzhangpurdue 麻烦看一下,谢谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants