0

I'm using langchain for QA with court case documents. More specifically, the RetrievalQAWithSourcesChain to retrieve the answer and document source information. However, when running the chain with embedded documents, I get the following error:

`ValueError: too many values to unpack (expected 2) Traceback:

response = qa({"question": pregunta}, return_only_outputs=True)

File "C:\Anaconda3\envs\iagen_3_10\lib\site-packages\langchain\chains\base.py", line 166, in call raise e File "C:\Anaconda3\envs\iagen_3_10\lib\site-packages\langchain\chains\base.py", line 160, in call self._call(inputs, run_manager=run_manager) File "C:\Anaconda3\envs\iagen_3_10\lib\site-packages\langchain\chains\qa_with_sources\base.py", line 132, in _call answer, sources = re.split(r"SOURCES:\s", answer) `

The passed documents are the sections from the court case. I added the following metadata fields:

  • Source: PDF file name.
  • Section: Name of the section
  • Section_chunk: Numeral value used for identification in case the section was divided into chunks.
  • Page: Page where the section chunk starts.

The documents are passed as retriever to the chain with FAISS (FAISS.from_documents(documents, self.embeddings)).

I tried out two approaches (both resulting in the same error):

  • providing the load_qa_chain as chain
  • creating it using the class method .from_chain_type

My question is why does this error ocurrs. And also, if the type of metadata used may cause the errors. Thank you in advance!

0 Answers0