torch_geometric.llm.utils.KNNRAGFeatureStore
- class KNNRAGFeatureStore[source]
Bases:
LocalFeatureStore
A feature store that uses a KNN-based retrieval.
- retrieve_seed_nodes(query: Union[str, List[str], Tuple[str]]) Tuple[Union[Tensor, None, str, Tuple[str, Optional[Tensor]]], Tensor] [source]
Retrieves the k_nodes most similar nodes to the given query.
- load_subgraph(sample: Union[SamplerOutput, HeteroSamplerOutput], induced: bool = True) Union[Data, HeteroData] [source]
Loads a subgraph from the given sample.
- Parameters:
sample (
Union
[SamplerOutput
,HeteroSamplerOutput
]) – The sample to load the subgraph from.induced (
bool
, default:True
) – Whether to return the induced subgraph. Resets node and edge ids.
- Returns:
Union
[Data
,HeteroData
] – The loaded subgraph.