Subject: Need Help with JSON Agent Creation (Langchain) Error Using llama-2 LLM. I'm encountering some challenges while attempting to create a JSON agent (langchain.agents) using the llama-2 LLM. I've been working with the langchain JSON agent, aiming to leverage the llama-2 LLM. However, during the creation process, I encountered an unexpected error related to formatting, leading to a fallback to a standard exception. My doubts are: 1. Does langchain json agent able to support any LLM or only with OpenAI LLm(GPT). 2. Why is there formatting exception error. Code:
json_agent_executor = create_json_agent(llm=llm, toolkit=json_toolkit, verbose=True)
Here's the specific error message:
Unexpected exception formatting exception. Falling back to standard exception
Traceback (most recent call last):
File “/opt/conda/lib/python3.10/site-packages/IPython/core/interactiveshell.py”, line 3553, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File “/tmp/ipykernel_34/2881189423.py”, line 4, in
json_agent_executor = create_json_agent(
File “/opt/conda/lib/python3.10/site-packages/langchain/agents/agent_toolkits/json/base.py”, line 42, in create_json_agent
File “/opt/conda/lib/python3.10/site-packages/langchain/agents/agent.py”, line 768, in from_agent_and_tools
:meta private:
File “/opt/conda/lib/python3.10/site-packages/langchain/load/serializable.py”, line 75, in init
File “pydantic/main.py”, line 339, in pydantic.main.BaseModel.init
File “pydantic/main.py”, line 1100, in pydantic.main.validate_model
File “/opt/conda/lib/python3.10/site-packages/langchain/agents/agent.py”, line 779, in validate_tools
" Did not find it, so adding it at the end."
KeyError: ‘tools’
In the official Langchain documentation they tried it with OpenAI LLM (https://python.langchain.com/docs/integrations/toolkits/json), and its working fine for them. But as OpenAI LLM credits are not freely available so could not repeat the same. But i tried it with LLama-2 but it threw an error to me.Hence i have doubt that does langchain json agent able to support any LLM or only with OpenAI LLm(GPT).