Skip to contents

Grades the retrieved documents, then keeps them, falls back to the web, or mixes.

Usage

morie_kamath_corrective_rag(query, docs, clf, tau_hi, tau_lo)

Arguments

query

Query.

docs

Documents.

clf

Confidence function.

tau_hi, tau_lo

Upper and lower thresholds.

Value

List with estimate, action, ctx, scores.

Examples

morie_kamath_corrective_rag("q", list("d1", "d2", "d3"), function(q,
    d) c(d1 = 0.9, d2 = 0.5, d3 = 0.1)[[d]], 0.8, 0.2)
#> $estimate
#> [1] 0.9
#> 
#> $action
#> [1] "use_docs"
#> 
#> $ctx
#> $ctx[[1]]
#> [1] "d1"
#> 
#> 
#> $scores
#> [1] 0.9 0.5 0.1
#> 
#> $best_score
#> [1] 0.9
#> 
#> $tau_hi
#> [1] 0.8
#> 
#> $tau_lo
#> [1] 0.2
#> 
#> $n
#> [1] 3
#> 
#> $method
#> [1] "Corrective RAG retrieval router (Kamath Ch 7)"
#>