Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
you-n-g committed Oct 1, 2024
1 parent 681ff71 commit 125c7a2
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions SA/cloud/azure_exmaple.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

from collections import defaultdict # Import defaultdict from collections
from azure.identity import DefaultAzureCredential
from azure.mgmt.cognitiveservices import CognitiveServicesManagementClient


def main():
"""
# Please refer to
# https://github.com/Azure/azure-sdk-for-python/blob/main/sdk/cognitiveservices/azure-mgmt-cognitiveservices/generated_samples/list_deployments.py
# PREREQUISITES
pip install azure-identity azure-mgmt-cognitiveservices
"""
client = CognitiveServicesManagementClient(
credential=DefaultAzureCredential(),
subscription_id="e033d461-1923-44a7-872b-78f1d35a86dd",
)
res = defaultdict(dict)
for acc in "MIICSC", "MSRAOpenAIAustraliaEast", "MSRAOpenAICanadaEast", "MSRAOpenAIEastUS", "MSRAOpenAIEastUS2", "MSRAOpenAINorthCentralUS", "MSRAOpenAISouthCentralUS":
res[acc]["API_BASE"] = f"https://{acc.lower()}.openai.azure.com/"
response = client.deployments.list(
resource_group_name="OpenAI",
account_name=acc,
)
for item in response:
res[acc].setdefault("deployments", []).append(item.id.split('/')[-1])

__import__('pprint').pprint(res)


if __name__ == "__main__":
main()

0 comments on commit 125c7a2

Please sign in to comment.