Index

Actions for handling index objects

Module: implementation.datasources.index



IndexCreate

Create FAISS index. Subclass of Action. Type of Action[Any, Dict[str, Any]]


__init__

Arguments:

  • dataset_dimensions (int, optional): Dataset dimension. Defaults to 1024.

  • name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.


execute

Arguments:

  • input_data (Any): Ignored.

Returns:

  • Dict[str, Any]: Expected keys:

    • "index" (faiss.IndexFlatL2): Created index.




IndexData

Index data. Subclass of Action. Type of Action[Dict[str, Any], None]


execute

Arguments:

  • input_data (Dict[str, Any]): Expected keys:

    • "index" (faiss.IndexFlatL2): Index to update;

    • "dataset" (Any): Data to index;




IndexSearch

Search index. Subclass of Action. Type of Action[Dict[str, Any], Dict[str, Any]]


__init__

Arguments:

  • results_count (int, optional): How many results to return. Defaults to 1.

  • name (Optional[str], optional): Name for identification. If equals to None, class name will be used. Defaults to None.


execute

Arguments:

  • input_data (Dict[str, Any]): Expected keys:

    • "index" (faiss.IndexFlatL2): Index to search;

    • "query" (Any): Query to search;

Returns:

  • Dict[str, Any]: Expected keys:

    • "search_results" (Dict[str, Any]): Results of search. Results include:

      • "distances" (List[float]): List of distances;

      • "indexes" (List[Any]): Indexes of indexed data;




GetTextsByIndexes

Get texts from resulted indexes. Subclass of Action. Type of Action[Dict[str, Any], Dict[str, Any]]


execute

Arguments:

  • input_data (Dict[str, Any]): Expected keys:

    • "texts" (List[str]): Indexed texts;

    • "search_results" (Dict[str, Any]): Results of search. Results include:

      • "distances" (List[float]): List of distances;

      • "indexes" (List[Any]): Indexes of indexed data;

Returns:

  • Dict[str, Any]: Expected keys:

    • "search_results" (Dict[str, Any]): Results of search. Results include:

      • "distances" (List[float]): List of distances;

      • "indexes" (List[Any]): Indexes of indexed data;

      • "texts" (List[str]): Texts of results;



Last updated