树检索器

Summarize query.

class llama_index.indices.tree.all_leaf_retriever.TreeAllLeafRetriever(index: Any)

GPT all leaf retriever.

This class builds a query-specific tree from leaf nodes to return a response. Using this query mode means that the tree index doesn't need to be built when initialized, since we rebuild the tree for each query.

参数

text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

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.

Leaf query mechanism.

class llama_index.indices.tree.select_leaf_retriever.TreeSelectLeafRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf retriever.

This class traverses the index graph and searches for a leaf node that can best answer the query.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

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.

llama_index.indices.tree.select_leaf_retriever.get_text_from_node(node: Node, level: Optional[int] = None, verbose: bool = False) str

Get text from node.

Query Tree using embedding similarity between query and node text.

class llama_index.indices.tree.select_leaf_embedding_retriever.TreeSelectLeafEmbeddingRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf embedding retriever.

This class traverses the index graph using the embedding similarity between the query and the node text.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

  • refine_template (Optional[RefinePrompt]) -- Refinement Prompt (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

  • embed_model (Optional[BaseEmbedding]) -- Embedding model to use for embedding similarity.

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.

翻译: 树检索器 =======================

Summarize query.

class llama_index.indices.tree.all_leaf_retriever.TreeAllLeafRetriever(index: Any)

GPT all leaf retriever.

This class builds a query-specific tree from leaf nodes to return a response. Using this query mode means that the tree index doesn't need to be built when initialized, since we rebuild the tree for each query.

参数

text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

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.

Leaf query mechanism.

class llama_index.indices.tree.select_leaf_retriever.TreeSelectLeafRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf retriever.

This class traverses the index graph and searches for a leaf node that can best answer the query.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

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.

llama_index.indices.tree.select_leaf_retriever.get_text_from_node(node: Node, level: Optional[int] = None, verbose: bool = False) str

Get text from node.

Query Tree using embedding similarity between query and node text.

class llama_index.indices.tree.select_leaf_embedding_retriever.TreeSelectLeafEmbeddingRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf embedding retriever.

This class traverses the index graph using the embedding similarity between the query and the node text.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

  • refine_template (Optional[RefinePrompt]) -- Refinement Prompt (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

  • embed_model (Optional[BaseEmbedding]) -- Embedding model to use for embedding similarity.

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.

翻译: 树检索器 =======================

Summarize query.

class llama_index.indices.tree.all_leaf_retriever.TreeAllLeafRetriever(index: Any)

GPT all leaf retriever.

This class builds a query-specific tree from leaf nodes to return a response. Using this query mode means that the tree index doesn't need to be built when initialized, since we rebuild the tree for each query.

参数

text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

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.

Leaf query mechanism.

class llama_index.indices.tree.select_leaf_retriever.TreeSelectLeafRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf retriever.

This class traverses the index graph and searches for a leaf node that can best answer the query.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

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.

llama_index.indices.tree.select_leaf_retriever.get_text_from_node(node: Node, level: Optional[int] = None, verbose: bool = False) str

Get text from node.

Query Tree using embedding similarity between query and node text.

class llama_index.indices.tree.select_leaf_embedding_retriever.TreeSelectLeafEmbeddingRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf embedding retriever.

This class traverses the index graph using the embedding similarity between the query and the node text.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

  • refine_template (Optional[RefinePrompt]) -- Refinement Prompt (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

  • embed_model (Optional[BaseEmbedding]) -- Embedding model to use for embedding similarity.

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.

翻译: 树检索器 =======================

Summarize query.

class llama_index.indices.tree.all_leaf_retriever.TreeAllLeafRetriever(index: Any)

GPT all leaf retriever.

This class builds a query-specific tree from leaf nodes to return a response. Using this query mode means that the tree index doesn't need to be built when initialized, since we rebuild the tree for each query.

参数

text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

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.

Leaf query mechanism.

class llama_index.indices.tree.select_leaf_retriever.TreeSelectLeafRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf retriever.

This class traverses the index graph and searches for a leaf node that can best answer the query.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

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.

llama_index.indices.tree.select_leaf_retriever.get_text_from_node(node: Node, level: Optional[int] = None, verbose: bool = False) str

Get text from node.

Query Tree using embedding similarity between query and node text.

class llama_index.indices.tree.select_leaf_embedding_retriever.TreeSelectLeafEmbeddingRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf embedding retriever.

This class traverses the index graph using the embedding similarity between the query and the node text.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

  • refine_template (Optional[RefinePrompt]) -- Refinement Prompt (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

  • embed_model (Optional[BaseEmbedding]) -- Embedding model to use for embedding similarity.

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.

翻译: 树检索器 =======================

Summarize query.

class llama_index.indices.tree.all_leaf_retriever.TreeAllLeafRetriever(index: Any)

GPT all leaf retriever.

This class builds a query-specific tree from leaf nodes to return a response. Using this query mode means that the tree index doesn't need to be built when initialized, since we rebuild the tree for each query.

参数

text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

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.

Leaf query mechanism.

class llama_index.indices.tree.select_leaf_retriever.TreeSelectLeafRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf retriever.

This class traverses the index graph and searches for a leaf node that can best answer the query.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

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.

llama_index.indices.tree.select_leaf_retriever.get_text_from_node(node: Node, level: Optional[int] = None, verbose: bool = False) str

Get text from node.

Query Tree using embedding similarity between query and node text.

class llama_index.indices.tree.select_leaf_embedding_retriever.TreeSelectLeafEmbeddingRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf embedding retriever.

This class traverses the index graph using the embedding similarity between the query and the node text.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

  • refine_template (Optional[RefinePrompt]) -- Refinement Prompt (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

  • embed_model (Optional[BaseEmbedding]) -- Embedding model to use for embedding similarity.

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.

翻译: 树检索器 =======================

Summarize query.

class llama_index.indices.tree.all_leaf_retriever.TreeAllLeafRetriever(index: Any)

GPT all leaf retriever.

This class builds a query-specific tree from leaf nodes to return a response. Using this query mode means that the tree index doesn't need to be built when initialized, since we rebuild the tree for each query.

参数

text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

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.

Leaf query mechanism.

class llama_index.indices.tree.select_leaf_retriever.TreeSelectLeafRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf retriever.

This class traverses the index graph and searches for a leaf node that can best answer the query.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

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.

llama_index.indices.tree.select_leaf_retriever.get_text_from_node(node: Node, level: Optional[int] = None, verbose: bool = False) str

Get text from node.

Query Tree using embedding similarity between query and node text.

class llama_index.indices.tree.select_leaf_embedding_retriever.TreeSelectLeafEmbeddingRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf embedding retriever.

This class traverses the index graph using the embedding similarity between the query and the node text.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

  • refine_template (Optional[RefinePrompt]) -- Refinement Prompt (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

  • embed_model (Optional[BaseEmbedding]) -- Embedding model to use for embedding similarity.

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.

翻译: 树检索器 =======================

Summarize query.

class llama_index.indices.tree.all_leaf_retriever.TreeAllLeafRetriever(index: Any)

GPT all leaf retriever.

This class builds a query-specific tree from leaf nodes to return a response. Using this query mode means that the tree index doesn't need to be built when initialized, since we rebuild the tree for each query.

参数

text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

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.

Leaf query mechanism.

class llama_index.indices.tree.select_leaf_retriever.TreeSelectLeafRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf retriever.

This class traverses the index graph and searches for a leaf node that can best answer the query.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

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.

llama_index.indices.tree.select_leaf_retriever.get_text_from_node(node: Node, level: Optional[int] = None, verbose: bool = False) str

Get text from node.

Query Tree using embedding similarity between query and node text.

class llama_index.indices.tree.select_leaf_embedding_retriever.TreeSelectLeafEmbeddingRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf embedding retriever.

This class traverses the index graph using the embedding similarity between the query and the node text.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

  • refine_template (Optional[RefinePrompt]) -- Refinement Prompt (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

  • embed_model (Optional[BaseEmbedding]) -- Embedding model to use for embedding similarity.

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.

翻译: 树检索器 =======================

Summarize query.

class llama_index.indices.tree.all_leaf_retriever.TreeAllLeafRetriever(index: Any)

GPT all leaf retriever.

This class builds a query-specific tree from leaf nodes to return a response. Using this query mode means that the tree index doesn't need to be built when initialized, since we rebuild the tree for each query.

参数

text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

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.

Leaf query mechanism.

class llama_index.indices.tree.select_leaf_retriever.TreeSelectLeafRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf retriever.

This class traverses the index graph and searches for a leaf node that can best answer the query.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

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.

llama_index.indices.tree.select_leaf_retriever.get_text_from_node(node: Node, level: Optional[int] = None, verbose: bool = False) str

Get text from node.

Query Tree using embedding similarity between query and node text.

class llama_index.indices.tree.select_leaf_embedding_retriever.TreeSelectLeafEmbeddingRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf embedding retriever.

This class traverses the index graph using the embedding similarity between the query and the node text.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

  • refine_template (Optional[RefinePrompt]) -- Refinement Prompt (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

  • embed_model (Optional[BaseEmbedding]) -- Embedding model to use for embedding similarity.

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.

翻译: 树检索器 =======================

Summarize query.

class llama_index.indices.tree.all_leaf_retriever.TreeAllLeafRetriever(index: Any)

GPT all leaf retriever.

This class builds a query-specific tree from leaf nodes to return a response. Using this query mode means that the tree index doesn't need to be built when initialized, since we rebuild the tree for each query.

参数

text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

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.

Leaf query mechanism.

class llama_index.indices.tree.select_leaf_retriever.TreeSelectLeafRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf retriever.

This class traverses the index graph and searches for a leaf node that can best answer the query.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

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.

llama_index.indices.tree.select_leaf_retriever.get_text_from_node(node: Node, level: Optional[int] = None, verbose: bool = False) str

Get text from node.

Query Tree using embedding similarity between query and node text.

class llama_index.indices.tree.select_leaf_embedding_retriever.TreeSelectLeafEmbeddingRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf embedding retriever.

This class traverses the index graph using the embedding similarity between the query and the node text.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

  • refine_template (Optional[RefinePrompt]) -- Refinement Prompt (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

  • embed_model (Optional[BaseEmbedding]) -- Embedding model to use for embedding similarity.

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.

翻译: 树检索器 =======================

Summarize query.

class llama_index.indices.tree.all_leaf_retriever.TreeAllLeafRetriever(index: Any)

GPT all leaf retriever.

This class builds a query-specific tree from leaf nodes to return a response. Using this query mode means that the tree index doesn't need to be built when initialized, since we rebuild the tree for each query.

参数

text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

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.

Leaf query mechanism.

class llama_index.indices.tree.select_leaf_retriever.TreeSelectLeafRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf retriever.

This class traverses the index graph and searches for a leaf node that can best answer the query.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

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.

llama_index.indices.tree.select_leaf_retriever.get_text_from_node(node: Node, level: Optional[int] = None, verbose: bool = False) str

Get text from node.

Query Tree using embedding similarity between query and node text.

class llama_index.indices.tree.select_leaf_embedding_retriever.TreeSelectLeafEmbeddingRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf embedding retriever.

This class traverses the index graph using the embedding similarity between the query and the node text.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

  • refine_template (Optional[RefinePrompt]) -- Refinement Prompt (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

  • embed_model (Optional[BaseEmbedding]) -- Embedding model to use for embedding similarity.

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.

翻译: 树检索器 =======================

Summarize query.

class llama_index.indices.tree.all_leaf_retriever.TreeAllLeafRetriever(index: Any)

GPT all leaf retriever.

This class builds a query-specific tree from leaf nodes to return a response. Using this query mode means that the tree index doesn't need to be built when initialized, since we rebuild the tree for each query.

参数

text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

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.

Leaf query mechanism.

class llama_index.indices.tree.select_leaf_retriever.TreeSelectLeafRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf retriever.

This class traverses the index graph and searches for a leaf node that can best answer the query.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

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.

llama_index.indices.tree.select_leaf_retriever.get_text_from_node(node: Node, level: Optional[int] = None, verbose: bool = False) str

Get text from node.

Query Tree using embedding similarity between query and node text.

class llama_index.indices.tree.select_leaf_embedding_retriever.TreeSelectLeafEmbeddingRetriever(index: GPTTreeIndex, query_template: Optional[Prompt] = None, text_qa_template: Optional[Prompt] = None, refine_template: Optional[Prompt] = None, query_template_multiple: Optional[Prompt] = None, child_branch_factor: int = 1, verbose: bool = False, **kwargs: Any)

Tree select leaf embedding retriever.

This class traverses the index graph using the embedding similarity between the query and the node text.

参数
  • query_template (Optional[TreeSelectPrompt]) -- Tree Select Query Prompt (see Prompt-Templates).

  • query_template_multiple (Optional[TreeSelectMultiplePrompt]) -- Tree Select Query Prompt (Multiple) (see Prompt-Templates).

  • text_qa_template (Optional[QuestionAnswerPrompt]) -- Question-Answer Prompt (see Prompt-Templates).

  • refine_template (Optional[RefinePrompt]) -- Refinement Prompt (see Prompt-Templates).

  • child_branch_factor (int) -- Number of child nodes to consider at each level. If child_branch_factor is 1, then the query will only choose one child node to traverse for any given parent node. If child_branch_factor is 2, then the query will choose two child nodes.

  • embed_model (Optional[BaseEmbedding]) -- Embedding model to use for embedding similarity.

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.

翻译: