Error in Quickstart #15556
Replies: 1 comment
-
🤖 Hello @dalnekoffd! I'm Dosu, a friendly bot here to assist you with LangChain issues, answer questions, and help you become a contributor. While we wait for a human maintainer, I'll do my best to assist you. Nice to meet you! Based on the traceback you've provided, it seems like the error is originating from the This could be due to the way your retriever is set up. The Here's an example of what a document might look like: {
"text": "This is a sample document.",
"metadata": {
"title": "Sample Document",
"author": "John Doe"
}
} Please ensure that your retriever is set up correctly and that it's returning documents in the expected format. If you're still encountering issues, could you provide more information about how you're setting up your retriever and what kind of data it's working with? This will help me provide more specific guidance. For more information about how retrievers work in LangChain, you can refer to the retrievers.py file in the LangChain repository. SourcesThis response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I am trying to work through the quickstart, using the local LLM option, but stuck on an error at a certain point:
I am working on this section:
However, we want the documents to first come from the retriever we just set up. That way, for a given question we can use the retriever to dynamically select the most relevant documents and pass those in.
............
.............
All the preceding code runs just fine up to this line:
response = retrieval_chain.invoke({"input": "how can this help me?"})
I get this mess (replaced the text of my local file path with xxxxxxxx):
Traceback (most recent call last):
File "", line 1, in
File "xxxxxxxx\base.py", line 3410, in invoke
return self.bound.invoke(
^^^^^^^^^^^^^^^^^^
File "xxxxxxxxxx\base.py", line 1713, in invoke
input = step.invoke(
^^^^^^^^^^^^
File "xxxxxxxxxx\passthrough.py", line 408, in invoke
return self._call_with_config(self._invoke, input, config, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "xxxxxxxxxx\base.py", line 955, in _call_with_config
output = call_func_with_variable_args(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "xxxxxxxxxx\config.py", line 309, in call_func_with_variable_args
return func(input, **kwargs) # type: ignore[call-arg]
^^^^^^^^^^^^^^^^^^^^^
File "xxxxxxxxxx\passthrough.py", line 395, in _invoke
**self.mapper.invoke(
^^^^^^^^^^^^^^^^^^^
File "xxxxxxxxxx\base.py", line 2278, in invoke
output = {key: future.result() for key, future in zip(steps, futures)}
^^^^^^^^^^^^^^^
File "xxxxxxxxx_base.py", line 456, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "xxxxxxxxxx_base.py", line 401, in __get_result
raise self._exception
File "xxxxxxxxxx\thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "xxxxxxxxxx\base.py", line 3410, in invoke
return self.bound.invoke(
^^^^^^^^^^^^^^^^^^
File "xxxxxxxxxx\base.py", line 1713, in invoke
input = step.invoke(
^^^^^^^^^^^^
File "xxxxxxxxxx\retrievers.py", line 117, in invoke
return self.get_relevant_documents(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "xxxxxxxxxx\retrievers.py", line 216, in get_relevant_documents
raise e
File "xxxxxxxxxx\retrievers.py", line 209, in get_relevant_documents
result = self._get_relevant_documents(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "xxxxxxxxxx\vectorstores.py", line 656, in _get_relevant_documents
docs = self.vectorstore.similarity_search(query, **self.search_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "xxxxxxxxxx\base.py", line 127, in similarity_search
results = self.similarity_search_with_score(query, k=k, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "xxxxxxxxxx\base.py", line 106, in similarity_search_with_score
query_doc = self.doc_cls(embedding=query_embedding) # type: ignore
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "xxxxxxxxxx\main.py", line 164, in init
pydantic_self.pydantic_validator.validate_python(data, self_instance=pydantic_self)
pydantic_core._pydantic_core.ValidationError: 2 validation errors for DocArrayDoc
text
Field required [type=missing, input_value={'embedding': [1.16857337...5, -1.6582939624786377]}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.5/v/missing
metadata
Field required [type=missing, input_value={'embedding': [1.16857337...5, -1.6582939624786377]}, input_type=dict]
For further information visit https://errors.pydantic.dev/2.5/v/missing
Appreciate any support!
Beta Was this translation helpful? Give feedback.
All reactions