Skip to contents

The LLM abstracts the query; contexts from both queries are unioned with the abstract query's documents FIRST and duplicates dropped.

Usage

morie_kamath_step_back_prompting(query, model, retrieve = NULL, answer = NULL)

Arguments

query

Question.

model

Abstraction function.

retrieve

Optional retriever.

answer

Optional answerer.

Value

List with step_back_query, context, stepped_back.

Examples

morie_kamath_step_back_prompting("what year did X happen", function(q) "history of X",
    retrieve = function(q) if (q == "history of X") list("d1",
        "d2") else list("d2", "d3"))
#> $step_back_query
#> [1] "history of X"
#> 
#> $query
#> [1] "what year did X happen"
#> 
#> $stepped_back
#> [1] TRUE
#> 
#> $context
#> $context[[1]]
#> [1] "d1"
#> 
#> $context[[2]]
#> [1] "d2"
#> 
#> $context[[3]]
#> [1] "d3"
#> 
#> 
#> $retrieved_by_query
#> $retrieved_by_query$`history of X`
#> $retrieved_by_query$`history of X`[[1]]
#> [1] "d1"
#> 
#> $retrieved_by_query$`history of X`[[2]]
#> [1] "d2"
#> 
#> 
#> $retrieved_by_query$`what year did X happen`
#> $retrieved_by_query$`what year did X happen`[[1]]
#> [1] "d2"
#> 
#> $retrieved_by_query$`what year did X happen`[[2]]
#> [1] "d3"
#> 
#> 
#> 
#> $n_context
#> [1] 3
#> 
#> $estimate
#> [1] 3
#> 
#> $n
#> [1] 3
#> 
#> $method
#> [1] "Step-back prompting (abstract query, then specific)"
#>