Examples and guides for using the OpenAI API
renames context_embeddings to document_embeddings
Ted Sanders25d641d21ff1
diff --git a/examples/Question_answering_using_embeddings.ipynb b/examples/Question_answering_using_embeddings.ipynbindex 85c265b8..71e30b51 100644--- a/examples/Question_answering_using_embeddings.ipynb+++ b/examples/Question_answering_using_embeddings.ipynb@@ -14,7 +14,7 @@},{"cell_type": "code",- "execution_count": 4,+ "execution_count": 1,"id": "9e3839a6-9146-4f60-b74b-19abbc24278d","metadata": {},"outputs": [],@@ -38,7 +38,7 @@},{"cell_type": "code",- "execution_count": 5,+ "execution_count": 2,"id": "a167516c-7c19-4bda-afa5-031aa0ae13bb","metadata": {},"outputs": [@@ -48,7 +48,7 @@"\"The 2020 Summer Olympics men's high jump was won by Mariusz Przybylski of Poland.\""]},- "execution_count": 5,+ "execution_count": 2,"metadata": {},"output_type": "execute_result"}@@ -83,7 +83,7 @@},{"cell_type": "code",- "execution_count": 6,+ "execution_count": 3,"id": "a5451371-17fe-4ef3-aa02-affcf4edb0e0","metadata": {},"outputs": [@@ -93,7 +93,7 @@"\"Sorry, I don't know.\""]},- "execution_count": 6,+ "execution_count": 3,"metadata": {},"output_type": "execute_result"}@@ -125,7 +125,7 @@},{"cell_type": "code",- "execution_count": 7,+ "execution_count": 4,"id": "fceaf665-2602-4788-bc44-9eb256a6f955","metadata": {},"outputs": [@@ -135,7 +135,7 @@"\"Gianmarco Tamberi and Mutaz Essa Barshim won the 2020 Summer Olympics men's high jump.\""]},- "execution_count": 7,+ "execution_count": 4,"metadata": {},"output_type": "execute_result"}@@ -200,7 +200,7 @@},{"cell_type": "code",- "execution_count": 8,+ "execution_count": 5,"id": "cc9c8d69-e234-48b4-87e3-935970e1523a","metadata": {},"outputs": [@@ -245,57 +245,58 @@" </thead>\n"," <tbody>\n"," <tr>\n",- " <th>Volleyball at the 2020 Summer Olympics – Women's tournament</th>\n",- " <th>Format</th>\n",- " <td>The preliminary round was a competition betwee...</td>\n",- " <td>132</td>\n",+ " <th>Nordic combined at the 2016 Winter Youth Olympics</th>\n",+ " <th>Summary</th>\n",+ " <td>Nordic combined at the 2016 Winter Youth Olymp...</td>\n",+ " <td>56</td>\n"," </tr>\n"," <tr>\n",- " <th>Rugby sevens at the 2020 Summer Olympics – Women's qualification</th>\n",- " <th>South America</th>\n",- " <td>Sudamérica Rugby held a tournament on 1–2 June...</td>\n",- " <td>56</td>\n",+ " <th>Morocco at the 2020 Summer Olympics</th>\n",+ " <th>Judo</th>\n",+ " <td>Morocco qualified two female judoka for each o...</td>\n",+ " <td>106</td>\n"," </tr>\n"," <tr>\n",- " <th rowspan=\"2\" valign=\"top\">Canoeing at the 2020 Summer Olympics – Men's slalom C-1</th>\n",- " <th>Competition format</th>\n",- " <td>Slalom canoeing uses a three-round format, wit...</td>\n",- " <td>136</td>\n",+ " <th>Guinea-Bissau at the 2020 Summer Olympics</th>\n",+ " <th>Wrestling</th>\n",+ " <td>Guinea-Bissau qualified two wrestlers for each...</td>\n",+ " <td>69</td>\n"," </tr>\n"," <tr>\n",- " <th>Qualification</th>\n",- " <td>A National Olympic Committee (NOC) entered onl...</td>\n",- " <td>171</td>\n",+ " <th>Rome bid for the 2020 Summer Olympics</th>\n",+ " <th>History</th>\n",+ " <td>The Italian National Olympic Committee (CONI) ...</td>\n",+ " <td>738</td>\n"," </tr>\n"," <tr>\n",- " <th>Tunisia at the 2020 Summer Olympics</th>\n",- " <th>Athletics</th>\n",- " <td>Tunisian athletes further achieved the entry s...</td>\n",- " <td>48</td>\n",+ " <th>Italy at the 2020 Summer Olympics</th>\n",+ " <th>Slalom</th>\n",+ " <td>Italian canoeists qualified one boat for each ...</td>\n",+ " <td>76</td>\n"," </tr>\n"," </tbody>\n","</table>\n","</div>"],"text/plain": [- " content \\\n",- "title heading \n",- "Volleyball at the 2020 Summer Olympics – Women'... Format The preliminary round was a competition betwee... \n",- "Rugby sevens at the 2020 Summer Olympics – Wome... South America Sudamérica Rugby held a tournament on 1–2 June... \n",- "Canoeing at the 2020 Summer Olympics – Men's sl... Competition format Slalom canoeing uses a three-round format, wit... \n",- " Qualification A National Olympic Committee (NOC) entered onl... \n",- "Tunisia at the 2020 Summer Olympics Athletics Tunisian athletes further achieved the entry s... \n",+ " content \\\n",+ "title heading \n",+ "Nordic combined at the 2016 Winter Youth Olympics Summary Nordic combined at the 2016 Winter Youth Olymp... \n",+ "Morocco at the 2020 Summer Olympics Judo Morocco qualified two female judoka for each o... \n",+ "Guinea-Bissau at the 2020 Summer Olympics Wrestling Guinea-Bissau qualified two wrestlers for each... \n",+ "Rome bid for the 2020 Summer Olympics History The Italian National Olympic Committee (CONI) ... \n",+ "Italy at the 2020 Summer Olympics Slalom Italian canoeists qualified one boat for each ... \n","\n",- " tokens \n",- "title heading \n",- "Volleyball at the 2020 Summer Olympics – Women'... Format 132 \n",- "Rugby sevens at the 2020 Summer Olympics – Wome... South America 56 \n",- "Canoeing at the 2020 Summer Olympics – Men's sl... Competition format 136 \n",- " Qualification 171 \n",- "Tunisia at the 2020 Summer Olympics Athletics 48 "+ " tokens \n",+ "title heading \n",+ "Nordic combined at the 2016 Winter Youth Olympics Summary 56 \n",+ "Morocco at the 2020 Summer Olympics Judo 106 \n",+ "Guinea-Bissau at the 2020 Summer Olympics Wrestling 69 \n",+ "Rome bid for the 2020 Summer Olympics History 738 \n",+ "Italy at the 2020 Summer Olympics Slalom 76 "]},- "execution_count": 8,+ "execution_count": 5,"metadata": {},"output_type": "execute_result"}@@ -324,7 +325,7 @@},{"cell_type": "code",- "execution_count": 9,+ "execution_count": 6,"id": "4b874907-5109-4eef-ad9a-add4367925a3","metadata": {},"outputs": [],@@ -337,7 +338,7 @@},{"cell_type": "code",- "execution_count": 10,+ "execution_count": 7,"id": "ba475f30-ef7f-431c-b60d-d5970b62ad09","metadata": {},"outputs": [],@@ -368,7 +369,7 @@},{"cell_type": "code",- "execution_count": 11,+ "execution_count": 8,"id": "737266aa-cbe7-4691-87c1-fce8a31632f1","metadata": {},"outputs": [],@@ -398,7 +399,7 @@},{"cell_type": "code",- "execution_count": 12,+ "execution_count": 9,"id": "ab50bfca-cb02-41c6-b338-4400abe1d86e","metadata": {},"outputs": [],@@ -412,7 +413,7 @@},{"cell_type": "code",- "execution_count": 13,+ "execution_count": 10,"id": "b9a8c713-c8a9-47dc-85a4-871ee1395566","metadata": {},"outputs": [@@ -446,7 +447,7 @@},{"cell_type": "code",- "execution_count": 14,+ "execution_count": 11,"id": "dcd680e9-f194-4180-b14f-fc357498eb92","metadata": {},"outputs": [],@@ -476,7 +477,7 @@},{"cell_type": "code",- "execution_count": 15,+ "execution_count": 12,"id": "e3a27d73-f47f-480d-b336-079414f749cb","metadata": {},"outputs": [@@ -495,7 +496,7 @@" (\"Athletics at the 2020 Summer Olympics – Women's long jump\", 'Summary'))]"]},- "execution_count": 15,+ "execution_count": 12,"metadata": {},"output_type": "execute_result"}@@ -506,7 +507,7 @@},{"cell_type": "code",- "execution_count": 16,+ "execution_count": 13,"id": "729c2ce7-8540-4ab2-bb3a-76c4dfcb689c","metadata": {},"outputs": [@@ -525,7 +526,7 @@" (\"Athletics at the 2020 Summer Olympics – Women's pole vault\", 'Summary'))]"]},- "execution_count": 16,+ "execution_count": 13,"metadata": {},"output_type": "execute_result"}@@ -554,7 +555,7 @@},{"cell_type": "code",- "execution_count": 18,+ "execution_count": 14,"id": "b763ace2-1946-48e0-8ff1-91ba335d47a0","metadata": {},"outputs": [@@ -564,7 +565,7 @@"'Context separator contains 3 tokens'"]},- "execution_count": 18,+ "execution_count": 14,"metadata": {},"output_type": "execute_result"}@@ -581,7 +582,7 @@},{"cell_type": "code",- "execution_count": 19,+ "execution_count": 15,"id": "0c5c0509-eeb9-4552-a5d4-6ace04ef73dd","metadata": {},"outputs": [],@@ -618,7 +619,7 @@},{"cell_type": "code",- "execution_count": 20,+ "execution_count": 16,"id": "f614045a-3917-4b28-9643-7e0c299ec1a7","metadata": {},"outputs": [@@ -670,7 +671,7 @@},{"cell_type": "code",- "execution_count": 21,+ "execution_count": 17,"id": "b0edfec7-9243-4573-92e0-253d31c771ad","metadata": {},"outputs": [],@@ -685,7 +686,7 @@},{"cell_type": "code",- "execution_count": 22,+ "execution_count": 18,"id": "9c1c9a69-848e-4099-a90d-c8da36c153d5","metadata": {},"outputs": [],@@ -715,7 +716,7 @@},{"cell_type": "code",- "execution_count": 24,+ "execution_count": 19,"id": "c233e449-bf33-4c9e-b095-6a4dd278c8fd","metadata": {},"outputs": [@@ -735,7 +736,7 @@"'Gianmarco Tamberi and Mutaz Essa Barshim emerged as joint winners of the event following a tie between both of them as they cleared 2.37m.'"]},- "execution_count": 24,+ "execution_count": 19,"metadata": {},"output_type": "execute_result"}@@ -760,7 +761,7 @@},{"cell_type": "code",- "execution_count": 27,+ "execution_count": 20,"id": "1127867b-2884-44bb-9439-0e8ae171c835","metadata": {},"outputs": [@@ -785,7 +786,7 @@},{"cell_type": "code",- "execution_count": 28,+ "execution_count": 21,"id": "720d9e0b-b189-4101-91ee-babf736199e6","metadata": {},"outputs": [@@ -810,7 +811,7 @@},{"cell_type": "code",- "execution_count": 29,+ "execution_count": 22,"id": "4e8e51cc-e4eb-4557-9e09-2929d4df5b7f","metadata": {},"outputs": [@@ -837,7 +838,7 @@},{"cell_type": "code",- "execution_count": 30,+ "execution_count": 23,"id": "37c83519-e3c6-4c44-8b4a-98cbb3a5f5ba","metadata": {},"outputs": [@@ -870,7 +871,7 @@},{"cell_type": "code",- "execution_count": 31,+ "execution_count": 24,"id": "26a1a9ef-e1ee-4f80-a1b1-6164ccfa5bac","metadata": {},"outputs": [@@ -897,7 +898,7 @@},{"cell_type": "code",- "execution_count": 32,+ "execution_count": 25,"id": "9fba8a63-eb81-4661-ae17-59bb5e2933d6","metadata": {},"outputs": [@@ -928,7 +929,7 @@},{"cell_type": "code",- "execution_count": 33,+ "execution_count": 26,"id": "2d4c693b-cdb9-4f4c-bd1b-f77b29097a1f","metadata": {},"outputs": [@@ -961,7 +962,7 @@],"metadata": {"kernelspec": {- "display_name": "Python 3 (ipykernel)",+ "display_name": "Python 3.9.9 ('openai')","language": "python","name": "python3"},@@ -976,6 +977,11 @@"nbconvert_exporter": "python","pygments_lexer": "ipython3","version": "3.9.9"+ },+ "vscode": {+ "interpreter": {+ "hash": "365536dcbde60510dc9073d6b991cd35db2d9bac356a11f5b64279a5e6708b97"+ }}},"nbformat": 4,