Find answers from the community

Updated last year

I am getting error sometime

I am getting error sometime
Plain Text
agent = OpenAIAgent.from_tools(
    [multiply_tool, add_tool],
    llm=llm, 
    verbose=True,
    callback_manager=callback_manager
)
response = agent.chat("your_query")

OUTPUT ERROR:

JSONDecodeError                           Traceback (most recent call last)
/tmp/ipykernel_85164/1112129131.py in <module>
----> 1 response = agent.chat("a ate 2 apples, b ate 9 apples and c ate 1 apples. I apple cost is 7.8. how much total cost will be")
      2 print('response = ',response)

~/anaconda3/lib/python3.10/site-packages/llama_index/agent/openai_agent.py in chat(self, message, chat_history, function_call)
    143                 break
    144 
--> 145             function_message, tool_output = call_function(
    146                 tools, function_call_, verbose=self._verbose
    147             )

~/anaconda3/lib/python3.10/site-packages/llama_index/agent/openai_agent.py in call_function(tools, function_call, verbose)
     41         print(f"Calling function: {name} with args: {arguments_str}")
     42     tool = get_function_by_name(tools, name)
---> 43     argument_dict = json.loads(arguments_str)
     44     output = tool(**argument_dict)
     45     if verbose:

. . . 

~/anaconda3/lib/python3.10/json/decoder.py in raw_decode(self, s, idx)
    351         """
    352         try:
--> 353             obj, end = self.scan_once(s, idx)
    354         except StopIteration as err:
    355             raise JSONDecodeError("Expecting value", s, err.value) from None

JSONDecodeError: Expecting ',' delimiter: line 2 column 14 (char 15)

@Logan M
L
A
3 comments
It printed the arugments str, but failed to load it. What did the arugments str look like here?
@Logan M interger values in query that is "a ate 2 apples, b ate 9 apples and c ate 1 apples. I apple cost is 7.8. how much total cost will be"
@Logan M I had replied on previous messages
you can check all messages and you will understand error properly
Add a reply
Sign up and join the conversation on Discord