Skip to content

Examples and guides for using the OpenAI API

Fix completions notebook

Christian Muertz53a989113321
diff --git a/examples/azure/completions.ipynb b/examples/azure/completions.ipynb
index a2baf400..f5ba33b2 100644
--- a/examples/azure/completions.ipynb
+++ b/examples/azure/completions.ipynb
@@ -6,7 +6,7 @@
"source": [
"# Azure completions example\n",
"In this example we'll try to go over all operations needed to get completions working using the Azure endpoints. \\\n",
- "This example focuses on completions but also touches on the some other operations that are also available using the API. This example is meant to be a quick way of showing simple operations and is not meant as a tutorial."
+ "This example focuses on completions but also touches on some other operations that are also available using the API. This example is meant to be a quick way of showing simple operations and is not meant as a tutorial."
]
},
{
@@ -81,33 +81,36 @@
"from azure.identity import DefaultAzureCredential\n",
"\n",
"default_credential = DefaultAzureCredential()\n",
- "token = default_credential.get_token(\"https://cognitiveservices.azure.com\")\n",
+ "token = default_credential.get_token(\"https://cognitiveservices.azure.com/.default\")\n",
"\n",
"openai.api_key = token.token\n",
"\"\"\""
]
},
{
+ "attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Deployments\n",
- "In this section we are going to create a deployment using the `text-davinci-002` model that we can use to create completions."
+ "In this section we are going to create a deployment using the `text-davinci-002` model that we can then use to create completions."
]
},
{
+ "attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
- "### Deployments: Create Manually\n",
+ "### Deployments: Create manually\n",
"Create a new deployment by going to your Resource in your portal under \"Resource Management\" -> \"Model deployments\". Select `text-davinci-002` as the model."
]
},
{
+ "attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
- "### (Optional) Deployments: Create Programatically\n",
+ "### (Optional) Deployments: Create programatically\n",
"We can also create a deployment using code:"
]
},
@@ -122,7 +125,8 @@
"# Now let's create the deployment\n",
"print(f'Creating a new deployment with model: {model}')\n",
"result = openai.Deployment.create(model=model, scale_settings={\"scale_type\":\"standard\"})\n",
- "deployment_id = result[\"id\"]"
+ "deployment_id = result[\"id\"]\n",
+ "print(f'Successfully created deployment with id: {deployment_id}')"
]
},
{
@@ -205,7 +209,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.8.10"
+ "version": "3.10.8"
},
"vscode": {
"interpreter": {