A helper function to create the prompt input.
Usage
prompt_user(
content,
images = NULL,
tool_calls = NULL,
.content_envir = rlang::caller_env(),
.collapse_regex = "[*]$"
)
prompt_assistant(
content,
images = NULL,
tool_calls = NULL,
.content_envir = rlang::caller_env(),
.collapse_regex = "[*]$"
)
prompt_system(
content,
images = NULL,
tool_calls = NULL,
.content_envir = rlang::caller_env(),
.collapse_regex = "[*]$"
)
Arguments
- content
A single text with any content in "" evaluated as an R expression. If the bracket contains "" at the end (or regular expression match as specified in
.collapse_regex
) then it collapses into a comma separated list in a square bracket with each element single quoted. E.g. "1:3" expands to '1', '2', '3'.- images
A list of path or url to the images (or base64 encoded images).
- tool_calls
Currently doesn't work as intended.
- .content_envir
The environment used to evaluate
content
.- .collapse_regex
The regular expression match to collapse the content.
- role
The role should be "user", "assistant" or "system".