Retrievers#

Index Retrievers#

Below we show index-specific retriever classes.

NOTE: our structured indices (e.g. PandasIndex) don’t have any retrievers, since they are not designed to be used with the retriever API. Please see the Query Engine page for more details.

Additional Retrievers#

Here we show additional retriever classes; these classes can augment existing retrievers with new capabilities (e.g. query transforms).

Additional Retrievers

Base Retriever#

Here we show the base retriever class, which contains the retrieve method which is shared amongst all retrievers.

class llama_index.indices.base_retriever.BaseRetriever(callback_manager: Optional[CallbackManager] = None, object_map: Optional[Dict] = None, objects: Optional[List[IndexNode]] = None, verbose: bool = False)#

Base retriever.

as_query_component(partial: Optional[Dict[str, Any]] = None, **kwargs: Any) QueryComponent#

Get query component.

get_prompts() Dict[str, BasePromptTemplate]#

Get a prompt.

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.

update_prompts(prompts_dict: Dict[str, BasePromptTemplate]) None#

Update prompts.

Other prompts will remain in place.