I am trying to create a Langchain agent that can use a tool to create issues. When I am invoking the tool using the llm, I am getting JSONDecodeError. Here the input to the tool should be in JSON format to convert to dictionary and the LLM is only creating the input based on a prompt.

import os

from langchain.agents import create_react_agent,AgentExecutor, create_structured_chat_agent, initialize_agent, AgentType
from langchain_community.agent_toolkits.jira.toolkit import JiraToolkit
from langchain_community.utilities.jira import JiraAPIWrapper
from langchain_google_genai import ChatGoogleGenerativeAI
from langchain_openai import ChatOpenAI
from langchain import hub

llm=ChatOpenAI(temperature=0)
jira=JiraAPIWrapper()
toolkit=JiraToolkit.from_jira_api_wrapper(jira)
tools=toolkit.get_tools()

prompt = hub.pull("hwchase17/react")
agent=create_react_agent(tools=toolkit.get_tools(), llm=llm, prompt=prompt)
agent_executor=AgentExecutor(agent=agent, tools=tools, verbose=True, handle_parsing_errors=True, return_intermediate_steps=True)

response=agent_executor.invoke({"input":"make a new issue in project DEMO to remind me to make Agent with File System"})
print(response)`

When I run the above code, I am getting the following error:

Entering new AgentExecutor chain...

Thought: Do I need to use a tool? Yes
Action: Create Issue
Action Input: {{"project": "DEMO", "summary": "Create Agent with File System", "description": "Create an agent that interacts with the file system to perform specific tasks.", "issuetype": {{"name": "Task"}}, "priority": {{"name": "Medium"}}}}

JSONDecodeError Traceback (most recent call last)

JSONDecodeError: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)

I am expecting the llm to be able to create Issues in Jira based on the prompt but it is throwing the above error.

0

There are 0 best solutions below