List Retriever

Retrievers for ListIndex.

class llama_index.indices.list.retrievers.ListIndexEmbeddingRetriever(index: ListIndex, similarity_top_k: Optional[int] = 1, **kwargs: Any)

Embedding based retriever for ListIndex.

Generates embeddings in a lazy fashion for all nodes that are traversed.

Parameters
  • index (ListIndex) – The index to retrieve from.

  • similarity_top_k (Optional[int]) – The number of top nodes to return.

retrieve(str_or_query_bundle: Union[str, QueryBundle]) List[NodeWithScore]

Retrieve nodes given query.

Parameters

str_or_query_bundle (QueryType) – Either a query string or a QueryBundle object.

class llama_index.indices.list.retrievers.ListIndexLLMRetriever(index: ListIndex, choice_select_prompt: Optional[Prompt] = None, choice_batch_size: int = 10, format_node_batch_fn: Optional[Callable] = None, parse_choice_select_answer_fn: Optional[Callable] = None, service_context: Optional[ServiceContext] = None, **kwargs: Any)

LLM retriever for ListIndex.

Parameters
  • index (ListIndex) – The index to retrieve from.

  • choice_select_prompt (Optional[ChoiceSelectPrompt]) – A Choice-Select Prompt (see Prompt Templates).)

  • choice_batch_size (int) – The number of nodes to query at a time.

  • format_node_batch_fn (Optional[Callable]) – A function that formats a batch of nodes.

  • parse_choice_select_answer_fn (Optional[Callable]) – A function that parses the choice select answer.

  • service_context (Optional[ServiceContext]) – A service context.

retrieve(str_or_query_bundle: Union[str, QueryBundle]) List[NodeWithScore]

Retrieve nodes given query.

Parameters

str_or_query_bundle (QueryType) – Either a query string or a QueryBundle object.

class llama_index.indices.list.retrievers.ListIndexRetriever(index: ListIndex, **kwargs: Any)

Simple retriever for ListIndex that returns all nodes.

Parameters

index (ListIndex) – The index to retrieve from.

retrieve(str_or_query_bundle: Union[str, QueryBundle]) List[NodeWithScore]

Retrieve nodes given query.

Parameters

str_or_query_bundle (QueryType) – Either a query string or a QueryBundle object.