Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@atheriel
Copy link
Collaborator

Inspired by a recent comment, this commit adds support for picking up on Azure service principals, which seem to be a common way to furnish chat_azure() with credentials without the need for an API key.

This approach also handles caching and expiry for these tokens, an ongoing source of problems for users.

Unit tests are included. I've also updated the documentation.

Inspired by a recent comment [0], this commit adds support for picking
up on Azure service principals, which seem to be a common way to furnish
`chat_azure()` with credentials without the need for an API key.

This approach also handles caching and expiry for these tokens, an
ongoing source of problems for users.

Unit tests are included. I've also updated the documentation.

[0]: #262 (comment)

Signed-off-by: Aaron Jacobs <[email protected]>
@atheriel
Copy link
Collaborator Author

atheriel commented Jan 22, 2025

@DavZim Do you want to see if this works with your Azure service principal setup? It should dramatically simplify your code.

pak::pkg_install("tidyverse/ellmer#263")

library(ellmer)

chat <- chat_azure(
  endpoint = Sys.getenv("AZURE_OPENAI_ENDPOINT"),
  deployment_id = "gpt-4o",
  api_version = Sys.getenv("AZURE_OPENAI_API_VERSION")
)

a <- chat$extract_data(
  "My name is Susan and I'm 13 years old",
  type = type_object(
    age = type_number(),
    name = type_string()
  )
)

@atheriel
Copy link
Collaborator Author

According to #262 (comment), this does work, so I think it should be ready for review.

@atheriel atheriel requested a review from hadley January 23, 2025 23:19
@atheriel atheriel merged commit a3be63b into main Jan 24, 2025
10 of 11 checks passed
@atheriel atheriel deleted the azure-sp branch January 24, 2025 00:30
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.

3 participants