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

feat: prioritize api_key over tenant_id for more Azure AD token provider #8318

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

you-n-g
Copy link
Contributor

@you-n-g you-n-g commented Feb 6, 2025

prioritize api_key over tenant_id for more Azure AD token provider

  1. we can customize azure token provider with environment.
  2. if we specify api_key, it will have higher priority than tenant_id. (So we can use diverse backend at the same time)

Relevant issues

Type

🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test

Changes

[REQUIRED] Testing - Attach a screenshot of any new tests passing locally

If UI changes, send a screenshot/GIF of working UI fixes

Copy link

vercel bot commented Feb 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 6, 2025 2:29pm

@you-n-g you-n-g changed the title fix: prioritize api_key over tenant_id for more Azure AD token provider feat: prioritize api_key over tenant_id for more Azure AD token provider Feb 6, 2025
@@ -195,7 +195,8 @@ def set_client( # noqa: PLR0915
organization = get_secret_str(organization_env_name)
litellm_params["organization"] = organization
azure_ad_token_provider: Optional[Callable[[], str]] = None
if litellm_params.get("tenant_id"):
# If we have api_key, then we have higher priority
if not api_key and litellm_params.get("tenant_id"):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this logic is getting quite complicated, can we please refactor into a smaller function and add testing for this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which section are you referring to (from which line to which line)?
Hi ,@krrishdholakia

this logic is getting quite complicated, can we please refactor into a smaller function and add testing for this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of test is expected? Do we any example that I can refer to?

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.

2 participants