mirror of
https://github.com/microsoft/graphrag.git
synced 2026-01-14 09:07:20 +08:00
Fix scope for Azure auth with LiteLLM
This commit is contained in:
parent
7f996cf584
commit
a020d92659
@ -33,6 +33,7 @@ def validate_config_names(parameters: GraphRagConfig) -> None:
|
||||
logger.info("LLM Config Params Validated")
|
||||
except Exception as e: # noqa: BLE001
|
||||
logger.error(f"LLM configuration error detected. Exiting...\n{e}") # noqa
|
||||
print("Failed to validate language model params", e) # noqa: T201
|
||||
sys.exit(1)
|
||||
|
||||
# Validate Embeddings LLM configs
|
||||
@ -53,4 +54,5 @@ def validate_config_names(parameters: GraphRagConfig) -> None:
|
||||
logger.info("Embedding LLM Config Params Validated")
|
||||
except Exception as e: # noqa: BLE001
|
||||
logger.error(f"Embedding LLM configuration error detected. Exiting...\n{e}") # noqa
|
||||
print("Failed to validate embedding model params", e) # noqa: T201
|
||||
sys.exit(1)
|
||||
|
||||
@ -86,9 +86,10 @@ def _create_base_completions(
|
||||
msg = "Azure Managed Identity authentication is only supported for Azure models."
|
||||
raise ValueError(msg)
|
||||
|
||||
base_args["azure_scope"] = base_args.pop("audience")
|
||||
base_args["azure_ad_token_provider"] = get_bearer_token_provider(
|
||||
DefaultAzureCredential(),
|
||||
COGNITIVE_SERVICES_AUDIENCE,
|
||||
model_config.audience or COGNITIVE_SERVICES_AUDIENCE,
|
||||
)
|
||||
|
||||
def _base_completion(**kwargs: Any) -> ModelResponse | CustomStreamWrapper:
|
||||
|
||||
@ -72,9 +72,10 @@ def _create_base_embeddings(
|
||||
msg = "Azure Managed Identity authentication is only supported for Azure models."
|
||||
raise ValueError(msg)
|
||||
|
||||
base_args["azure_scope"] = base_args.pop("audience")
|
||||
base_args["azure_ad_token_provider"] = get_bearer_token_provider(
|
||||
DefaultAzureCredential(),
|
||||
COGNITIVE_SERVICES_AUDIENCE,
|
||||
model_config.audience or COGNITIVE_SERVICES_AUDIENCE,
|
||||
)
|
||||
|
||||
def _base_embedding(**kwargs: Any) -> EmbeddingResponse:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user