Unified LLM chat interface for agrillm

llm_chat(
  prompt,
  use_cache = FALSE,
  persist_cache = TRUE,
  cache_path = NULL,
  ...
)

Arguments

prompt

The prompt or message to send to the LLM.

use_cache

Logical. If TRUE, reuse cached backend responses for identical requests within the current R session. Default: FALSE.

persist_cache

Logical. If TRUE, persist cached responses to disk so they can be reloaded in later sessions. Default: TRUE.

cache_path

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.

Value

The response from the LLM backend (typically a tidyllm response object).

Examples

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)
} # }