langflow icon indicating copy to clipboard operation
langflow copied to clipboard

Unable to use AstraDB VectorStore in a RetreivalQAChain

Open mukundha opened this issue 10 months ago • 0 comments

Describe the bug When trying to Use RetrievalQA Chain with AstraDB Vector Store, seeing the following error during the build of RetrievalQA chain (attached the export of the flow) Error building vertex Retrieval QA: Asynchronous setup of the DB not finished. NB: AstraDB components sync methods shouldn't be called from the event loop. Consider using their async equivalents.

RetrievalQA with Astra.json

Browser and Version

  • Browser: Chrome
  • Version: 123

To Reproduce Steps to reproduce the behavior:

  1. Import the attached flow or you can try to use RetreivalQA chain with AstraDB Vector store (add credentials as necessary)
  2. Click on 'Run'
  3. See error

Screenshots If applicable, add screenshots to help explain your problem. Screenshot 2024-04-10 at 9 14 44 PM

Additional context

  • I tried to create a custom component with the same code, except modify here to use async / await. It seemed to work, but need to confirm if it doesn't break anything else. Changes are highlighted in bold
    **async def build**(
        self,
        llm: BaseLanguageModel,
       ... <omitted >
    ) -> Text:
        chain_type = chain_type.lower().replace(" ", "_")
        runnable = RetrievalQA.from_chain_type(
            llm=llm,
            chain_type=chain_type,
            retriever=retriever,
            memory=memory,
            input_key=input_key,
            output_key=output_key,
            return_source_documents=return_source_documents,
        )
      ... <omitted>
        result = **runnable.ainvoke**({input_key: input_value})

mukundha avatar Apr 10 '24 13:04 mukundha