Skip to contents

P(y | [ex_1..ex_K, x]) from a caller-supplied LM.

Usage

morie_kamath_in_context_learning_prob(
  demonstrations,
  query,
  model,
  answer = NULL,
  sep = "\n"
)

Arguments

demonstrations

Exemplar strings.

query

Test input.

model

Function (prompt, answer) -> probability.

answer

Target.

sep

Separator.

Value

List with estimate, log_prob, prompt, K.

Examples

morie_kamath_in_context_learning_prob(c("e1", "e2"), "q", function(p,
    a) 0.25)
#> $estimate
#> [1] 0.25
#> 
#> $probability
#> [1] 0.25
#> 
#> $log_prob
#> [1] -1.386294
#> 
#> $prompt
#> [1] "e1\ne2\nq"
#> 
#> $K
#> [1] 2
#> 
#> $n
#> [1] 3
#> 
#> $method
#> [1] "In-context learning conditional probability"
#>