From f460efd2b830c69379495fc949017b674ad770bb Mon Sep 17 00:00:00 2001 From: Christian Muertz Date: Tue, 20 Dec 2022 16:50:42 +0100 Subject: [PATCH] Update ad auth section --- examples/azure/completions.ipynb | 21 +++++++++++++-------- examples/azure/embeddings.ipynb | 14 ++++++-------- examples/azure/finetuning.ipynb | 14 ++++++-------- 3 files changed, 25 insertions(+), 24 deletions(-) diff --git a/examples/azure/completions.ipynb b/examples/azure/completions.ipynb index b1cf30f9..da72f2f1 100644 --- a/examples/azure/completions.ipynb +++ b/examples/azure/completions.ipynb @@ -67,7 +67,7 @@ "metadata": {}, "source": [ "### (Optional) Setup: Microsoft Active Directory Authentication\n", - "Let's now see how we can get a key via Microsoft Active Directory Authentication." + "Let's now see how we can get a key via Microsoft Active Directory Authentication. Uncomment the following code if you want to use Active Directory Authentication instead of keys from the portal." ] }, { @@ -76,15 +76,13 @@ "metadata": {}, "outputs": [], "source": [ - "\"\"\"\n", - "from azure.identity import DefaultAzureCredential\n", + "# from azure.identity import DefaultAzureCredential\n", "\n", - "default_credential = DefaultAzureCredential()\n", - "token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n", + "# default_credential = DefaultAzureCredential()\n", + "# token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n", "\n", - "openai.api_type = 'azure_ad'\n", - "openai.api_key = token.token\n", - "\"\"\"" + "# openai.api_type = 'azure_ad'\n", + "# openai.api_key = token.token" ] }, { @@ -191,6 +189,13 @@ "print(f'Deleting deployment: {deployment_id}')\n", "openai.Deployment.delete(sid=deployment_id)" ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { diff --git a/examples/azure/embeddings.ipynb b/examples/azure/embeddings.ipynb index f7729e72..cef6a0cc 100644 --- a/examples/azure/embeddings.ipynb +++ b/examples/azure/embeddings.ipynb @@ -72,7 +72,7 @@ "metadata": {}, "source": [ "### (Optional) Setup: Microsoft Active Directory Authentication\n", - "Let's now see how we can get a key via Microsoft Active Directory Authentication." + "Let's now see how we can get a key via Microsoft Active Directory Authentication. Uncomment the following code if you want to use Active Directory Authentication instead of keys from the portal." ] }, { @@ -81,15 +81,13 @@ "metadata": {}, "outputs": [], "source": [ - "\"\"\"\n", - "from azure.identity import DefaultAzureCredential\n", + "# from azure.identity import DefaultAzureCredential\n", "\n", - "default_credential = DefaultAzureCredential()\n", - "token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n", + "# default_credential = DefaultAzureCredential()\n", + "# token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n", "\n", - "openai.api_type = 'azure_ad'\n", - "openai.api_key = token.token\n", - "\"\"\"" + "# openai.api_type = 'azure_ad'\n", + "# openai.api_key = token.token" ] }, { diff --git a/examples/azure/finetuning.ipynb b/examples/azure/finetuning.ipynb index 3f6ed662..434901d8 100644 --- a/examples/azure/finetuning.ipynb +++ b/examples/azure/finetuning.ipynb @@ -68,7 +68,7 @@ "metadata": {}, "source": [ "### (Optional) Setup: Microsoft Active Directory Authentication\n", - "Let's now see how we can get a key via Microsoft Active Directory Authentication." + "Let's now see how we can get a key via Microsoft Active Directory Authentication. Uncomment the following code if you want to use Active Directory Authentication instead of keys from the portal." ] }, { @@ -77,15 +77,13 @@ "metadata": {}, "outputs": [], "source": [ - "\"\"\"\n", - "from azure.identity import DefaultAzureCredential\n", + "# from azure.identity import DefaultAzureCredential\n", "\n", - "default_credential = DefaultAzureCredential()\n", - "token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n", + "# default_credential = DefaultAzureCredential()\n", + "# token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n", "\n", - "openai.api_type = 'azure_ad'\n", - "openai.api_key = token.token\n", - "\"\"\"" + "# openai.api_type = 'azure_ad'\n", + "# openai.api_key = token.token" ] }, {