`expected string or buffer` error when running retriever within an LCEL chain, even working fine independently

45 Views Asked by At

Working with LangChain, I created the following retriever based on the Parent Document Retriever docs. I basically copy and paste the example, but I'm using just one .txt file instead of two.

retriever_2 = ParentDocumentRetriever(
        vectorstore=vectorstore_2,
        docstore=store_2,
        child_splitter=child_splitter_2,
        parent_splitter=parent_splitter_2,
        search_kwargs={"k": 1}
    )

When I use it as retriever_2.invoke("justice breyer"), it works, but within an LCEL chain like below.

full_chain = RunnableParallel({"user_input": RunnablePassthrough(), "retriever": retriever_2}) | llm

full_result = full_chain.invoke({"user_input": "justice breyer"}, config=cfg)

It fails with the error expected string or buffer. I know that this is a more general Python error, not LangChain, but I don't know what to do after this error.

0

There are 0 best solutions below