You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched the LangChain documentation with the integrated search.
I used the GitHub search to find a similar question and didn't find it.
I am sure that this is a bug in LangChain rather than my code.
The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
Example Code
The mimial reproduce code is:
from langchain import hub
from langchain.agents import AgentExecutor, create_react_agent
from langchain_community.tools.tavily_search import TavilySearchResults
from langchain_openai import OpenAI
tools = []
# Get the prompt to use - you can modify this!
prompt = hub.pull("hwchase17/react")
# Choose the LLM to use
llm = ChatOpenAI(temperature=0, model="gpt-4o")
# Construct the ReAct agent
agent = create_react_agent(llm, tools, prompt)
# Create an agent executor by passing in the agent and tools
agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
agent_executor.invoke({"input": "what is LangChain?"})
Error Message and Stack Trace (if applicable)
ile /home/tl688/.conda/envs/cell2sentence/lib/python3.10/site-packages/langchain/agents/output_parsers/react_single_input.py:75, in ReActSingleInputOutputParser.parse(self, text)
74 if not re.search(r"Action\s*\d*\s*:[\s](.?)", text, re.DOTALL):
---> 75 raise OutputParserException(
76 f"Could not parse LLM output: {text}",
77 observation=MISSING_ACTION_AFTER_THOUGHT_ERROR_MESSAGE,
78 llm_output=text,
79 send_to_llm=True,
80 )
81 elif not re.search(
82 r"[\s]Action\s\d*\sInput\s\d*\s*:[\s](.)", text, re.DOTALL
83 ):
OutputParserException: Could not parse LLM output: LangChain is a framework designed to facilitate the development of applications powered by language models. It provides a suite of tools and components that help developers build applications that can interact with language models in a structured and efficient manner. LangChain is particularly useful for creating applications that require complex language processing tasks, such as chatbots, virtual assistants, and other AI-driven communication tools. It supports integration with various language models and offers features for managing conversations, handling inputs and outputs, and maintaining context across interactions.
For troubleshooting, visit: https://python.langchain.com/docs/troubleshooting/errors/OUTPUT_PARSING_FAILURE
Description
This error only happended in gpt4 and gpt4o model, not in 3.5. Replacing it with OpenAI can work.
System Info
The updated version of langchain.
The text was updated successfully, but these errors were encountered:
dosubotbot
added
the
🤖:bug
Related to a bug, vulnerability, unexpected error with an existing feature
label
Dec 16, 2024
@HelloWorldLTY, which version of langchain are you using. Can you uprade to the latest version. Since I tested the same code and everything seems to be working.
Checked other resources
Example Code
The mimial reproduce code is:
Error Message and Stack Trace (if applicable)
ile /home/tl688/.conda/envs/cell2sentence/lib/python3.10/site-packages/langchain/agents/output_parsers/react_single_input.py:75, in ReActSingleInputOutputParser.parse(self, text)
74 if not re.search(r"Action\s*\d*\s*:[\s](.?)", text, re.DOTALL):
---> 75 raise OutputParserException(
76 f"Could not parse LLM output:
{text}
",77 observation=MISSING_ACTION_AFTER_THOUGHT_ERROR_MESSAGE,
78 llm_output=text,
79 send_to_llm=True,
80 )
81 elif not re.search(
82 r"[\s]Action\s\d*\sInput\s\d*\s*:[\s](.)", text, re.DOTALL
83 ):
OutputParserException: Could not parse LLM output:
LangChain is a framework designed to facilitate the development of applications powered by language models. It provides a suite of tools and components that help developers build applications that can interact with language models in a structured and efficient manner. LangChain is particularly useful for creating applications that require complex language processing tasks, such as chatbots, virtual assistants, and other AI-driven communication tools. It supports integration with various language models and offers features for managing conversations, handling inputs and outputs, and maintaining context across interactions.
For troubleshooting, visit: https://python.langchain.com/docs/troubleshooting/errors/OUTPUT_PARSING_FAILURE
Description
This error only happended in gpt4 and gpt4o model, not in 3.5. Replacing it with OpenAI can work.
System Info
The updated version of langchain.
The text was updated successfully, but these errors were encountered: