I have multiple collection in PGVector DB
COLLECTION_NAME1 = "mydata1"
COLLECTION_NAME2 = "mydata2"
Now I am using PGVector method to load data from it based on the collection
embeddings = OpenAIEmbeddings()
store1 = PGVector(
collection_name=COLLECTION_NAME1,
connection_string=CONNECTION_STRING,
embedding_function=embeddings,
)
store2 = PGVector(
collection_name=COLLECTION_NAME2,
connection_string=CONNECTION_STRING,
embedding_function=embeddings,
)
retriever1 = store1.as_retriever()
retriever2 = store2.as_retriever()
qa = RetrievalQA.from_chain_type(llm=llm, chain_type="stuff", retriever=retriever1, return_source_documents=True)
res = qa("what is XYZ")
Now if I pass a specific collection name and query from it it will give me the answer based from that collection, such as from above example from collection 1 it gave answer
But now what if i want data from both collection how can I pass retriever1 and retriever2 at a time or can i use any other method to get answer based from either of the collection or any specified collection only