Unified LLM chat interface for agrillm
llm_chat(
prompt,
use_cache = FALSE,
persist_cache = TRUE,
cache_path = NULL,
...
)The prompt or message to send to the LLM.
Logical. If TRUE, reuse cached backend responses for
identical requests within the current R session. Default: FALSE.
Logical. If TRUE, persist cached responses to disk so
they can be reloaded in later sessions. Default: TRUE.
Optional character string path to the cache file used when
persist_cache = TRUE. Default: .cache_agrillm.rds in the current working
directory.
Additional arguments passed to the backend chat function.
The response from the LLM backend (typically a tidyllm response object).
if (FALSE) { # \dontrun{
# Send a prompt to the configured LLM (Azure OpenAI by default)
response <- llm_chat("What are the advantages of early sowing?")
# Use caching for repeated queries
response <- llm_chat("Explain nitrogen management", use_cache = TRUE)
# Extract the text reply
reply_text <- tidyllm::get_reply(response)
} # }