as_retriever

Function

Returns the retriever.

Prototype

def as_retriever(**kwargs)

Parameters

Parameter

Data Type

Required/Optional

Description

kwargs

Dict

Optional

Extended parameters:

  • use_text (bool): The default value is True, indicating that only the text is used to construct the context during subgraph retrieval.
  • batch_size (integer): batch size when nodes are vectorized. The value range is [1, 1024] and the default value is 4.
  • similarity_tail_threshold: vector similarity threshold. The default value is 0.0. Similarity results below this value will be filtered. The value range is [0.0, 1.0].
  • retrieval_top_k (integer): topk results when similar nodes are retrieved from the node vector database based on entities. The value range is [1, 1000] and the default value is 40.
  • reranker_top_k: topk results required by the reranker. The value range is [1, 1000], and the default value is 20.
  • subgraph_depth (integer): maximum depth of graph retrieval. The value range is [1, 5] and the default value is 2.

Return Value

Data Type

Description

GraphRetriever

This retriever is inherited from langchain_core.retrievers.BaseRetriever.