Register an LLM provider
Arguments
- name
Provider name (e.g.
"openai","anthropic", a local endpoint).- request_fn
A function
function(prompt, llm)returning the model's text output, orNULLon failure.- parse_fn
Optional custom parser
function(text); defaults to JSON array extraction.- replace
Overwrite an existing provider named
name? Defaults toFALSEso a plugin cannot silently replace a built-in provider.
Examples
register_llm_provider("echo", function(prompt, llm) "[]", replace = TRUE)
"echo" %in% list_llm_providers()
#> [1] TRUE
