View source: R/provider-posit.R
| chat_posit | R Documentation |
Posit AI provides access to a curated set of models for Posit subscribers.
By default, chat_posit() authenticates with an OAuth device flow against
login.posit.cloud: the first time you use it, you'll be prompted to
visit a URL and enter a code. The resulting tokens are cached on disk
(see httr2::req_oauth_device()) and refreshed automatically, so you
should only need to do this once per machine.
chat_posit(
system_prompt = NULL,
base_url = "https://gateway.posit.ai",
credentials = NULL,
model = NULL,
params = NULL,
cache = c("5m", "1h", "none"),
api_args = list(),
api_headers = character(),
echo = NULL
)
models_posit(base_url = "https://gateway.posit.ai", credentials = NULL)
system_prompt |
A system prompt to set the behavior of the assistant. |
base_url |
The base URL of the Posit AI gateway. |
credentials |
A zero-argument function that returns the credentials to use in place of the default OAuth device flow, either as a named list of headers or as a function that modifies the request. You should not usually need to set this. |
model |
The model to use for the chat (defaults to "claude-sonnet-4-6").
We regularly update the default, so we strongly recommend explicitly specifying a model for anything other than casual use.
Use |
params |
Common model parameters, usually created by |
cache |
How long to cache inputs? Defaults to "5m" (five minutes). Set to "none" to disable caching or "1h" to cache for one hour. This is only supported for Claude models and is ignored for other models. |
api_args |
Named list of arbitrary extra arguments appended to the body
of every chat API call. Combined with the body object generated by ellmer
with |
api_headers |
Named character vector of arbitrary extra headers appended to every chat API call. |
echo |
One of the following options:
Note this only affects the |
A Chat object.
Other chatbots:
chat_anthropic(),
chat_aws_bedrock(),
chat_azure_openai(),
chat_cloudflare(),
chat_databricks(),
chat_deepseek(),
chat_github(),
chat_google_gemini(),
chat_groq(),
chat_huggingface(),
chat_lmstudio(),
chat_mistral(),
chat_ollama(),
chat_openai(),
chat_openai_compatible(),
chat_openrouter(),
chat_perplexity(),
chat_portkey()
## Not run:
chat <- chat_posit()
chat$chat("Tell me three jokes about statisticians")
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.