chat_cortex_analyst {ellmer} | R Documentation |
Create a chatbot that speaks to the Snowflake Cortex Analyst
Description
Chat with the LLM-powered Snowflake Cortex Analyst.
Authentication
chat_cortex_analyst()
picks up the following ambient Snowflake credentials:
A static OAuth token defined via the
SNOWFLAKE_TOKEN
environment variable.Key-pair authentication credentials defined via the
SNOWFLAKE_USER
andSNOWFLAKE_PRIVATE_KEY
(which can be a PEM-encoded private key or a path to one) environment variables.Posit Workbench-managed Snowflake credentials for the corresponding
account
.Viewer-based credentials on Posit Connect. Requires the connectcreds package.
Known limitations
Unlike most comparable model APIs, Cortex does not take a system prompt. Instead, the caller must provide a "semantic model" describing available tables, their meaning, and verified queries that can be run against them as a starting point. The semantic model can be passed as a YAML string or via reference to an existing file in a Snowflake Stage.
Note that Cortex does not support multi-turn, so it will not remember previous messages. Nor does it support registering tools, and attempting to do so will result in an error.
See chat_snowflake()
to chat with more general-purpose models hosted on
Snowflake.
Usage
chat_cortex_analyst(
account = snowflake_account(),
credentials = NULL,
model_spec = NULL,
model_file = NULL,
api_args = list(),
echo = c("none", "output", "all")
)
Arguments
account |
A Snowflake account identifier,
e.g. |
credentials |
A list of authentication headers to pass into
|
model_spec |
A semantic model specification, or |
model_file |
Path to a semantic model file stored in a Snowflake Stage,
or |
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 |
echo |
One of the following options:
Note this only affects the |
Value
A Chat object.
See Also
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_mistral()
,
chat_ollama()
,
chat_openai()
,
chat_openrouter()
,
chat_perplexity()
,
chat_portkey()
Examples
chat <- chat_cortex_analyst(
model_file = "@my_db.my_schema.my_stage/model.yaml"
)
chat$chat("What questions can I ask?")