mirror of
https://github.com/james-m-jordan/openai-cookbook.git
synced 2025-05-09 19:32:38 +00:00
Update embeddings notebook
* Update api_version to 2022-12-01 * Fix some texts
This commit is contained in:
parent
838f000935
commit
7165609030
@ -6,7 +6,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"# Azure embeddings example\n",
|
"# 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",
|
"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",
|
"openai.api_base = '' # Please add your endpoint here\n",
|
||||||
"\n",
|
"\n",
|
||||||
"openai.api_type = 'azure'\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": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"## Deployments\n",
|
"## 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": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"### Deployments: Create Manually\n",
|
"### 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": {},
|
"metadata": {},
|
||||||
"outputs": [],
|
"outputs": [],
|
||||||
"source": [
|
"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",
|
"deployment_id = None\n",
|
||||||
"result = openai.Deployment.list()\n",
|
"result = openai.Deployment.list()\n",
|
||||||
"for deployment in result.data:\n",
|
"for deployment in result.data:\n",
|
||||||
" if deployment[\"status\"] == \"succeeded\":\n",
|
" if deployment[\"status\"] != \"succeeded\":\n",
|
||||||
" deployment_id = deployment[\"id\"]\n",
|
" continue\n",
|
||||||
" break\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",
|
"\n",
|
||||||
"if not deployment_id:\n",
|
"if not deployment_id:\n",
|
||||||
" print('No deployment with status: succeeded found.')\n",
|
" print('No deployment with status: succeeded found.')\n",
|
||||||
"else:\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}.')"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user