diff --git a/docs/docs/usage-guide/changing_a_model.md b/docs/docs/usage-guide/changing_a_model.md index 9eec3b64..36480d21 100644 --- a/docs/docs/usage-guide/changing_a_model.md +++ b/docs/docs/usage-guide/changing_a_model.md @@ -37,6 +37,17 @@ model="" # the OpenAI model you've deployed on Azure (e.g. gpt-4o) fallback_models=["..."] ``` +To use Azure AD (Entra id) based authentication set in your `.secrets.toml` (working from CLI), or in the GitHub `Settings > Secrets and variables` (working from GitHub App or GitHub Action): + +```toml +[azure_ad] +client_id = "" # Your Azure AD application client ID +client_secret = "" # Your Azure AD application client secret +tenant_id = "" # Your Azure AD tenant ID +api_base = "" # Your Azure OpenAI service base URL (e.g., https://openai.xyz.com/) +``` + + Passing custom headers to the underlying LLM Model API can be done by setting extra_headers parameter to litellm. ```toml diff --git a/pr_agent/algo/ai_handlers/litellm_ai_handler.py b/pr_agent/algo/ai_handlers/litellm_ai_handler.py index d2286d3b..b34b4a0a 100644 --- a/pr_agent/algo/ai_handlers/litellm_ai_handler.py +++ b/pr_agent/algo/ai_handlers/litellm_ai_handler.py @@ -100,6 +100,7 @@ class LiteLLMAIHandler(BaseAiHandler): # Check for Azure AD configuration if get_settings().get("AZURE_AD.CLIENT_ID", None): + from azure.identity import ClientSecretCredential self.azure = True # Generate access token using Azure AD credentials from settings access_token = self._get_azure_ad_token()