File size: 907 Bytes
603a3fd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from langchain_core.vectorstores import VectorStoreRetriever
from langchain_core.documents import Document
from typing import List, Dict



def multi_index_search(
    vector_Store_retrievers:List[VectorStoreRetriever],
    query:str,
        ) -> List[Dict[VectorStoreRetriever,List[str]]]:
    """
    
    ## Summary
    Search a set of vector stores and returns a list of `Documents` for each vector store 
    in a query
    
    ## Arguements
    vector_Store_retrievers (List[VectorStoreRetriever]): A set of VectorStoreRetriever
    query (str): the query
    
    ## Return 
    List[Dict[VectorStoreRetriever,List[str]]]
    """
    
    multi_indices_search_list = []
    for i in vector_Store_retrievers:
        results = i.invoke(query)
        data = {i : results }
        multi_indices_search_list.append(data)
    

    return multi_indices_search_list

if __name__ == "__main__":
    pass