mirror of
https://github.com/openai/openai-cookbook
synced 2024-11-15 18:13:18 +00:00
Fix completions notebook
This commit is contained in:
parent
7ce4de8467
commit
53a9891133
@ -6,7 +6,7 @@
|
|||||||
"source": [
|
"source": [
|
||||||
"# Azure completions example\n",
|
"# 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",
|
"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",
|
"from azure.identity import DefaultAzureCredential\n",
|
||||||
"\n",
|
"\n",
|
||||||
"default_credential = DefaultAzureCredential()\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",
|
"\n",
|
||||||
"openai.api_key = token.token\n",
|
"openai.api_key = token.token\n",
|
||||||
"\"\"\""
|
"\"\"\""
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"attachments": {},
|
||||||
"cell_type": "markdown",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"## Deployments\n",
|
"## 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",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"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."
|
"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",
|
"cell_type": "markdown",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"### (Optional) Deployments: Create Programatically\n",
|
"### (Optional) Deployments: Create programatically\n",
|
||||||
"We can also create a deployment using code:"
|
"We can also create a deployment using code:"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -122,7 +125,8 @@
|
|||||||
"# Now let's create the deployment\n",
|
"# Now let's create the deployment\n",
|
||||||
"print(f'Creating a new deployment with model: {model}')\n",
|
"print(f'Creating a new deployment with model: {model}')\n",
|
||||||
"result = openai.Deployment.create(model=model, scale_settings={\"scale_type\":\"standard\"})\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",
|
"name": "python",
|
||||||
"nbconvert_exporter": "python",
|
"nbconvert_exporter": "python",
|
||||||
"pygments_lexer": "ipython3",
|
"pygments_lexer": "ipython3",
|
||||||
"version": "3.8.10"
|
"version": "3.10.8"
|
||||||
},
|
},
|
||||||
"vscode": {
|
"vscode": {
|
||||||
"interpreter": {
|
"interpreter": {
|
||||||
|
Loading…
Reference in New Issue
Block a user