运行CrewAI的kickoff方法时遭遇KeyError: 'url'及连接重置错误的求助
运行CrewAI的kickoff方法时遭遇KeyError: 'url'及连接重置错误的求助
我在尝试运行CrewAI时碰到了一堆问题,先是报了KeyError: 'url',之后又出现了连接重置的错误,下面是具体的报错信息和我写的代码,麻烦大家帮忙看看怎么解决。
错误日志
Traceback (most recent call last): File "/Users/Souradipta_Roy/PycharmProjects/crewaitest/crewaitest.py", line 92, in <module> result = crew.kickoff(inputs={'topic': 'Internal experts in mining technology'}) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/crewai/crew.py", line 526, in kickoff self._interpolate_inputs(inputs) File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/crewai/crew.py", line 1018, in _interpolate_inputs task.interpolate_inputs( File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/crewai/task.py", line 311, in interpolate_inputs self.expected_output = self._original_expected_output.format(**inputs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ KeyError: 'url' Exception while exporting Span batch. Traceback (most recent call last): File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/urllib3/connectionpool.py", line 789, in urlopen response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/urllib3/connectionpool.py", line 490, in _make_request raise new_e File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/urllib3/connectionpool.py", line 466, in _make_request self._validate_conn(conn) File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/urllib3/connectionpool.py", line 1095, in _validate_conn conn.connect() File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/urllib3/connection.py", line 730, in connect sock_and_verified = _ssl_wrap_socket_and_match_hostname( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/urllib3/connection.py", line 909, in _ssl_wrap_socket_and_match_hostname ssl_sock = ssl_wrap_socket( ^^^^^^^^^^^^^^^^ File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 469, in ssl_wrap_socket ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 513, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/ssl.py", line 455, in wrap_socket return self.sslsocket_class._create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/ssl.py", line 1041, in _create self.do_handshake() File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/ssl.py", line 1319, in do_handshake self._sslobj.do_handshake() ConnectionResetError: [Errno 54] Connection reset by peer During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/requests/adapters.py", line 667, in send resp = conn.urlopen( ^^^^^^^^^^^^^ File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/urllib3/connectionpool.py", line 843, in urlopen retries = retries.increment( ^^^^^^^^^^^^^^^^^^ File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/urllib3/util/retry.py", line 474, in increment raise reraise(type(error), error, _stacktrace) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/urllib3/util/util.py", line 38, in reraise raise value.with_traceback(tb) File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/urllib3/connectionpool.py", line 789, in urlopen response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/urllib3/connectionpool.py", line 490, in _make_request raise new_e File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/urllib3/connectionpool.py", line 466, in _make_request self._validate_conn(conn) File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/urllib3/connectionpool.py", line 1095, in _validate_conn conn.connect() File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/urllib3/connection.py", line 730, in connect sock_and_verified = _ssl_wrap_socket_and_match_hostname( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/urllib3/connection.py", line 909, in _ssl_wrap_socket_and_match_hostname ssl_sock = ssl_wrap_socket( ^^^^^^^^^^^^^^^^ File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 469, in ssl_wrap_socket ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls, server_hostname) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/site-packages/urllib3/util/ssl_.py", line 513, in _ssl_wrap_socket_impl return ssl_context.wrap_socket(sock, server_hostname=server_hostname) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/ssl.py", line 455, in wrap_socket return self.sslsocket_class._create( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/ssl.py", line 1041, in _create self.do_handshake() File "/Users/Souradipta_Roy/anaconda3/envs/crewai/lib/python3.12/ssl.py", line 1319, in do_handshake self._sslobj.do_handshake() urllib3.exceptions.ProtocolError: ('Connection aborted.', ConnectionResetError(54, 'Connection reset by peer'))
我执行的代码
from typing import List from crewai import Agent, Task, LLM, Crew from crewai.tools import tool llm = LLM( model="gpt-4o", base_url="https://openai.prod.ai-gateway.quantumblack.com/0b0e19f0-3019-4d9e-bc36-1bd53ed23dc2/v1", api_key="5f393389-5fc3-4904-a597-dd56e3b00f42:7ggTi5OqYeCqlLm1PmJ9kkAVk69iWuWI" ) ddagent = Agent(role="Assistant helping in executing due diligence steps", goal="""To help an user performing due diligence to achieve a specified task or multiple tasks. Sometimes multiple tasks need to be performed. The tasks need not be in a sequence""", backstory='You are aware about all the detail tasks of due diligence. You have access to the necessary content and best practices', verbose=True, memory=True, llm=llm ) @tool("get_experts") def get_experts(topic: str) -> List[str]: """Tool returns a list of expert names.""" # Tool logic here expert_list = [] expert_list.append("Souradipta Roy") expert_list.append("Dushyant Agarwal") return expert_list @tool("get_documents") def get_documents(topic: str) -> List[str]: """Tool returns a list of document names.""" # Tool logic here documents_list = [] documents_list.append("document 1") documents_list.append("document 2") return documents_list research_task = Task( description=""" Respond withe appropriate output mentioned in the expected outputs when the user wants to create a survey or wants to know anything about survey creation or survey analysis. """, expected_output=""" Respond with the following: Great, to create surveys and drive analytics, there are currently two resources to utilize: a. Survey Templates – Discover our collection of survey templates. The link for that tool is **https://privatecapital.mckinsey.digital/survey-templates** b. Survey Navigator – Streamline survey creation, analysis, and reporting for client services team. The link for that tool is ** https://surveynavigator.intellisurvey.com/rel-9/admin/#/surveys** """, agent=ddagent, verbose=True ) internal_experts_task = Task( description=""" Respond with an appropriate sentence output listing the firm experts based on the topic mentioned. """, expected_output=""" Respond with an appropriate sentence output listing the firm experts based on the topic mentioned. The firm experts are retrieved from the tool get_experts.""", agent=ddagent, tools=[get_experts], verbose=True ) week_0_ramp_up_task = Task( description=""" You are responsible for helping the user with Week 0 ramp up. There will be 6 sub-steps in this. If user chooses any of below sub-steps except document recommendations then provide... """, agent=ddagent, verbose=True ) # 后续还有创建Crew并调用kickoff的代码,错误日志显示是这里触发的问题
备注:内容来源于stack exchange,提问作者Souradipta Roy
相关产品推荐
相关产品推荐

