列表检索器

Default query for GPTListIndex.

class llama_index.indices.list.retrievers.ListIndexEmbeddingRetriever(index: GPTListIndex, similarity_top_k: Optional[int] = 1, **kwargs: Any)

Embedding based retriever for ListIndex.

Generates embeddings in a lazy fashion for all nodes that are traversed.

参数
  • index (GPTListIndex) -- The index to retrieve from.

  • similarity_top_k (Optional[int]) -- The number of top nodes to return.

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.

class llama_index.indices.list.retrievers.ListIndexLLMRetriever(index: GPTListIndex, choice_select_prompt: Optional[Prompt] = None, choice_batch_size: int = 10, format_node_batch_fn: Optional[Callable] = None, parse_choice_select_answer_fn: Optional[Callable] = None, service_context: Optional[ServiceContext] = None, **kwargs: Any)

LLM retriever for ListIndex.

参数
  • index (GPTListIndex) -- The index to retrieve from.

  • choice_select_prompt (Optional[ChoiceSelectPrompt]) -- A Choice-Select Prompt (see Prompt-Templates).)

  • choice_batch_size (int) -- The number of nodes to query at a time.

  • format_node_batch_fn (Optional[Callable]) -- A function that formats a batch of nodes.

  • parse_choice_select_answer_fn (Optional[Callable]) -- A function that parses the choice select answer.

  • service_context (Optional[ServiceContext]) -- A service context.

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.

class llama_index.indices.list.retrievers.ListIndexRetriever(index: GPTListIndex, **kwargs: Any)

Simple retriever for ListIndex that returns all nodes.

参数

index (GPTListIndex) -- The index to retrieve from.

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.