List Retriever

Retrievers for SummaryIndex.

llama_index.indices.list.retrievers.ListIndexEmbeddingRetriever

alias of SummaryIndexEmbeddingRetriever

llama_index.indices.list.retrievers.ListIndexLLMRetriever

alias of SummaryIndexLLMRetriever

llama_index.indices.list.retrievers.ListIndexRetriever

alias of SummaryIndexRetriever

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

Embedding based retriever for SummaryIndex.

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

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

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

get_service_context() Optional[ServiceContext]

Attempts to resolve a service context. Short-circuits at self.service_context, self._service_context, or self._index.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.SummaryIndexLLMRetriever(index: SummaryIndex, choice_select_prompt: Optional[PromptTemplate] = 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 SummaryIndex.

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

  • choice_select_prompt (Optional[PromptTemplate]) – 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.

get_service_context() Optional[ServiceContext]

Attempts to resolve a service context. Short-circuits at self.service_context, self._service_context, or self._index.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.SummaryIndexRetriever(index: SummaryIndex, **kwargs: Any)

Simple retriever for SummaryIndex that returns all nodes.

Parameters

index (SummaryIndex) – The index to retrieve from.

get_service_context() Optional[ServiceContext]

Attempts to resolve a service context. Short-circuits at self.service_context, self._service_context, or self._index.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.