Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

langchain_core.exceptions.OutputParserException when running the steamilt app #12

Open
Mazzesy opened this issue Apr 16, 2024 · 1 comment

Comments

@Mazzesy
Copy link

Mazzesy commented Apr 16, 2024

When trying out the web_explorer, I get the error below. I have the relevant keys. Did anyone face the same issue?

Traceback (most recent call last):
File "/Users/mn/PycharmProjects/web_explorer/venv/lib/python3.9/site-packages/pydantic/v1/main.py", line 522, in parse_obj
obj = dict(obj)
TypeError: 'int' object is not iterable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/Users/mn/PycharmProjects/web_explorer/venv/lib/python3.9/site-packages/langchain/output_parsers/pydantic.py", line 25, in parse_result
return self.pydantic_object.parse_obj(json_object)
File "/Users/mn/PycharmProjects/web_explorer/venv/lib/python3.9/site-packages/pydantic/v1/main.py", line 525, in parse_obj
raise ValidationError([ErrorWrapper(exc, loc=ROOT_KEY)], cls) from e
pydantic.v1.error_wrappers.ValidationError: 1 validation error for LineList
root
LineList expected dict not int (type=type_error)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/mn/PycharmProjects/web_explorer/test.py", line 126, in
result = qa_chain.invoke({"question": user_input})
File "/Users/mn/PycharmProjects/web_explorer/venv/lib/python3.9/site-packages/langchain/chains/base.py", line 162, in invoke
raise e
File "/Users/mn/PycharmProjects/web_explorer/venv/lib/python3.9/site-packages/langchain/chains/base.py", line 156, in invoke
self._call(inputs, run_manager=run_manager)
File "/Users/mn/PycharmProjects/web_explorer/venv/lib/python3.9/site-packages/langchain/chains/qa_with_sources/base.py", line 152, in _call
docs = self._get_docs(inputs, run_manager=_run_manager)
File "/Users/mn/PycharmProjects/web_explorer/venv/lib/python3.9/site-packages/langchain/chains/qa_with_sources/retrieval.py", line 49, in _get_docs
docs = self.retriever.get_relevant_documents(
File "/Users/mn/PycharmProjects/web_explorer/venv/lib/python3.9/site-packages/langchain_core/retrievers.py", line 321, in get_relevant_documents
raise e
File "/Users/mn/PycharmProjects/web_explorer/venv/lib/python3.9/site-packages/langchain_core/retrievers.py", line 314, in get_relevant_documents
result = self._get_relevant_documents(
File "/Users/mn/PycharmProjects/web_explorer/venv/lib/python3.9/site-packages/langchain/retrievers/web_research.py", line 177, in _get_relevant_documents
result = self.llm_chain({"question": query})
File "/Users/mn/PycharmProjects/web_explorer/venv/lib/python3.9/site-packages/langchain_core/_api/deprecation.py", line 145, in warning_emitting_wrapper
return wrapped(*args, **kwargs)
File "/Users/mn/PycharmProjects/web_explorer/venv/lib/python3.9/site-packages/langchain/chains/base.py", line 363, in call
return self.invoke(
File "/Users/mn/PycharmProjects/web_explorer/venv/lib/python3.9/site-packages/langchain/chains/base.py", line 162, in invoke
raise e
File "/Users/mn/PycharmProjects/web_explorer/venv/lib/python3.9/site-packages/langchain/chains/base.py", line 156, in invoke
self._call(inputs, run_manager=run_manager)
File "/Users/mn/PycharmProjects/web_explorer/venv/lib/python3.9/site-packages/langchain/chains/llm.py", line 104, in _call
return self.create_outputs(response)[0]
File "/Users/mn/PycharmProjects/web_explorer/venv/lib/python3.9/site-packages/langchain/chains/llm.py", line 258, in create_outputs
result = [
File "/Users/mn/PycharmProjects/web_explorer/venv/lib/python3.9/site-packages/langchain/chains/llm.py", line 261, in
self.output_key: self.output_parser.parse_result(generation),
File "/Users/mn/PycharmProjects/web_explorer/venv/lib/python3.9/site-packages/langchain/output_parsers/pydantic.py", line 29, in parse_result
raise OutputParserException(msg, llm_output=json_object)
langchain_core.exceptions.OutputParserException: Failed to parse LineList from completion 1. Got: 1 validation error for LineList
root
LineList expected dict not int (type=type_error)

@bhaswata08
Copy link

post your langsmith trace. looks like LLM could not return json and did something like:
Here is your json:

    json_object

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants