Maplemx / Agently

[AI Agent Application Development Framework] - 🚀 Build AI agent native application in very few code 💬 Easy to interact with AI agent in code using structure data and chained-calls syntax 🧩 Enhance AI Agent using plugins instead of rebuild a whole new agent
http://agently.tech
Apache License 2.0
1.06k stars 121 forks source link

请问这个报错如何解决?Error: module 'zhipuai' has no attribute 'ZhipuAI' #166

Open lisdoo opened 2 hours ago

lisdoo commented 2 hours ago

代码如下:

Import and Init Settings

import Agently agent = Agently.create_agent() agent.set_settings("current_model", "ZhipuAI").set_settings("model.ZhipuAI.auth", { "api_key": "" })

Interact with the agent instance like calling a function

result = agent\ .input("Give me 3 words")\ .output([("String", "one word")])\ .start() print(result)

异常如下: PS E:\git\Agently> & C:/Users/Administrator/.virtualenvs/rasa-paddlenlp-ernie-878cdtQU/Scripts/python.exe e:/git/Agently/ii.py [WARNING][2024-09-24 22:10:28.367] redis_rate_limiter.py:21 [t:24624]: no redis installed, RedisRateLimiter unavailable Exception in thread Thread-1: Traceback (most recent call last): File "e:\git\Agently\Agently\Agent\Agent.py", line 210, in start_async event_generator = await self.request.get_event_generator(request_type) File "e:\git\Agently\Agently\Request\Request.py", line 117, in get_event_generator response_generator = await request_plugin_export"request_model" File "e:\git\Agently\Agently\plugins\request\ZhipuAI.py", line 192, in request_model client = zhipuai.ZhipuAI(api_key = zhipuai.api_key) AttributeError: module 'zhipuai' has no attribute 'ZhipuAI'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "e:\git\Agently\Agently\Agent\Agent.py", line 210, in start_async event_generator = await self.request.get_event_generator(request_type) File "e:\git\Agently\Agently\Request\Request.py", line 117, in get_event_generator response_generator = await request_plugin_export"request_model" File "e:\git\Agently\Agently\plugins\request\ZhipuAI.py", line 192, in request_model client = zhipuai.ZhipuAI(api_key = zhipuai.api_key) AttributeError: module 'zhipuai' has no attribute 'ZhipuAI'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "e:\git\Agently\Agently\Agent\Agent.py", line 298, in start_in_theard reply = loop.run_until_complete(self.start_async(request_type)) File "asyncio\base_events.py", line 647, in run_until_complete File "e:\git\Agently\Agently\Agent\Agent.py", line 285, in start_async return await self.start_async(request_type, return_generator=return_generator) File "e:\git\Agently\Agently\Agent\Agent.py", line 285, in start_async return await self.start_async(request_type, return_generator=return_generator) File "e:\git\Agently\Agently\Agent\Agent.py", line 279, in start_async raise(e) File "e:\git\Agently\Agently\Agent\Agent.py", line 210, in start_async event_generator = await self.request.get_event_generator(request_type) File "e:\git\Agently\Agently\Request\Request.py", line 117, in get_event_generator response_generator = await request_plugin_export"request_model" File "e:\git\Agently\Agently\plugins\request\ZhipuAI.py", line 192, in request_model client = zhipuai.ZhipuAI(api_key = zhipuai.api_key) AttributeError: module 'zhipuai' has no attribute 'ZhipuAI'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "threading.py", line 980, in _bootstrap_inner File "threading.py", line 917, in run File "e:\git\Agently\Agently\Agent\Agent.py", line 302, in start_in_theard raise Exception(f"[Agent Request] Error: { str(e) }") Exception: [Agent Request] Error: module 'zhipuai' has no attribute 'ZhipuAI' None PS E:\git\Agently>

lisdoo commented 2 hours ago

我使用的的版本是Tags v3.3.4.8 智谱的版本是: PS E:\git\Agently> pip show zhipuai
Name: zhipuai Version: 1.0.7 Summary: A SDK library for accessing big model apis from ZhipuAI Home-page: https://open.bigmodel.cn/ Author: Zhipu AI Author-email: License: Location: c:\users\administrator.virtualenvs\rasa-paddlenlp-ernie-878cdtqu\lib\site-packages Requires: cachetools, dataclasses, PyJWT, requests Required-by: Agently PS E:\git\Agently>