This function creates a new LLMMessage object or updates an existing one.
It supports adding text prompts and various media types, such as images, PDFs, text files, or plots.
llm_message(
.llm = NULL,
.prompt = NULL,
.role = "user",
.system_prompt = "You are a helpful assistant",
.media = NULL,
.files = NULL,
.imagefile = NULL,
.pdf = NULL,
.textfile = NULL,
.capture_plot = FALSE,
.f = NULL
)Returns an updated or new LLMMessage object.
An existing LLMMessage object or an initial text prompt.
Text prompt to add to the message history.
The role of the message sender, typically "user" or "assistant".
Default system prompt if a new LLMMessage needs to be created.
An inline media object or a list of them. Accepted types: img(), audio_file(), video_file(), pdf_file().
A tidyllm_file object or list of them returned by upload_file(). These are remote file references stored on a provider's server.
Path to an image file to be attached (optional). Deprecated; use .media = img(path) instead.
Path to a PDF file to be attached (optional). Deprecated; use .media = pdf_file(path) instead.
Path to a text file to be read and attached (optional).
Boolean to indicate whether a plot should be captured and attached as an image (optional).
An R function or an object coercible to a function via rlang::as_function, whose output should be captured and attached (optional).
df_llm_message()
Other Message Creation Utilities:
df_llm_message()