Skip to content

Examples and guides for using the OpenAI API

Update embeddings notebook

Christian Muertz71656090300c
diff --git a/examples/azure/embeddings.ipynb b/examples/azure/embeddings.ipynb
index 6b78113f..3e99f11e 100644
--- a/examples/azure/embeddings.ipynb
+++ b/examples/azure/embeddings.ipynb
@@ -6,7 +6,7 @@
"source": [
"# Azure embeddings example\n",
"In this example we'll try to go over all operations for embeddings that can be done using the Azure endpoints. \\\n",
- "This example focuses on finetuning but touches on the majority of 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 embeddings 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."
]
},
{
@@ -38,7 +38,7 @@
"openai.api_base = '' # Please add your endpoint here\n",
"\n",
"openai.api_type = 'azure'\n",
- "openai.api_version = '2022-03-01-preview' # this may change in the future"
+ "openai.api_version = '2022-12-01' # this may change in the future"
]
},
{
@@ -46,7 +46,7 @@
"metadata": {},
"source": [
"## Deployments\n",
- "In this section we are going to create a deployment using the finetune model that we just adapted and then used the deployment to create a simple completion operation."
+ "In this section we are going to create a deployment that we can use to create embeddings."
]
},
{
@@ -54,7 +54,7 @@
"metadata": {},
"source": [
"### Deployments: Create Manually\n",
- "Let's create a deployment using the text-similarity-curie-001 engine. You can create a new deployment by going to your Resource in your portal under \"Resource Management\" -> \"Deployments\"."
+ "Let's create a deployment using the `text-similarity-curie-001` engine. Create a new deployment by going to your Resource in your portal under \"Resource Management\" -> \"Deployments\"."
]
},
{
@@ -113,18 +113,24 @@
"metadata": {},
"outputs": [],
"source": [
- "print('While deployment running, selecting a completed one.')\n",
+ "print('While deployment running, selecting a completed one that supports embeddings.')\n",
"deployment_id = None\n",
"result = openai.Deployment.list()\n",
"for deployment in result.data:\n",
- " if deployment[\"status\"] == \"succeeded\":\n",
- " deployment_id = deployment[\"id\"]\n",
- " break\n",
+ " if deployment[\"status\"] != \"succeeded\":\n",
+ " continue\n",
+ " \n",
+ " model = openai.Model.retrieve(deployment[\"model\"])\n",
+ " if model[\"capabilities\"][\"embeddings\"] != True:\n",
+ " continue\n",
+ " \n",
+ " deployment_id = deployment[\"id\"]\n",
+ " break\n",
"\n",
"if not deployment_id:\n",
" print('No deployment with status: succeeded found.')\n",
"else:\n",
- " print(f'Found a successful deployment with id: {deployment_id}.')"
+ " print(f'Found a succeeded deployment that supports embeddings with id: {deployment_id}.')"
]
},
{