Skip to content

Commit 7a8c0cf

Browse files
committed
Syntax Fixes
1 parent 672851b commit 7a8c0cf

File tree

1 file changed

+11
-64
lines changed

1 file changed

+11
-64
lines changed

Basic_Samples/Completions/basic_completions_example_sdk.ipynb

Lines changed: 11 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -15,50 +15,17 @@
1515
},
1616
{
1717
"cell_type": "code",
18-
"execution_count": 1,
18+
"execution_count": null,
1919
"id": "9d9a71de",
2020
"metadata": {},
21-
"outputs": [
22-
{
23-
"name": "stdout",
24-
"output_type": "stream",
25-
"text": [
26-
"Requirement already satisfied: openai in c:\\users\\henna\\documents\\github\\openai\\venv312\\lib\\site-packages (1.13.3)\n",
27-
"Requirement already satisfied: python-dotenv in c:\\users\\henna\\documents\\github\\openai\\venv312\\lib\\site-packages (1.0.1)\n",
28-
"Requirement already satisfied: anyio<5,>=3.5.0 in c:\\users\\henna\\documents\\github\\openai\\venv312\\lib\\site-packages (from openai) (4.3.0)\n",
29-
"Requirement already satisfied: distro<2,>=1.7.0 in c:\\users\\henna\\documents\\github\\openai\\venv312\\lib\\site-packages (from openai) (1.9.0)\n",
30-
"Requirement already satisfied: httpx<1,>=0.23.0 in c:\\users\\henna\\documents\\github\\openai\\venv312\\lib\\site-packages (from openai) (0.27.0)\n",
31-
"Requirement already satisfied: pydantic<3,>=1.9.0 in c:\\users\\henna\\documents\\github\\openai\\venv312\\lib\\site-packages (from openai) (2.6.3)\n",
32-
"Requirement already satisfied: sniffio in c:\\users\\henna\\documents\\github\\openai\\venv312\\lib\\site-packages (from openai) (1.3.1)\n",
33-
"Requirement already satisfied: tqdm>4 in c:\\users\\henna\\documents\\github\\openai\\venv312\\lib\\site-packages (from openai) (4.66.2)\n",
34-
"Requirement already satisfied: typing-extensions<5,>=4.7 in c:\\users\\henna\\documents\\github\\openai\\venv312\\lib\\site-packages (from openai) (4.10.0)\n",
35-
"Requirement already satisfied: idna>=2.8 in c:\\users\\henna\\documents\\github\\openai\\venv312\\lib\\site-packages (from anyio<5,>=3.5.0->openai) (3.6)\n",
36-
"Requirement already satisfied: certifi in c:\\users\\henna\\documents\\github\\openai\\venv312\\lib\\site-packages (from httpx<1,>=0.23.0->openai) (2024.2.2)\n",
37-
"Requirement already satisfied: httpcore==1.* in c:\\users\\henna\\documents\\github\\openai\\venv312\\lib\\site-packages (from httpx<1,>=0.23.0->openai) (1.0.4)\n",
38-
"Requirement already satisfied: h11<0.15,>=0.13 in c:\\users\\henna\\documents\\github\\openai\\venv312\\lib\\site-packages (from httpcore==1.*->httpx<1,>=0.23.0->openai) (0.14.0)\n",
39-
"Requirement already satisfied: annotated-types>=0.4.0 in c:\\users\\henna\\documents\\github\\openai\\venv312\\lib\\site-packages (from pydantic<3,>=1.9.0->openai) (0.6.0)\n",
40-
"Requirement already satisfied: pydantic-core==2.16.3 in c:\\users\\henna\\documents\\github\\openai\\venv312\\lib\\site-packages (from pydantic<3,>=1.9.0->openai) (2.16.3)\n",
41-
"Requirement already satisfied: colorama in c:\\users\\henna\\documents\\github\\openai\\venv312\\lib\\site-packages (from tqdm>4->openai) (0.4.6)\n",
42-
"Note: you may need to restart the kernel to use updated packages.\n"
43-
]
44-
},
45-
{
46-
"name": "stderr",
47-
"output_type": "stream",
48-
"text": [
49-
"\n",
50-
"[notice] A new release of pip is available: 23.2.1 -> 24.0\n",
51-
"[notice] To update, run: python.exe -m pip install --upgrade pip\n"
52-
]
53-
}
54-
],
21+
"outputs": [],
5522
"source": [
5623
"%pip install --upgrade openai python-dotenv"
5724
]
5825
},
5926
{
6027
"cell_type": "code",
61-
"execution_count": 2,
28+
"execution_count": 11,
6229
"id": "a92744f4",
6330
"metadata": {},
6431
"outputs": [
@@ -68,7 +35,7 @@
6835
"True"
6936
]
7037
},
71-
"execution_count": 2,
38+
"execution_count": 11,
7239
"metadata": {},
7340
"output_type": "execute_result"
7441
}
@@ -89,12 +56,12 @@
8956
"### Setup Parameters\n",
9057
"\n",
9158
"\n",
92-
"Here we will load the configurations from _config.json_ file to setup deployment name, openai api base, openai api key and openai api version."
59+
"Here we will read the environment variables from dotenv file to setup deployment name, openai api base, openai api key and openai api version."
9360
]
9461
},
9562
{
9663
"cell_type": "code",
97-
"execution_count": 3,
64+
"execution_count": 12,
9865
"id": "19ae1e36",
9966
"metadata": {},
10067
"outputs": [],
@@ -112,30 +79,18 @@
11279
"api_version = os.environ['OPENAI_API_VERSION']\n",
11380
"\n",
11481
"client = AzureOpenAI(\n",
115-
" api_key = api_key, \n",
116-
" azure_endpoint = azure_endpoint,\n",
117-
" api_version = api_version\n",
82+
" api_key=api_key, \n",
83+
" azure_endpoint=azure_endpoint,\n",
84+
" api_version=api_version\n",
11885
")"
11986
]
12087
},
12188
{
12289
"cell_type": "code",
123-
"execution_count": 4,
90+
"execution_count": null,
12491
"id": "b15862a1",
12592
"metadata": {},
126-
"outputs": [
127-
{
128-
"name": "stdout",
129-
"output_type": "stream",
130-
"text": [
131-
"!\"\n",
132-
"\n",
133-
"# def outer_func(original_string):\n",
134-
"# def inner_func(string):\n",
135-
"# nonlocal original\n"
136-
]
137-
}
138-
],
93+
"outputs": [],
13994
"source": [
14095
"# Give your prompt here\n",
14196
"prompt = \"Hello world\"\n",
@@ -183,14 +138,6 @@
183138
" # Handle API error here, e.g. retry or log\n",
184139
" print(f\"OpenAI API returned an API Error: {e}\")"
185140
]
186-
},
187-
{
188-
"cell_type": "code",
189-
"execution_count": null,
190-
"id": "b9be87b2",
191-
"metadata": {},
192-
"outputs": [],
193-
"source": []
194141
}
195142
],
196143
"metadata": {

0 commit comments

Comments
 (0)