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

AzureOpenAIServerModel doesn't support Microsoft Entra ID authentication #590

Open
edwardmfho opened this issue Feb 10, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@edwardmfho
Copy link

The current AzureOpenAIServerModel can only be authenticated via API key. While this is useful, does not account for the use of Microsoft Entra ID to authenticate.

We can make a simple change to the AzureOpenAIServerModel to enable such authentication method. Pull request to be created to address this issue.

The usage example can be found below:

import os
from smolagents.models import AzureOpenAIServerModel
from azure.identity import DefaultAzureCredential, get_bearer_token_provider

    token_provider = get_bearer_token_provider(
        DefaultAzureCredential(),
         "https://cognitiveservices.azure.com/.default")

   
    model = AzureOpenAIServerModel(
        args.model_id,
        azure_endpoint=os.getenv("AZURE_OPENAI_ENDPOINT"),
        azure_deployment=os.getenv("AZURE_DEPLOPYMENT_NAME"),
        azure_ad_token_provider=token_provider,
        api_version=os.getenv("AZURE_API_VERSION"),
        custom_role_conversions=custom_role_conversions,
        max_completion_tokens=8192,
        reasoning_effort="high",
    )   
@edwardmfho
Copy link
Author

Code implemented in #592

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant