Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simplify authenticate() #18

Merged
merged 1 commit into from
Mar 9, 2024
Merged

simplify authenticate() #18

merged 1 commit into from
Mar 9, 2024

Conversation

romainfrancois
Copy link
Contributor

closes #17

This way we get the same error as if the key was wrong:

mistral.ai::chat("hello")
#> Error in `mistral.ai::chat()`:
#> ✖ with endpoint <https://api.mistral.ai/v1/models>
#> ℹ Make sure your api key is valid <https://console.mistral.ai/api-keys/>
#> ℹ And set the `MISTRAL_API_KEY` environment variable
#> ℹ Perhaps using `usethis::edit_r_environ()`
#> Caused by error in `req_perform()` at mistral.ai/R/httr2.R:22:3:
#> ! HTTP 401 Unauthorized.

Created on 2024-03-09 with reprex v2.1.0

@romainfrancois romainfrancois requested a review from Felixmil March 9, 2024 11:05
@JamesHWade
Copy link
Collaborator

I like this simplification. As a convenience feature, what about making usethis::edit_r_environ() run when the user clicks it?

@romainfrancois
Copy link
Contributor Author

It's already the case with i = "Perhaps using {.fn usethis::edit_r_environ}" curtosy of cli inline markup

@romainfrancois romainfrancois merged commit 2fe7009 into main Mar 9, 2024
6 checks passed
@romainfrancois romainfrancois deleted the simpliify_authenticate branch March 9, 2024 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Perhaps we don't need to test the existence of the env var in authenticate
2 participants