insert_message | R Documentation |
Inserts a message at a specified position in a list of messages. The role and content are converted to a list and inserted into the input list at the given position.
insert_message(content, role = "user", x = NULL, position = -1, ...)
content |
The content of the message. |
role |
The role of the message. Can be "user", "system", "assistant". Default is "user". |
x |
A list of messages. Default is NULL. |
position |
The position at which to insert the new message. Default is -1 (end of list). |
... |
Additional arguments such as images. |
A list of messages with the new message inserted at the specified position.
messages <- list(
list(role = "system", content = "Be friendly"),
list(role = "user", content = "How are you?")
)
insert_message("INSERT MESSAGE AT THE END", "user", messages)
insert_message("INSERT MESSAGE AT THE BEGINNING", "user", messages, 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.