tidyverse / elmer

Call LLM APIs from R
http://elmer.tidyverse.org/
Other
199 stars 28 forks source link

Add support for Databricks U2M and M2M OAuth credentials #165

Closed atheriel closed 4 days ago

atheriel commented 1 week ago

Use of Databricks personal access tokens are generally discouraged nowadays, the preferred authentication method for Databricks is now OAuth -- either "user to machine", which uses the authorization code flow, or "machine to machine", which is a client credentials flow.

This commit adds support for both. In the process it also adds support for caching and refreshing these credentials correctly across multiple turns.

Unit tests are included for M2M and PAT credentials; U2M credentials are difficult to mock because they require an authorization code flow.

This change also unlocks our ability to use a Databricks service principal to run elmer's own integration tests.