Unnecessary need to pass vectordbkwargs multiple times in new retrieval class?
My aim is to chat with a vector index, so I tried to port code to the new retrieval abstraction. In addition, I pass arguments to the pinecone vector store eg to filter by metadata or specify the collection/ namespace needed. However, I only get the chain to work if I specify vectordbkwargs twice, once in the retriever definition and once for the actual model call. Is this intended behaviour?
vectorstore = Pinecone(
index=index,
embedding_function=embed.embed_query,
text_key=text_field,
namespace=None # not setting a namespace, for testing
)
# have to set vectordbkwargs here
vectordbkwargs = {"namespace": 'foobar', "filter": {}, "include_metadata": True}
retriever = vectorstore.as_retriever(search_kwargs=vectordbkwargs)
chat = ConversationalRetrievalChain(
retriever=retriever,
combine_docs_chain=doc_chain,
question_generator=question_generator,
)
chat_history = []
query = 'some query I know is answerable from the vector store'
# oddly, I have to pass vectordbkwargs here too
result = chat({"question": query, "chat_history": chat_history, 'vectordbkwargs': vectordbkwargs})
Leaving out either of the two vectordbkwargs passings to the respective function does not pass the "foobar" vector store namespace for pinecone and results in an empty result. My guess is that this might be a bug due to the newness of the retrieval abstraction? If not, how is one supposed to pass vector store-specific arguments to the chain?
I encountered a similar issue, another way to call this appears to be https://github.com/hwchase17/langchain/issues/2038
Hi, @phiweger! I'm Dosu, and I'm helping the LangChain team manage their backlog. I wanted to let you know that we are marking this issue as stale.
From what I understand, the issue you raised discusses the need to pass vectordbkwargs twice in the new retrieval class. You were unsure if this was intended behavior or a bug and sought clarification on how to pass vector store-specific arguments to the chain. Astro313 encountered a similar issue and shared a potential solution in a comment, which you reacted positively to.
I wanted to check with you if this issue is still relevant to the latest version of the LangChain repository. If it is, please let the LangChain team know by commenting on the issue. Otherwise, feel free to close the issue yourself, or it will be automatically closed in 7 days.
Thank you for your contribution to the LangChain repository!