mirror of
https://github.com/hwchase17/langchain.git
synced 2025-05-30 11:39:03 +00:00
When using `create_xml_agent` or `create_json_chat_agent` to create a agent, and the function corresponding to the tool is a parameterless function, the `XMLAgentOutputParser` or `JSONAgentOutputParser` will parse the tool input into an empty string, `BaseTool` will parse it into a positional argument. So, the program will crash finally because we invoke a parameterless function but with a positional argument.Specially, below code will raise StopIteration in [_parse_input](https://github.com/langchain-ai/langchain/blob/master/libs/core/langchain_core/tools/base.py#L419) ```python from langchain import hub from langchain.agents import AgentExecutor, create_json_chat_agent, create_xml_agent from langchain_openai import ChatOpenAI prompt = hub.pull("hwchase17/react-chat-json") llm = ChatOpenAI() # agent = create_xml_agent(llm, tools, prompt) agent = create_json_chat_agent(llm, tools, prompt) agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True) agent_executor.invoke(......) ``` --------- Co-authored-by: Erick Friis <erick@langchain.dev> Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com> Co-authored-by: Chester Curme <chester.curme@gmail.com> |
||
---|---|---|
.. | ||
__init__.py | ||
base.py | ||
convert.py | ||
render.py | ||
retriever.py | ||
simple.py | ||
structured.py |