retrieve_graph

Function

Retrieves and returns related document chunks.

Prototype

def retrieve_graph(question, **kwargs)

Parameters

Parameter

Data Type

Required/Optional

Description

question

String

Required

User question. The value is a string of 1 to 1000 × 1000 characters.

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

List[str]

Retrieved context chunks