Few-shot in-context prompt construction with a zero-shot control (hmfsf)
Usage
morie_geron_few_shot(
model,
examples,
query,
k = NULL,
separator = "\n",
template = "{x} -> {y}",
max_context = NULL
)
Arguments
- model
function(prompt) -> prediction.
- examples
List of (x, y) pairs.
- query
Input to predict.
- k
Number of demonstrations (default all).
- separator, template
Prompt format.
- max_context
Optional cap.
Value
List with prediction, zero_shot_prediction, prompt, changed_by_context, k.
Examples
model <- function(prompt) if (grepl("2 -> 4", prompt, fixed = TRUE)) "6" else "?"
ex <- list(list("1", "2"), list("2", "4"))
r <- morie_geron_few_shot(model, ex, query = "3")
r$prediction
#> [1] "6"