
In-context / few-shot prompt assembly (Geron Ch 16, morie.fn grinc)
Source:R/geron_train_native.R
morie_geron_in_context_learning.RdIn-context / few-shot prompt assembly (Geron Ch 16, morie.fn grinc)
Usage
morie_geron_in_context_learning(
examples,
query,
predict = NULL,
separator = "\n",
template = "{input} -> {output}"
)Examples
morie_geron_in_context_learning(list(list("a", "1"), list("bb",
"2")), "cc")
#> $prompt
#> [1] "a -> 1\nbb -> 2\ncc ->"
#>
#> $k_shot
#> [1] 2
#>
#> $answer
#> NULL
#>
#> $prompt_chars
#> [1] 20
#>
#> $prompt_words
#> [1] 8
#>
#> $example_order
#> [1] "a" "bb"
#>
#> $estimate
#> [1] "a -> 1\nbb -> 2\ncc ->"
#>
#> $n
#> [1] 2
#>