agrag.retrieval.retrievers.entity.EntityRetriever
EntityRetriever(*, graph_store:GraphStore, embedder:Embedder, vector_store:VectorStore | None = None, settings:RetrievalSettings | None = None, entity_labels:Sequence[str] | None = None, tracer:Tracer | None = None) -> None
Bases: Retriever
Dense entity search via vector similarity.
Embeds the query, searches via the GraphStore-native or VectorStore path, then loads every hit from the graph. A hit that no longer exists in the graph is dropped.
The native path searches one vector index per entity label, so it
needs the labels ingestion provisioned indexes for: the label
filter when the caller sets one, otherwise entity_labels.
Functions:
- retrieve – Run entity search and return loaded results.
Attributes:
- name –
Parameters:
- graph_store (
GraphStore) – Backs entity search when vector_store is absent. - embedder (
Embedder) – Produces query vectors. - vector_store (
VectorStore | None) – Optional VectorStore for hybrid search. - settings (
RetrievalSettings | None) – Retrieval configuration. Defaults from environment. - entity_labels (
Sequence[str] | None) – The schema entity labels native search runs against. None uses settings.entity_labels. - tracer (
Tracer | None) – Opens spans for the retriever and its children. None opens no recorded span.
name
name = 'entity'
retrieve
retrieve(query:str, *, filters:SearchFilters | None = None, limit:int | None = None) -> list[SearchResult]
Run entity search and return loaded results.
Parameters:
- query (
str) – The natural-language query text. - filters (
SearchFilters | None) – Constraints applied to the search. - limit (
int | None) – Maximum results. None uses settings.entity_top_k. Zero or negative returns no results without searching.
Returns:
list[SearchResult]– Ranked SearchResults with resolved entity ids. The list is empty when the limit is not positive, or when the search ran and found nothing.
Raises:
ValueError– Native search was selected and neither the filter nor the configuration names an entity label, or a stored entity node cannot be parsed.Exception– Any embedding, vector search, or graph read failure propagates, so a failed search is not mistaken for an empty one.