You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Require explicit azure auth settings when using AOI. (#1665)
* Require explicit azure auth settings when using AOI.
- Must set LanguageModel.azure_auth_type to either
"api_key" or "managed_identity" when using AOI.
* Fix smoke tests
* Use general auth_type property instead of azure_auth_type
* Remove unused error type
* Update validation
* Update validation comment
if (self.azure_auth_type==AzureAuthType.ManagedIdentity) and (
51
+
if (self.auth_type==AuthType.AzureManagedIdentity) and (
54
52
self.api_keyisnotNoneandself.api_key.strip() !=""
55
53
):
56
54
msg="API Key should not be provided when using Azure Managed Identity. Please rerun `graphrag init` and remove the api_key when using Azure Managed Identity."
57
55
raiseConflictingSettingsError(msg)
58
56
59
-
azure_auth_type: AzureAuthType|None=Field(
60
-
description="The Azure authentication type to use when using AOI.",
61
-
default=None,
57
+
auth_type: AuthType=Field(
58
+
description="The authentication type.",
59
+
default=defs.AUTH_TYPE,
62
60
)
63
61
62
+
def_validate_auth_type(self) ->None:
63
+
"""Validate the authentication type.
64
+
65
+
auth_type must be api_key when using OpenAI and
66
+
can be either api_key or azure_managed_identity when using AOI.
67
+
68
+
Raises
69
+
------
70
+
ConflictingSettingsError
71
+
If the Azure authentication type conflicts with the model being used.
msg=f"auth_type of azure_managed_identity is not supported for model type {self.type.value}. Please rerun `graphrag init` and set the auth_type to api_key."
77
+
raiseConflictingSettingsError(msg)
78
+
64
79
type: LLMType=Field(description="The type of LLM model to use.")
65
80
model: str=Field(description="The LLM model to use.")
66
81
encoding_model: str=Field(description="The encoding model to use", default="")
0 commit comments