langflow
langflow copied to clipboard
Unable to use AstraDB VectorStore in a RetreivalQAChain
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.
Browser and Version
- Browser: Chrome
- Version: 123
To Reproduce Steps to reproduce the behavior:
- Import the attached flow or you can try to use RetreivalQA chain with AstraDB Vector store (add credentials as necessary)
- Click on 'Run'
- See error
Screenshots
If applicable, add screenshots to help explain your problem.
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})