Transform Retriever

class llama_index.retrievers.transform_retriever.TransformRetriever(retriever: BaseRetriever, query_transform: BaseQueryTransform, transform_metadata: Optional[dict] = None)

Transform Retriever.

Takes in an existing retriever and a query transform and runs the query transform before running the retriever.

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.


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