Register a 'retrieve' tool with ellmer
Arguments
- chat
a
ellmer:::Chat
object.- store
a string of a store location, or a
RagnarStore
object.- store_description
Optional string, used for composing the tool description.
- ...
arguments passed on to
ragnar_retrieve()
.
Examples
if (FALSE) { # (file.exists("r4ds.ragnar.duckdb") && Sys.getenv("OPENAI_API_KEY") != "")
system_prompt <- stringr::str_squish("
You are an expert assistant in R programming.
When responding, you first quote relevant material from books or documentation,
provide links to the sources, and then add your own context and interpretation.
")
chat <- ellmer::chat_openai(system_prompt, model = "gpt-4o")
store <- ragnar_store_connect("r4ds.ragnar.duckdb", read_only = TRUE)
ragnar_register_tool_retrieve(chat, store)
chat$chat("How can I subset a dataframe?")
}