| provider | R Documentation |
Convenience factory that resolves the backend by 3-tier precedence
(explicit type argument -> EVENTSTUDY_ADVISOR_PROVIDER env
selector -> default "custom") and constructs the matching provider
object. All three backends are wired: the in-process "custom" hook and
the HTTP "openai" (OpenAI-compatible) and "anthropic" (native
Anthropic Messages) providers.
provider(type = NULL, fn = NULL, model = NULL, base_url = NULL, ...)
type |
Provider type, one of |
fn |
For |
model |
Optional character model identifier (resolved from
|
base_url |
Optional character base URL for HTTP providers (resolved from
|
... |
Additional arguments forwarded to the provider constructor. |
The "custom" branch needs no network and neither httr2 nor
jsonlite. Keys are never read here; the HTTP providers resolve them at
call time inside their own complete().
A ProviderBase subclass instance.
Other eventstudy-advisor:
AnthropicProvider,
CustomProvider,
OpenAICompatProvider,
ProviderBase,
es_advise(),
es_diagnostics(),
es_kb(),
flag_robustness(),
recommend_stat()
# Custom provider runs in-process, no network:
p <- provider("custom", fn = function(prompt, schema) "advice text")
p$complete("Summarise")$text
## Not run:
# HTTP providers make live calls; never run in examples or on CRAN:
p <- provider("openai", model = "gpt-4o")
p$complete("Summarise these diagnostics")
a <- provider("anthropic", model = "claude-opus-4-8")
a$complete("Summarise these diagnostics")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.