Skip to content

Examples and guides for using the OpenAI API

Adjust finetuning setup section

Christian Muertz3708c288340a
diff --git a/examples/azure/finetuning.ipynb b/examples/azure/finetuning.ipynb
index 23efca15..171863b7 100644
--- a/examples/azure/finetuning.ipynb
+++ b/examples/azure/finetuning.ipynb
@@ -24,7 +24,7 @@
"metadata": {},
"source": [
"## Setup\n",
- "In the following section the endpoint and key need to be set up of the next sections to work.<br> Please go to https://portal.azure.com, find your resource and then under \"Resource Management\" -> \"Keys and Endpoints\" look for the \"Endpoint\" value and one of the Keys. They will act as api_base and api_key in the code below."
+ "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."
]
},
{
@@ -33,19 +33,43 @@
"metadata": {},
"outputs": [],
"source": [
- "openai.api_key = '' # Please add your api key here\n",
- "openai.api_base = '' # Please add your endpoint here\n",
- "\n",
"openai.api_type = 'azure'\n",
- "openai.api_version = '2022-12-01'"
+ "openai.api_version = '2022-12-01'\n",
+ "\n",
+ "openai.api_base = '' # Please add your endpoint here"
+ ]
+ },
+ {
+ "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."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "### Setup: Portal\n",
+ "Let's first look at getting the key from the portal. Go to https://portal.azure.com, find your resource and then under \"Resource Management\" -> \"Keys and Endpoints\" look for one of the \"Keys\" values."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "openai.api_key = '' # Please add your api key here"
]
},
{
+ "attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
- "## Microsoft Active Directory Authentication\n",
- "Instead of key based authentication, you can use Active Directory to authenticate using credential tokens. Uncomment the next code section to use credential based authentication:"
+ "### (Optional) Setup: Microsoft Active Directory Authentication\n",
+ "Let's now see how we can get a key via Microsoft Active Directory Authentication."
]
},
{
@@ -60,12 +84,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",
- "openai.api_version = '2022-03-01-preview' # this may change in the future\n",
- "\n",
- "\n",
- "openai.api_base = '' # Please add your endpoint here\n",
"\"\"\""
]
},
@@ -450,7 +469,7 @@
],
"metadata": {
"kernelspec": {
- "display_name": "Python 3 (ipykernel)",
+ "display_name": "Python 3",
"language": "python",
"name": "python3"
},
@@ -464,11 +483,11 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
- "version": "3.8.10"
+ "version": "3.10.8"
},
"vscode": {
"interpreter": {
- "hash": "cb9817b186a29e4e9713184d901f26c1ee05ad25243d878baff7f31bb1fef480"
+ "hash": "3a5103089ab7e7c666b279eeded403fcec76de49a40685dbdfe9f9c78ad97c17"
}
}
},