KeyError: 'chart_generator' when i run multi-agent-collaboration.ipynb with gpt-3.5-turbo-1106 #459
Unanswered
chuangzhidan
asked this question in
Q&A
Replies: 1 comment 1 reply
-
If your model is hallucinating tools, then either update your prompt to reduce the frequency of such hallucinations, or add a fallback to handle errors like this an have it automatically handle afterwards. The fallback would basically be to append a tool message with the invocation's ID saying that you as the bot don't have access. An example of this is in the customer support bot tutorial: https://langchain-ai.github.io/langgraph/tutorials/customer-support/customer-support/#utilities |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Checked other resources
Example Code
llm = ChatOpenAI(model="gpt-3.5-turbo-1106")
i used aboved instead of gpt4 like the one showed in the example script ,everything else is the same.
Error Message and Stack Trace (if applicable)
{'Researcher': {'messages': [AIMessage(content='I have gathered the GDP data for the UK over the past 5 years. Here are the GDP values for each year:\n\n- 2017: $2,622.43 billion\n- 2018: $2,651.38 billion\n- 2019: $2,636.29 billion\n- 2020: $2,663.99 billion\n- 2
021: $3,141.51 billion\n\nI will now proceed to create a line graph to visualize this data.', additional_kwargs={'tool_calls': [{'id': 'call_xXe0sgFx0bVlUYOKUhh8p02Q', 'function': {'arguments': '{\n "data": {\n "x": ["2017", "2018", "2019", "2020", "2021"],\n
"y": [2622.43, 2651.38, 2636.29, 2663.99, 3141.51]\n },\n "type": "line",\n "title": "UK GDP Over the Past 5 Years",\n "xLabel": "Year",\n "yLabel": "GDP (in billion USD)"\n}', 'name': 'chart_generator'}, 'type': 'function'}]}, response_metadata={'token_us
age': {'completion_tokens': 220, 'prompt_tokens': 12216, 'total_tokens': 12436}, 'model_name': 'gpt-3.5-turbo-1106', 'system_fingerprint': None, 'finish_reason': 'tool_calls', 'logprobs': None}, name='Researcher', id='run-cb9ac178-2b55-4aa4-9a14-c9adeb6582ba-0', t
ool_calls=[{'name': 'chart_generator', 'args': {'data': {'x': ['2017', '2018', '2019', '2020', '2021'], 'y': [2622.43, 2651.38, 2636.29, 2663.99, 3141.51]}, 'type': 'line', 'title': 'UK GDP Over the Past 5 Years', 'xLabel': 'Year', 'yLabel': 'GDP (in billion USD)'
output = self.tools_by_name[call["name"]].invoke(call["args"], config)
KeyError: 'chart_generator'
KeyError: 'chart_generator'
Description
it always failed the halfway,whichi is really annoying
System Info
langchainhub 0.1.15
langchain 0.1.17
langchain-text-splitters 0.0.1
langchain-openai 0.1.1
langchain-experimental 0.0.58
langchain-core 0.1.52
langchain-community 0.0.37
Beta Was this translation helpful? Give feedback.
All reactions