Skip to content

Commit

Permalink
Update ad auth section
Browse files Browse the repository at this point in the history
  • Loading branch information
cmurtz-msft committed Dec 22, 2022
1 parent 0bd2dcf commit 934f4d8
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 24 deletions.
21 changes: 13 additions & 8 deletions examples/azure/completions.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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."
]
},
{
Expand All @@ -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"
]
},
{
Expand Down Expand Up @@ -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": {
Expand Down
14 changes: 6 additions & 8 deletions examples/azure/embeddings.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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."
]
},
{
Expand All @@ -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"
]
},
{
Expand Down
14 changes: 6 additions & 8 deletions examples/azure/finetuning.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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."
]
},
{
Expand All @@ -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"
]
},
{
Expand Down

0 comments on commit 934f4d8

Please sign in to comment.