Skip to main content

Module retriever

Module retriever 

Source
Expand description

Document retrieval strategies.

This module provides retrievers for finding relevant content in document trees:

  • LLM Navigation — Tree traversal guided by LLM decisions
  • Context Building — Assembling results for LLM consumption

§Example

use vectorless::retriever::{LlmNavigator, RetrieveOptions, ContextBuilder};
use vectorless::core::DocumentTree;

let tree = DocumentTree::new("Root", "Content");
let retriever = LlmNavigator::with_defaults();
let options = RetrieveOptions::new().with_top_k(5);

let results = retriever.retrieve(&tree, "What is this about?", &options).await?;

let context = ContextBuilder::new()
    .with_max_tokens(4000)
    .build(&results);

println!("Context: {}", context);

Structs§

ContextBuilder
Context builder for assembling retrieval results.
LlmNavigator
LLM-based tree navigation retriever.
NavigationContext
Context for LLM-based navigation.
RetrievalResult
A single retrieval result.
RetrieveOptions
Options for retrieval operations.

Enums§

NavigationDecision
Navigation decision for tree traversal.

Functions§

format_for_llm
Format retrieval results for LLM consumption.
format_tree_for_llm
Format a document tree for LLM consumption.