
Zero-shot chain-of-thought prompting (Kamath Ch 4)
Source:R/kamath_llm2_native.R
morie_kamath_chain_of_thought.RdAppends the trigger, then splits reasoning from the answer.
Usage
morie_kamath_chain_of_thought(
prompt,
model,
trigger = "Let's think step by step.",
answer_marker = "Answer:",
parser = NULL
)Examples
morie_kamath_chain_of_thought("Q", function(p) "step one. Answer: 42")
#> $estimate
#> [1] "42"
#>
#> $answer
#> [1] "42"
#>
#> $reasoning
#> [1] "step one."
#>
#> $prompt
#> [1] "Q Let's think step by step."
#>
#> $generation
#> [1] "step one. Answer: 42"
#>
#> $n
#> [1] 1
#>
#> $method
#> [1] "zero-shot chain-of-thought prompting (Kamath Ch 4)"
#>