Skip to content

Examples and guides for using the OpenAI API

Fix setup sections

Christian Muertz0bd2dcfa5ce2
diff --git a/examples/azure/completions.ipynb b/examples/azure/completions.ipynb
index f5ba33b2..b1cf30f9 100644
--- a/examples/azure/completions.ipynb
+++ b/examples/azure/completions.ipynb
@@ -24,7 +24,7 @@
"metadata": {},
"source": [
"## Setup\n",
- "For the following sections to work properly we first have to setup some things. Let's start with the `api_type`, `api_base` and `api_version`. To find your `api_base` go to https://portal.azure.com, find your resource and then under \"Resource Management\" -> \"Keys and Endpoints\" look for the \"Endpoint\" value."
+ "For the following sections to work properly we first have to setup some things. Let's start with the `api_base` and `api_version`. To find your `api_base` go to https://portal.azure.com, find your resource and then under \"Resource Management\" -> \"Keys and Endpoints\" look for the \"Endpoint\" value."
]
},
{
@@ -33,9 +33,7 @@
"metadata": {},
"outputs": [],
"source": [
- "openai.api_type = 'azure'\n",
"openai.api_version = '2022-12-01'\n",
- "\n",
"openai.api_base = '' # Please add your endpoint here"
]
},
@@ -43,7 +41,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "We next have to setup the `api_key`. We can either get the key from the portal or we can get it through Microsoft Active Directory Authentication."
+ "We next have to setup the `api_type` and `api_key`. We can either get the key from the portal or we can get it through Microsoft Active Directory Authentication. Depending on this the `api_type` is either `azure` or `azure_ad`."
]
},
{
@@ -60,6 +58,7 @@
"metadata": {},
"outputs": [],
"source": [
+ "openai.api_type = 'azure'\n",
"openai.api_key = '' # Please add your api key here"
]
},
@@ -83,6 +82,7 @@
"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",
"\"\"\""
]
diff --git a/examples/azure/embeddings.ipynb b/examples/azure/embeddings.ipynb
index 5bd77614..f7729e72 100644
--- a/examples/azure/embeddings.ipynb
+++ b/examples/azure/embeddings.ipynb
@@ -21,11 +21,12 @@
]
},
{
+ "attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## Setup\n",
- "For the following sections to work properly we first have to setup some things. Let's start with the `api_type`, `api_base` and `api_version`. To find your `api_base` go to https://portal.azure.com, find your resource and then under \"Resource Management\" -> \"Keys and Endpoints\" look for the \"Endpoint\" value."
+ "For the following sections to work properly we first have to setup some things. Let's start with the `api_base` and `api_version`. To find your `api_base` go to https://portal.azure.com, find your resource and then under \"Resource Management\" -> \"Keys and Endpoints\" look for the \"Endpoint\" value."
]
},
{
@@ -34,9 +35,7 @@
"metadata": {},
"outputs": [],
"source": [
- "openai.api_type = 'azure'\n",
"openai.api_version = '2022-12-01'\n",
- "\n",
"openai.api_base = '' # Please add your endpoint here"
]
},
@@ -45,7 +44,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "We next have to setup the `api_key`. We can either get the key from the portal or we can get it through Microsoft Active Directory Authentication."
+ "We next have to setup the `api_type` and `api_key`. We can either get the key from the portal or we can get it through Microsoft Active Directory Authentication. Depending on this the `api_type` is either `azure` or `azure_ad`."
]
},
{
@@ -63,6 +62,7 @@
"metadata": {},
"outputs": [],
"source": [
+ "openai.api_type = 'azure'\n",
"openai.api_key = '' # Please add your api key here"
]
},
@@ -87,6 +87,7 @@
"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",
"\"\"\""
]
diff --git a/examples/azure/finetuning.ipynb b/examples/azure/finetuning.ipynb
index 171863b7..3f6ed662 100644
--- a/examples/azure/finetuning.ipynb
+++ b/examples/azure/finetuning.ipynb
@@ -6,7 +6,7 @@
"source": [
"# Azure Fine tuning example\n",
"In this example we'll try to go over all operations that can be done using the Azure endpoints and their differences with the openAi endpoints (if any).<br>\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 finetune model adaptation tutorial.\n"
+ "This example focuses on finetuning but also touches on the majority of operations that are available using the API. This example is meant to be a quick way of showing simple operations and is not meant as a finetune model adaptation tutorial.\n"
]
},
{
@@ -24,7 +24,7 @@
"metadata": {},
"source": [
"## Setup\n",
- "For the following sections to work properly we first have to setup some things. Let's start with the `api_type`, `api_base` and `api_version`. To find your `api_base` go to https://portal.azure.com, find your resource and then under \"Resource Management\" -> \"Keys and Endpoints\" look for the \"Endpoint\" value."
+ "For the following sections to work properly we first have to setup some things. Let's start with the `api_base` and `api_version`. To find your `api_base` go to https://portal.azure.com, find your resource and then under \"Resource Management\" -> \"Keys and Endpoints\" look for the \"Endpoint\" value."
]
},
{
@@ -33,9 +33,7 @@
"metadata": {},
"outputs": [],
"source": [
- "openai.api_type = 'azure'\n",
"openai.api_version = '2022-12-01'\n",
- "\n",
"openai.api_base = '' # Please add your endpoint here"
]
},
@@ -43,7 +41,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
- "We next have to setup the `api_key`. We can either get the key from the portal or we can get it through Microsoft Active Directory Authentication."
+ "We next have to setup the `api_type` and `api_key`. We can either get the key from the portal or we can get it through Microsoft Active Directory Authentication. Depending on this the `api_type` is either `azure` or `azure_ad`."
]
},
{
@@ -60,6 +58,7 @@
"metadata": {},
"outputs": [],
"source": [
+ "openai.api_type = 'azure'\n",
"openai.api_key = '' # Please add your api key here"
]
},
@@ -84,6 +83,7 @@
"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",
"\"\"\""
]