Add a new chat_snowflake() provider#258
Merged
Merged
Conversation
5bbf948 to
3b1c73d
Compare
hadley
approved these changes
Jan 21, 2025
| req <- request(provider@base_url) | ||
| req <- req_url_path_append(req, "/api/v2/cortex/inference:complete") | ||
| creds <- cortex_credentials(provider@account, provider@credentials) | ||
| req <- req_headers(req, !!!creds, .redact = "Authorization") |
Member
There was a problem hiding this comment.
I wondered about always redacting Authorization in httr2. What do you think?
Collaborator
Author
There was a problem hiding this comment.
That kind of makes sense to me, yeah.
This commit adds `chat_snowflake()` for chatting with models hosted
through Snowflake's [Cortex LLM REST API][0]:
chat <- chat_snowflake()
chat$chat("Tell me a joke in the form of a SQL query.")
On the backend it looks fairly similar to OpenAI, though it has only the
basic textual functionality, and so many advanced ellmer features are
not available. I also reused quite a bit of the credential support and
utilities from `chat_cortex()`, so this commit also includes some minor
refactoring of that provider.
Right now the default model for `chat_snowflake()` is Llama 3.1 70B, but
we should change it to Claude 3.5 Sonnet when that gets rolled out more
widely; it's only available to customers in the `us-west-1` Snowflake
region right now.
Unit tests are included.
Part of tidyverse#255.
[0]: https://docs.snowflake.com/en/user-guide/snowflake-cortex/cortex-llm-rest-api
Signed-off-by: Aaron Jacobs <aaron.jacobs@posit.co>
3b1c73d to
adbdef3
Compare
Collaborator
Author
|
@hadley I don't have write permissions to merge, if you were waiting for me to. |
Member
|
You do now 😄 Feel free to add yourself to the authors too, if you want. |
Collaborator
Author
Member
|
You have to accept the invite 😄 |
Collaborator
Author
|
🤦 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This commit adds
chat_snowflake()for chatting with models hosted through Snowflake's Cortex LLM REST API:On the backend it looks fairly similar to OpenAI, though it has only the basic textual functionality, and so many advanced ellmer features are not available. I also reused quite a bit of the credential support and utilities from
chat_cortex(), so this commit also includes some minor refactoring of that provider.Right now the default model for
chat_snowflake()is Llama 3.1 70B, but we should change it to Claude 3.5 Sonnet when that gets rolled out more widely; it's only available to customers in theus-west-1Snowflake region right now.Unit tests are included.
Part of #255.