examples

Форк
0
2562 строки · 109.2 Кб
1
{
2
  "cells": [
3
    {
4
      "attachments": {},
5
      "cell_type": "markdown",
6
      "metadata": {},
7
      "source": [
8
        "[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/pinecone-io/examples/blob/master/learn/generation/chatbots/conversational-agents/langchain-lex-agent.ipynb) [![Open nbviewer](https://raw.githubusercontent.com/pinecone-io/examples/master/assets/nbviewer-shield.svg)](https://nbviewer.org/github/pinecone-io/examples/blob/master/learn/generation/chatbots/conversational-agents/langchain-lex-agent.ipynb)\n",
9
        "\n",
10
        "# Ask Lex Agent\n",
11
        "\n",
12
        "**Note**: This notebook is not free to run, you will need to create ~20K OpenAI `text-embedding-ada-002` embedding which do cost money. The Pinecone index can be run within the free tier."
13
      ]
14
    },
15
    {
16
      "cell_type": "code",
17
      "execution_count": null,
18
      "metadata": {
19
        "colab": {
20
          "base_uri": "https://localhost:8080/"
21
        },
22
        "id": "pADty8WtkcGq",
23
        "outputId": "84ea61c2-6151-43c5-b97f-709ff205c43c"
24
      },
25
      "outputs": [
26
        {
27
          "name": "stdout",
28
          "output_type": "stream",
29
          "text": [
30
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m468.7/468.7 KB\u001b[0m \u001b[31m10.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
31
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m177.2/177.2 KB\u001b[0m \u001b[31m24.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
32
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m472.9/472.9 KB\u001b[0m \u001b[31m45.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
33
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m70.2/70.2 KB\u001b[0m \u001b[31m11.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
34
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m212.2/212.2 KB\u001b[0m \u001b[31m22.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
35
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.0/1.0 MB\u001b[0m \u001b[31m57.9 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
36
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m132.9/132.9 KB\u001b[0m \u001b[31m22.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
37
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m110.5/110.5 KB\u001b[0m \u001b[31m17.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
38
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m199.8/199.8 KB\u001b[0m \u001b[31m28.7 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
39
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m57.2/57.2 KB\u001b[0m \u001b[31m9.2 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
40
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m443.2/443.2 KB\u001b[0m \u001b[31m48.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
41
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.7/1.7 MB\u001b[0m \u001b[31m85.3 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
42
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m58.3/58.3 KB\u001b[0m \u001b[31m9.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
43
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m283.7/283.7 KB\u001b[0m \u001b[31m38.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
44
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.3/1.3 MB\u001b[0m \u001b[31m81.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
45
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m1.1/1.1 MB\u001b[0m \u001b[31m80.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
46
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m4.5/4.5 MB\u001b[0m \u001b[31m113.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
47
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m264.6/264.6 KB\u001b[0m \u001b[31m35.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
48
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m114.2/114.2 KB\u001b[0m \u001b[31m18.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
49
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m158.8/158.8 KB\u001b[0m \u001b[31m21.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
50
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m49.1/49.1 KB\u001b[0m \u001b[31m8.1 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
51
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m223.0/223.0 KB\u001b[0m \u001b[31m30.4 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
52
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m218.0/218.0 KB\u001b[0m \u001b[31m29.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
53
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m218.0/218.0 KB\u001b[0m \u001b[31m19.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
54
            "\u001b[2K     \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m211.7/211.7 KB\u001b[0m \u001b[31m25.0 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n",
55
            "\u001b[?25h\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
56
            "tensorflow 2.12.0 requires protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.20.3, but you have protobuf 3.19.3 which is incompatible.\n",
57
            "tensorflow-hub 0.13.0 requires protobuf>=3.19.6, but you have protobuf 3.19.3 which is incompatible.\n",
58
            "tensorboard 2.12.0 requires protobuf>=3.19.6, but you have protobuf 3.19.3 which is incompatible.\n",
59
            "google-cloud-translate 3.8.4 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 3.19.3 which is incompatible.\n",
60
            "google-cloud-language 2.6.1 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 3.19.3 which is incompatible.\n",
61
            "google-cloud-firestore 2.7.3 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 3.19.3 which is incompatible.\n",
62
            "google-cloud-datastore 2.11.1 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 3.19.3 which is incompatible.\n",
63
            "google-cloud-bigquery 3.4.2 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 3.19.3 which is incompatible.\n",
64
            "google-cloud-bigquery-storage 2.19.1 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 3.19.3 which is incompatible.\n",
65
            "google-api-core 2.11.0 requires protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.19.5, but you have protobuf 3.19.3 which is incompatible.\u001b[0m\u001b[31m\n",
66
            "\u001b[0m"
67
          ]
68
        }
69
      ],
70
      "source": [
71
        "!pip install -qU datasets pod-gpt pinecone-client[grpc] langchain openai tqdm"
72
      ]
73
    },
74
    {
75
      "attachments": {},
76
      "cell_type": "markdown",
77
      "metadata": {
78
        "id": "nYzuZiAP5HGL"
79
      },
80
      "source": [
81
        "Set api keys, etc:"
82
      ]
83
    },
84
    {
85
      "cell_type": "code",
86
      "execution_count": null,
87
      "metadata": {
88
        "id": "f1R8X32-41vc"
89
      },
90
      "outputs": [],
91
      "source": [
92
        "OPENAI_API_KEY = \"OPENAI_API_KEY\"  # platform.openai.com\n",
93
        "PINECONE_API_KEY = \"PINECONE_API_KEY\"  # app.pinecone.io\n",
94
        "PINECONE_ENV = \"PINECONE_ENV\""
95
      ]
96
    },
97
    {
98
      "attachments": {},
99
      "cell_type": "markdown",
100
      "metadata": {
101
        "id": "4RYCg6ep4L0p"
102
      },
103
      "source": [
104
        "First we download a prebuilt Lex Fridman podcast transcriptions dataset:"
105
      ]
106
    },
107
    {
108
      "cell_type": "code",
109
      "execution_count": null,
110
      "metadata": {
111
        "colab": {
112
          "base_uri": "https://localhost:8080/",
113
          "height": 257,
114
          "referenced_widgets": [
115
            "7b42a94359514a719c0127c8189715cc",
116
            "4e96c7ec4451480880d3b929020391c0",
117
            "2fe7c9aa8eac4b6d940d1b5ca3ec8f6f",
118
            "5d73ff213fe245ae8d135637051f03f6",
119
            "2ccd4caaab4a49809fd35475598933a0",
120
            "ae281774279e4a5683fb1c9b0e6286ed",
121
            "696ca9ac01a0406db8f749feee7cabba",
122
            "727c6aebc5c5440eb11ede9f5e2724c6",
123
            "9f91876585664ee29c98396a124346a7",
124
            "1045152b762f42e1898c631bad17e51f",
125
            "b1ffc13351ef4cfea9cbb52f342fa968",
126
            "3adead4a90ec4ced88e43102b8a7f3d3",
127
            "974e1cf773af45b4b496aad741e1e06a",
128
            "1cf4fbdd7f534f21a6e7779b735e4661",
129
            "19962721d6874153823840898d3cd8a0",
130
            "fce282dc88c44c7d9403ac066891f025",
131
            "be4361412b1243eaad79958bd0502d0b",
132
            "4387ccd1c9454888b8c0f532a0868d1b",
133
            "05f84d46a178401e94a8c79410bca1bb",
134
            "672941e696a2470c90733103473f183f",
135
            "9241719b307142bba0a5c6ce6194d3ad",
136
            "bf9b362011314503b064412f66f8e51f",
137
            "74ed392c1fc04b4687a9b984b67f1873",
138
            "437a5c91bcb047bd80ea5addbc23d900",
139
            "282743ec58ca4149b273fa069d3f1eb4",
140
            "3d9ff73e38de440a987ee67c733ad94b",
141
            "4be5272d6dad4d77afe296f45d651229",
142
            "66901c729a284ee7ab032df3cedd06be",
143
            "b59a844fd64a4bd6a28d6cf17aaece29",
144
            "3918176c5f6849e4b94f53e5461fcfc5",
145
            "f3fba8e406da4f5799725869a50b0660",
146
            "0daf637b59d54d08acf7f89d7b9603bb",
147
            "265f722d84db43b98df36346444d5e8e",
148
            "c7763f4356714d558701b54485039613",
149
            "d6c342c5d7594c07bf546143adde3f2d",
150
            "5a35182953dd4c4c9e4db151dc2fce2c",
151
            "cd138a72677b4d0abbbaa4a0161ac999",
152
            "76f7d8b0c51742d7808f8297653adb48",
153
            "6f530ecab4a14a299a8572923c8df4eb",
154
            "d7b86543a6d649328e848c2a284aca92",
155
            "b5cf4013a0d441a69ea16ff14f44e4c4",
156
            "71786e1530544f72856ffbd26ec01160",
157
            "846e801ba51b451b930b5ceb801ee080",
158
            "649a542ce0284222a7229db6f6b99f03"
159
          ]
160
        },
161
        "id": "2AT6IR3t4Rcl",
162
        "outputId": "49e6216a-306f-48da-f407-8f13cd718385"
163
      },
164
      "outputs": [
165
        {
166
          "name": "stdout",
167
          "output_type": "stream",
168
          "text": [
169
            "Downloading and preparing dataset json/jamescalam--lex-transcripts to /root/.cache/huggingface/datasets/jamescalam___json/jamescalam--lex-transcripts-a6ef9b24c11dc3c4/0.0.0/fe5dd6ea2639a6df622901539cb550cf8797e5a6b2dd7af1cf934bed8e233e6e...\n"
170
          ]
171
        },
172
        {
173
          "data": {
174
            "application/vnd.jupyter.widget-view+json": {
175
              "model_id": "7b42a94359514a719c0127c8189715cc",
176
              "version_major": 2,
177
              "version_minor": 0
178
            },
179
            "text/plain": [
180
              "Downloading data files:   0%|          | 0/1 [00:00<?, ?it/s]"
181
            ]
182
          },
183
          "metadata": {},
184
          "output_type": "display_data"
185
        },
186
        {
187
          "data": {
188
            "application/vnd.jupyter.widget-view+json": {
189
              "model_id": "3adead4a90ec4ced88e43102b8a7f3d3",
190
              "version_major": 2,
191
              "version_minor": 0
192
            },
193
            "text/plain": [
194
              "Downloading data:   0%|          | 0.00/6.99M [00:00<?, ?B/s]"
195
            ]
196
          },
197
          "metadata": {},
198
          "output_type": "display_data"
199
        },
200
        {
201
          "data": {
202
            "application/vnd.jupyter.widget-view+json": {
203
              "model_id": "74ed392c1fc04b4687a9b984b67f1873",
204
              "version_major": 2,
205
              "version_minor": 0
206
            },
207
            "text/plain": [
208
              "Extracting data files:   0%|          | 0/1 [00:00<?, ?it/s]"
209
            ]
210
          },
211
          "metadata": {},
212
          "output_type": "display_data"
213
        },
214
        {
215
          "data": {
216
            "application/vnd.jupyter.widget-view+json": {
217
              "model_id": "c7763f4356714d558701b54485039613",
218
              "version_major": 2,
219
              "version_minor": 0
220
            },
221
            "text/plain": [
222
              "Generating train split: 0 examples [00:00, ? examples/s]"
223
            ]
224
          },
225
          "metadata": {},
226
          "output_type": "display_data"
227
        },
228
        {
229
          "name": "stdout",
230
          "output_type": "stream",
231
          "text": [
232
            "Dataset json downloaded and prepared to /root/.cache/huggingface/datasets/jamescalam___json/jamescalam--lex-transcripts-a6ef9b24c11dc3c4/0.0.0/fe5dd6ea2639a6df622901539cb550cf8797e5a6b2dd7af1cf934bed8e233e6e. Subsequent calls will reuse this data.\n"
233
          ]
234
        },
235
        {
236
          "data": {
237
            "text/plain": [
238
              "Dataset({\n",
239
              "    features: ['video_id', 'channel_id', 'title', 'published', 'transcript', 'source'],\n",
240
              "    num_rows: 98\n",
241
              "})"
242
            ]
243
          },
244
          "execution_count": 5,
245
          "metadata": {},
246
          "output_type": "execute_result"
247
        }
248
      ],
249
      "source": [
250
        "from datasets import load_dataset\n",
251
        "\n",
252
        "data = load_dataset(\n",
253
        "    'jamescalam/lex-transcripts',\n",
254
        "    split='train'\n",
255
        ")\n",
256
        "data"
257
      ]
258
    },
259
    {
260
      "attachments": {},
261
      "cell_type": "markdown",
262
      "metadata": {
263
        "id": "nG7-U4xC4rcE"
264
      },
265
      "source": [
266
        "Initialize the `indexer` object."
267
      ]
268
    },
269
    {
270
      "cell_type": "code",
271
      "execution_count": null,
272
      "metadata": {
273
        "id": "imF-Jxft4QjJ"
274
      },
275
      "outputs": [],
276
      "source": [
277
        "import pod_gpt\n",
278
        "\n",
279
        "indexer = pod_gpt.Indexer(\n",
280
        "    openai_api_key=OPENAI_API_KEY,\n",
281
        "    pinecone_api_key=PINECONE_API_KEY,\n",
282
        "    pinecone_environment=PINECONE_ENV,\n",
283
        "    index_name=\"pod-gpt\"\n",
284
        ")"
285
      ]
286
    },
287
    {
288
      "cell_type": "code",
289
      "execution_count": null,
290
      "metadata": {
291
        "id": "7P9Cqb_Z4RSZ"
292
      },
293
      "outputs": [],
294
      "source": [
295
        "from tqdm.auto import tqdm\n",
296
        "\n",
297
        "for row in data:\n",
298
        "    row['published'] = row['published'].strftime('%Y%m%d')\n",
299
        "    indexer(pod_gpt.VideoRecord(**row))"
300
      ]
301
    },
302
    {
303
      "cell_type": "code",
304
      "execution_count": null,
305
      "metadata": {
306
        "id": "y338927dkxlY"
307
      },
308
      "outputs": [],
309
      "source": [
310
        "from pinecone import Pinecone\n",
311
        "\n",
312
        "pinecone.init(\n",
313
        "    api_key=PINECONE_API_KEY,  # app.pinecone.io\n",
314
        "    environment=PINECONE_ENV  # next to API key in console\n",
315
        ")\n",
316
        "\n",
317
        "index_name = \"pod-gpt\"\n",
318
        "\n",
319
        "if index_name not in pinecone.list_indexes().names():\n",
320
        "    raise ValueError(\n",
321
        "        f\"No '{index_name}' index exists. You must create the index before \"\n",
322
        "        \"running this notebook. Please refer to the walkthrough at \"\n",
323
        "        \"'github.com/pinecone-io/examples'.\"  # TODO add full link\n",
324
        "    )\n",
325
        "\n",
326
        "index = pinecone.Index(index_name)"
327
      ]
328
    },
329
    {
330
      "attachments": {},
331
      "cell_type": "markdown",
332
      "metadata": {
333
        "id": "gFTiO7eX2mkN"
334
      },
335
      "source": [
336
        "Initialize the retrieval components (embedding model and vector DB)"
337
      ]
338
    },
339
    {
340
      "cell_type": "code",
341
      "execution_count": null,
342
      "metadata": {
343
        "id": "GPvqFFGXcFGF"
344
      },
345
      "outputs": [],
346
      "source": [
347
        "from langchain.embeddings.openai import OpenAIEmbeddings\n",
348
        "from langchain.vectorstores import Pinecone\n",
349
        "\n",
350
        "embeddings = OpenAIEmbeddings(openai_api_key=OPENAI_API_KEY)\n",
351
        "\n",
352
        "vectordb = Pinecone(\n",
353
        "    index=index,\n",
354
        "    embedding_function=embeddings.embed_query,\n",
355
        "    text_key=\"text\"\n",
356
        ")"
357
      ]
358
    },
359
    {
360
      "attachments": {},
361
      "cell_type": "markdown",
362
      "metadata": {
363
        "id": "bPFXYJE92mNm"
364
      },
365
      "source": [
366
        "Initialize `gpt-3.5-turbo` chat model:"
367
      ]
368
    },
369
    {
370
      "cell_type": "code",
371
      "execution_count": null,
372
      "metadata": {
373
        "id": "jESRtKeJk1IO"
374
      },
375
      "outputs": [],
376
      "source": [
377
        "from langchain.chat_models import ChatOpenAI\n",
378
        "\n",
379
        "llm=ChatOpenAI(\n",
380
        "    openai_api_key=OPENAI_API_KEY,\n",
381
        "    temperature=0,\n",
382
        "    model_name='gpt-3.5-turbo'\n",
383
        ")"
384
      ]
385
    },
386
    {
387
      "attachments": {},
388
      "cell_type": "markdown",
389
      "metadata": {
390
        "id": "y7isHNe1Gtp_"
391
      },
392
      "source": [
393
        "We then initialize the QA retrieval object using our `llm` and the `vectordb.as_retriever()`:"
394
      ]
395
    },
396
    {
397
      "cell_type": "code",
398
      "execution_count": null,
399
      "metadata": {
400
        "id": "PkTHIAE47uJp"
401
      },
402
      "outputs": [],
403
      "source": [
404
        "from langchain.chains import RetrievalQA\n",
405
        "\n",
406
        "retriever = RetrievalQA.from_chain_type(\n",
407
        "    llm=llm,\n",
408
        "    chain_type=\"stuff\",\n",
409
        "    retriever=vectordb.as_retriever()\n",
410
        ")"
411
      ]
412
    },
413
    {
414
      "attachments": {},
415
      "cell_type": "markdown",
416
      "metadata": {
417
        "id": "NtaTKxTJG7J8"
418
      },
419
      "source": [
420
        "One additional thing we have here is the `chain_type=\"stuff\"`. There are two options here, `\"stuff\"` or `\"map_reduce\"`. The `map_reduce` option essentially summarizes returned documents, whereas the `stuff` option just returns the retrieved documents as is.\n",
421
        "\n",
422
        "The `retriever` is ready and can be used by us like this. However, we need to convert it into a `Tool` to be used by our conversational agent. To do that we need the `retriever` itself, a tool description, and a tool name. We use these to initialize the tool like so:"
423
      ]
424
    },
425
    {
426
      "cell_type": "code",
427
      "execution_count": null,
428
      "metadata": {
429
        "id": "rEQEdRQRmCbO"
430
      },
431
      "outputs": [],
432
      "source": [
433
        "tool_desc = \"\"\"Use this tool to answer user questions using Lex\n",
434
        "Fridman podcasts. If the user states 'ask Lex' use this tool to get\n",
435
        "the answer. This tool can also be used for follow up questions from\n",
436
        "the user.\"\"\""
437
      ]
438
    },
439
    {
440
      "cell_type": "code",
441
      "execution_count": null,
442
      "metadata": {
443
        "id": "abClSi8GlC8O"
444
      },
445
      "outputs": [],
446
      "source": [
447
        "from langchain.agents import Tool\n",
448
        "\n",
449
        "tools = [Tool(\n",
450
        "    func=retriever.run,\n",
451
        "    description=tool_desc,\n",
452
        "    name='Lex Fridman DB'\n",
453
        ")]"
454
      ]
455
    },
456
    {
457
      "attachments": {},
458
      "cell_type": "markdown",
459
      "metadata": {
460
        "id": "T9o6IIHSHwVX"
461
      },
462
      "source": [
463
        "With that, we're ready to initialize the conversational agent. As it is a *conversational* agent, it does need some form of [conversational memory](https://www.pinecone.io/learn/langchain-conversational-memory/). For this we will use the `ConversationBufferWindowMemory` option, which will *remember* the previous `k` interactions between the user and the AI."
464
      ]
465
    },
466
    {
467
      "cell_type": "code",
468
      "execution_count": null,
469
      "metadata": {
470
        "id": "L_CRqHPrmcHo"
471
      },
472
      "outputs": [],
473
      "source": [
474
        "from langchain.chains.conversation.memory import ConversationBufferWindowMemory\n",
475
        "\n",
476
        "memory = ConversationBufferWindowMemory(\n",
477
        "    memory_key=\"chat_history\",  # important to align with agent prompt (below)\n",
478
        "    k=5,\n",
479
        "    return_messages=True\n",
480
        ")"
481
      ]
482
    },
483
    {
484
      "cell_type": "code",
485
      "execution_count": null,
486
      "metadata": {
487
        "id": "ArdEDGH7nBRR"
488
      },
489
      "outputs": [],
490
      "source": [
491
        "from langchain.agents import initialize_agent\n",
492
        "\n",
493
        "conversational_agent = initialize_agent(\n",
494
        "    agent='chat-conversational-react-description', \n",
495
        "    tools=tools, \n",
496
        "    llm=llm,\n",
497
        "    verbose=True,\n",
498
        "    max_iterations=2,\n",
499
        "    early_stopping_method=\"generate\",\n",
500
        "    memory=memory,\n",
501
        ")"
502
      ]
503
    },
504
    {
505
      "attachments": {},
506
      "cell_type": "markdown",
507
      "metadata": {
508
        "id": "f8EkS7lG3ElB"
509
      },
510
      "source": [
511
        "Important items in `agent` parameter:\n",
512
        "\n",
513
        "* `chat-conversational`: for chatbots with conversational memory.\n",
514
        "* `react`: refers to the ReAct framework.\n",
515
        "* `description`: because the LLM relies on the tool description to decide which tool to use.\n",
516
        "\n",
517
        "### Conversational Agent Prompt\n",
518
        "\n",
519
        "The prompt of the conversational agent is fairly complex. Let's create it then break it down."
520
      ]
521
    },
522
    {
523
      "cell_type": "code",
524
      "execution_count": null,
525
      "metadata": {
526
        "colab": {
527
          "base_uri": "https://localhost:8080/"
528
        },
529
        "id": "m1ApK_bkBOQ7",
530
        "outputId": "e031864e-22db-41f8-a8db-c16d096ee3fc"
531
      },
532
      "outputs": [
533
        {
534
          "data": {
535
            "text/plain": [
536
              "ChatPromptTemplate(input_variables=['input', 'chat_history', 'agent_scratchpad'], output_parser=None, partial_variables={}, messages=[SystemMessagePromptTemplate(prompt=PromptTemplate(input_variables=[], output_parser=None, partial_variables={}, template='Assistant is a large language model trained by OpenAI.\\n\\nAssistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand.\\n\\nAssistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics.\\n\\nOverall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist.', template_format='f-string', validate_template=True), additional_kwargs={}), MessagesPlaceholder(variable_name='chat_history'), HumanMessagePromptTemplate(prompt=PromptTemplate(input_variables=['input'], output_parser=None, partial_variables={}, template='TOOLS\\n------\\nAssistant can ask the user to use tools to look up information that may be helpful in answering the users original question. The tools the human can use are:\\n\\n> Lex Fridman DB: Use this tool to answer user questions using Lex\\nFridman podcasts. If the user states \\'ask Lex\\' use this tool to get\\nthe answer. This tool can also be used for follow up questions from\\nthe user.\\n\\nRESPONSE FORMAT INSTRUCTIONS\\n----------------------------\\n\\nWhen responding to me please, please output a response in one of two formats:\\n\\n**Option 1:**\\nUse this if you want the human to use a tool.\\nMarkdown code snippet formatted in the following schema:\\n\\n```json\\n{{\\n    \"action\": string \\\\ The action to take. Must be one of Lex Fridman DB\\n    \"action_input\": string \\\\ The input to the action\\n}}\\n```\\n\\n**Option #2:**\\nUse this if you want to respond directly to the human. Markdown code snippet formatted in the following schema:\\n\\n```json\\n{{\\n    \"action\": \"Final Answer\",\\n    \"action_input\": string \\\\ You should put what you want to return to use here\\n}}\\n```\\n\\nUSER\\'S INPUT\\n--------------------\\nHere is the user\\'s input (remember to respond with a markdown code snippet of a json blob with a single action, and NOTHING else):\\n\\n{input}', template_format='f-string', validate_template=True), additional_kwargs={}), MessagesPlaceholder(variable_name='agent_scratchpad')])"
537
            ]
538
          },
539
          "execution_count": 43,
540
          "metadata": {},
541
          "output_type": "execute_result"
542
        }
543
      ],
544
      "source": [
545
        "conversational_agent.agent.llm_chain.prompt"
546
      ]
547
    },
548
    {
549
      "cell_type": "code",
550
      "execution_count": null,
551
      "metadata": {
552
        "id": "ISOscagrnDyD"
553
      },
554
      "outputs": [],
555
      "source": [
556
        "sys_msg = \"\"\"You are a helpful chatbot that answers the user's questions.\n",
557
        "\"\"\"\n",
558
        "\n",
559
        "prompt = conversational_agent.agent.create_prompt(\n",
560
        "    system_message=sys_msg,\n",
561
        "    tools=tools\n",
562
        ")\n",
563
        "conversational_agent.agent.llm_chain.prompt = prompt"
564
      ]
565
    },
566
    {
567
      "attachments": {},
568
      "cell_type": "markdown",
569
      "metadata": {
570
        "id": "Ezpd5vaOMC-w"
571
      },
572
      "source": [
573
        "We can see the prompt template like so:"
574
      ]
575
    },
576
    {
577
      "cell_type": "code",
578
      "execution_count": null,
579
      "metadata": {
580
        "colab": {
581
          "base_uri": "https://localhost:8080/"
582
        },
583
        "id": "lvEAE9XKMFIR",
584
        "outputId": "5083e1c7-f8db-4e0d-b4a8-c567efccd525"
585
      },
586
      "outputs": [
587
        {
588
          "data": {
589
            "text/plain": [
590
              "ChatPromptTemplate(input_variables=['input', 'chat_history', 'agent_scratchpad'], output_parser=None, partial_variables={}, messages=[SystemMessagePromptTemplate(prompt=PromptTemplate(input_variables=[], output_parser=None, partial_variables={}, template=\"You are a helpful chatbot that answers the user's questions.\\n\", template_format='f-string', validate_template=True), additional_kwargs={}), MessagesPlaceholder(variable_name='chat_history'), HumanMessagePromptTemplate(prompt=PromptTemplate(input_variables=['input'], output_parser=None, partial_variables={}, template='TOOLS\\n------\\nAssistant can ask the user to use tools to look up information that may be helpful in answering the users original question. The tools the human can use are:\\n\\n> Lex Fridman DB: Use this tool to answer user questions using Lex\\nFridman podcasts. If the user states \\'ask Lex\\' use this tool to get\\nthe answer. This tool can also be used for follow up questions from\\nthe user.\\n\\nRESPONSE FORMAT INSTRUCTIONS\\n----------------------------\\n\\nWhen responding to me please, please output a response in one of two formats:\\n\\n**Option 1:**\\nUse this if you want the human to use a tool.\\nMarkdown code snippet formatted in the following schema:\\n\\n```json\\n{{\\n    \"action\": string \\\\ The action to take. Must be one of Lex Fridman DB\\n    \"action_input\": string \\\\ The input to the action\\n}}\\n```\\n\\n**Option #2:**\\nUse this if you want to respond directly to the human. Markdown code snippet formatted in the following schema:\\n\\n```json\\n{{\\n    \"action\": \"Final Answer\",\\n    \"action_input\": string \\\\ You should put what you want to return to use here\\n}}\\n```\\n\\nUSER\\'S INPUT\\n--------------------\\nHere is the user\\'s input (remember to respond with a markdown code snippet of a json blob with a single action, and NOTHING else):\\n\\n{input}', template_format='f-string', validate_template=True), additional_kwargs={}), MessagesPlaceholder(variable_name='agent_scratchpad')])"
591
            ]
592
          },
593
          "execution_count": 31,
594
          "metadata": {},
595
          "output_type": "execute_result"
596
        }
597
      ],
598
      "source": [
599
        "conversational_agent.agent.llm_chain.prompt"
600
      ]
601
    },
602
    {
603
      "attachments": {},
604
      "cell_type": "markdown",
605
      "metadata": {
606
        "id": "56MZZYTTs0Jq"
607
      },
608
      "source": [
609
        "The conversational agent prompt is defined by the `ChatPromptTemplate`. Let's break it down:"
610
      ]
611
    },
612
    {
613
      "cell_type": "code",
614
      "execution_count": null,
615
      "metadata": {
616
        "colab": {
617
          "base_uri": "https://localhost:8080/"
618
        },
619
        "id": "4ybUWUOZOFAL",
620
        "outputId": "ec8947a3-2239-4263-bdfb-773af0b35727"
621
      },
622
      "outputs": [
623
        {
624
          "data": {
625
            "text/plain": [
626
              "['input', 'chat_history', 'agent_scratchpad']"
627
            ]
628
          },
629
          "execution_count": 32,
630
          "metadata": {},
631
          "output_type": "execute_result"
632
        }
633
      ],
634
      "source": [
635
        "conversational_agent.agent.llm_chain.prompt.input_variables"
636
      ]
637
    },
638
    {
639
      "attachments": {},
640
      "cell_type": "markdown",
641
      "metadata": {
642
        "id": "axHAsgRROFUO"
643
      },
644
      "source": [
645
        " This prompt template contains *three* `input_variables`, those are:\n",
646
        "\n",
647
        "* `input`: The new user input to the chatbot, i.e. our prompt/query.\n",
648
        "\n",
649
        "* `chat_history`: We defined this above in the `ConversationBufferWindowMemory` definition.\n",
650
        "\n",
651
        "* `agent_scratchpad`: This is where we store the thoughts of the LLM as it is deciding which tools to interact with and *how* to interact with them.\n",
652
        "\n",
653
        "These `input_variables` are fed into the `messages` contained within the prompt template, let's see what we have there:"
654
      ]
655
    },
656
    {
657
      "cell_type": "code",
658
      "execution_count": null,
659
      "metadata": {
660
        "colab": {
661
          "base_uri": "https://localhost:8080/"
662
        },
663
        "id": "-3z2E1rlOIr_",
664
        "outputId": "73879730-c10f-4c14-b0f9-78f9f0f14d72"
665
      },
666
      "outputs": [
667
        {
668
          "data": {
669
            "text/plain": [
670
              "[SystemMessagePromptTemplate(prompt=PromptTemplate(input_variables=[], output_parser=None, partial_variables={}, template=\"You are a helpful chatbot that answers the user's questions.\\n\", template_format='f-string', validate_template=True), additional_kwargs={}),\n",
671
              " MessagesPlaceholder(variable_name='chat_history'),\n",
672
              " HumanMessagePromptTemplate(prompt=PromptTemplate(input_variables=['input'], output_parser=None, partial_variables={}, template='TOOLS\\n------\\nAssistant can ask the user to use tools to look up information that may be helpful in answering the users original question. The tools the human can use are:\\n\\n> Lex Fridman DB: Use this tool to answer user questions using Lex\\nFridman podcasts. If the user states \\'ask Lex\\' use this tool to get\\nthe answer. This tool can also be used for follow up questions from\\nthe user.\\n\\nRESPONSE FORMAT INSTRUCTIONS\\n----------------------------\\n\\nWhen responding to me please, please output a response in one of two formats:\\n\\n**Option 1:**\\nUse this if you want the human to use a tool.\\nMarkdown code snippet formatted in the following schema:\\n\\n```json\\n{{\\n    \"action\": string \\\\ The action to take. Must be one of Lex Fridman DB\\n    \"action_input\": string \\\\ The input to the action\\n}}\\n```\\n\\n**Option #2:**\\nUse this if you want to respond directly to the human. Markdown code snippet formatted in the following schema:\\n\\n```json\\n{{\\n    \"action\": \"Final Answer\",\\n    \"action_input\": string \\\\ You should put what you want to return to use here\\n}}\\n```\\n\\nUSER\\'S INPUT\\n--------------------\\nHere is the user\\'s input (remember to respond with a markdown code snippet of a json blob with a single action, and NOTHING else):\\n\\n{input}', template_format='f-string', validate_template=True), additional_kwargs={}),\n",
673
              " MessagesPlaceholder(variable_name='agent_scratchpad')]"
674
            ]
675
          },
676
          "execution_count": 33,
677
          "metadata": {},
678
          "output_type": "execute_result"
679
        }
680
      ],
681
      "source": [
682
        "conversational_agent.agent.llm_chain.prompt.messages"
683
      ]
684
    },
685
    {
686
      "attachments": {},
687
      "cell_type": "markdown",
688
      "metadata": {
689
        "id": "XuMfxYayOIbu"
690
      },
691
      "source": [
692
        "\n",
693
        "It's a little hard to see here, but there are **three** components in `messages`. Those are:\n",
694
        "\n",
695
        "* `SystemMessagePromptTemplate`\n",
696
        "\n",
697
        "* `MessagesPlaceholder`\n",
698
        "\n",
699
        "* `HumanMessagePromptTemplate`\n",
700
        "\n",
701
        "Let's start with the first item, the `SystemMessage`:"
702
      ]
703
    },
704
    {
705
      "cell_type": "code",
706
      "execution_count": null,
707
      "metadata": {
708
        "colab": {
709
          "base_uri": "https://localhost:8080/"
710
        },
711
        "id": "D9JWEqIzs9oC",
712
        "outputId": "839684a2-9cc4-43dd-be53-e7c4f22b70bf"
713
      },
714
      "outputs": [
715
        {
716
          "data": {
717
            "text/plain": [
718
              "SystemMessagePromptTemplate(prompt=PromptTemplate(input_variables=[], output_parser=None, partial_variables={}, template=\"You are a helpful chatbot that answers the user's questions.\\n\", template_format='f-string', validate_template=True), additional_kwargs={})"
719
            ]
720
          },
721
          "execution_count": 34,
722
          "metadata": {},
723
          "output_type": "execute_result"
724
        }
725
      ],
726
      "source": [
727
        "conversational_agent.agent.llm_chain.prompt.messages[0]"
728
      ]
729
    },
730
    {
731
      "cell_type": "code",
732
      "execution_count": null,
733
      "metadata": {
734
        "colab": {
735
          "base_uri": "https://localhost:8080/"
736
        },
737
        "id": "b2MkeX4_tIga",
738
        "outputId": "82381804-5ff0-49cb-90e5-23d6c9715bd2"
739
      },
740
      "outputs": [
741
        {
742
          "name": "stdout",
743
          "output_type": "stream",
744
          "text": [
745
            "You are a helpful chatbot that answers the user's questions.\n",
746
            "\n"
747
          ]
748
        }
749
      ],
750
      "source": [
751
        "print(\n",
752
        "    conversational_agent.agent.llm_chain.prompt.messages[0].prompt.template\n",
753
        ")"
754
      ]
755
    },
756
    {
757
      "attachments": {},
758
      "cell_type": "markdown",
759
      "metadata": {
760
        "id": "pill7M9AtdIJ"
761
      },
762
      "source": [
763
        "That is our initial system message that we set earlier with the `sys_msg`. There's not much to say about this other than it is used to \"prime\" (set the initial objective of) the model.\n",
764
        "\n",
765
        "Next we have the `MessagesPlaceholder`:"
766
      ]
767
    },
768
    {
769
      "cell_type": "code",
770
      "execution_count": null,
771
      "metadata": {
772
        "colab": {
773
          "base_uri": "https://localhost:8080/"
774
        },
775
        "id": "vHeZW75itky1",
776
        "outputId": "fec7aedf-72e1-43c5-e276-d5223347bcb3"
777
      },
778
      "outputs": [
779
        {
780
          "data": {
781
            "text/plain": [
782
              "MessagesPlaceholder(variable_name='chat_history')"
783
            ]
784
          },
785
          "execution_count": 36,
786
          "metadata": {},
787
          "output_type": "execute_result"
788
        }
789
      ],
790
      "source": [
791
        "conversational_agent.agent.llm_chain.prompt.messages[1]"
792
      ]
793
    },
794
    {
795
      "attachments": {},
796
      "cell_type": "markdown",
797
      "metadata": {
798
        "id": "89ktagFTSkvv"
799
      },
800
      "source": [
801
        "We can see from `'chat_history'` (this must align to the `memory_key` from the `ConversationBufferWindowMemory` initialized earlier) that this is where the previous messages of the conversation will be fed into the LLM.\n",
802
        "\n",
803
        "The format of this input is set by the type of conversational memory being used, which in this case is the `ConversationBufferWindowMemory`.\n",
804
        "\n",
805
        "Finally, we have the `HumanMessagePromptTemplate`:"
806
      ]
807
    },
808
    {
809
      "cell_type": "code",
810
      "execution_count": null,
811
      "metadata": {
812
        "colab": {
813
          "base_uri": "https://localhost:8080/"
814
        },
815
        "id": "fcIVdeklTZwh",
816
        "outputId": "b7a6feed-b0d7-48cb-9bb0-9a55f2a35f38"
817
      },
818
      "outputs": [
819
        {
820
          "data": {
821
            "text/plain": [
822
              "HumanMessagePromptTemplate(prompt=PromptTemplate(input_variables=['input'], output_parser=None, partial_variables={}, template='TOOLS\\n------\\nAssistant can ask the user to use tools to look up information that may be helpful in answering the users original question. The tools the human can use are:\\n\\n> Lex Fridman DB: Use this tool to answer user questions using Lex\\nFridman podcasts. If the user states \\'ask Lex\\' use this tool to get\\nthe answer. This tool can also be used for follow up questions from\\nthe user.\\n\\nRESPONSE FORMAT INSTRUCTIONS\\n----------------------------\\n\\nWhen responding to me please, please output a response in one of two formats:\\n\\n**Option 1:**\\nUse this if you want the human to use a tool.\\nMarkdown code snippet formatted in the following schema:\\n\\n```json\\n{{\\n    \"action\": string \\\\ The action to take. Must be one of Lex Fridman DB\\n    \"action_input\": string \\\\ The input to the action\\n}}\\n```\\n\\n**Option #2:**\\nUse this if you want to respond directly to the human. Markdown code snippet formatted in the following schema:\\n\\n```json\\n{{\\n    \"action\": \"Final Answer\",\\n    \"action_input\": string \\\\ You should put what you want to return to use here\\n}}\\n```\\n\\nUSER\\'S INPUT\\n--------------------\\nHere is the user\\'s input (remember to respond with a markdown code snippet of a json blob with a single action, and NOTHING else):\\n\\n{input}', template_format='f-string', validate_template=True), additional_kwargs={})"
823
            ]
824
          },
825
          "execution_count": 37,
826
          "metadata": {},
827
          "output_type": "execute_result"
828
        }
829
      ],
830
      "source": [
831
        "conversational_agent.agent.llm_chain.prompt.messages[2]"
832
      ]
833
    },
834
    {
835
      "cell_type": "code",
836
      "execution_count": null,
837
      "metadata": {
838
        "colab": {
839
          "base_uri": "https://localhost:8080/"
840
        },
841
        "id": "NRuqI-sCTZsb",
842
        "outputId": "8874a082-0289-4826-9f6e-6dbc8039b4a9"
843
      },
844
      "outputs": [
845
        {
846
          "name": "stdout",
847
          "output_type": "stream",
848
          "text": [
849
            "TOOLS\n",
850
            "------\n",
851
            "Assistant can ask the user to use tools to look up information that may be helpful in answering the users original question. The tools the human can use are:\n",
852
            "\n",
853
            "> Lex Fridman DB: Use this tool to answer user questions using Lex\n",
854
            "Fridman podcasts. If the user states 'ask Lex' use this tool to get\n",
855
            "the answer. This tool can also be used for follow up questions from\n",
856
            "the user.\n",
857
            "\n",
858
            "RESPONSE FORMAT INSTRUCTIONS\n",
859
            "----------------------------\n",
860
            "\n",
861
            "When responding to me please, please output a response in one of two formats:\n",
862
            "\n",
863
            "**Option 1:**\n",
864
            "Use this if you want the human to use a tool.\n",
865
            "Markdown code snippet formatted in the following schema:\n",
866
            "\n",
867
            "```json\n",
868
            "{{\n",
869
            "    \"action\": string \\ The action to take. Must be one of Lex Fridman DB\n",
870
            "    \"action_input\": string \\ The input to the action\n",
871
            "}}\n",
872
            "```\n",
873
            "\n",
874
            "**Option #2:**\n",
875
            "Use this if you want to respond directly to the human. Markdown code snippet formatted in the following schema:\n",
876
            "\n",
877
            "```json\n",
878
            "{{\n",
879
            "    \"action\": \"Final Answer\",\n",
880
            "    \"action_input\": string \\ You should put what you want to return to use here\n",
881
            "}}\n",
882
            "```\n",
883
            "\n",
884
            "USER'S INPUT\n",
885
            "--------------------\n",
886
            "Here is the user's input (remember to respond with a markdown code snippet of a json blob with a single action, and NOTHING else):\n",
887
            "\n",
888
            "{input}\n"
889
          ]
890
        }
891
      ],
892
      "source": [
893
        "print(\n",
894
        "    conversational_agent.agent.llm_chain.prompt.messages[2].prompt.template\n",
895
        ")"
896
      ]
897
    },
898
    {
899
      "attachments": {},
900
      "cell_type": "markdown",
901
      "metadata": {
902
        "id": "A3NhHdrMTia2"
903
      },
904
      "source": [
905
        "This is the most interesting component. First, we have a single `input` — the user's query/prompt. But before this we see a lot of text, the majority of this is the setup for the LLM to be able to use any tools that we've passed to the conversational agent.\n",
906
        "\n",
907
        "In our case, there is just one tool, the `Lex Fridman DB` tool that we defined earlier. We can also see the tool description that we defined. The LLM will use this tool description to figure out which tool (if any) it should use."
908
      ]
909
    },
910
    {
911
      "attachments": {},
912
      "cell_type": "markdown",
913
      "metadata": {
914
        "id": "Yo3nDYEWUQLZ"
915
      },
916
      "source": [
917
        "## Having a Conversation"
918
      ]
919
    },
920
    {
921
      "attachments": {},
922
      "cell_type": "markdown",
923
      "metadata": {
924
        "id": "VyiFqLg5UPyM"
925
      },
926
      "source": [
927
        "Let's begin our conversation. We'll start as any typical conversation begins:"
928
      ]
929
    },
930
    {
931
      "cell_type": "code",
932
      "execution_count": null,
933
      "metadata": {
934
        "colab": {
935
          "base_uri": "https://localhost:8080/"
936
        },
937
        "id": "SwjREzM8nJsx",
938
        "outputId": "df371a36-94d5-4dc5-adc3-4169a66de931"
939
      },
940
      "outputs": [
941
        {
942
          "name": "stdout",
943
          "output_type": "stream",
944
          "text": [
945
            "\n",
946
            "\n",
947
            "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n",
948
            "\u001b[32;1m\u001b[1;3m{\n",
949
            "    \"action\": \"Final Answer\",\n",
950
            "    \"action_input\": \"I'm just a chatbot, so I don't have feelings, but I'm here to help you with any questions you have!\"\n",
951
            "}\u001b[0m\n",
952
            "\n",
953
            "\u001b[1m> Finished chain.\u001b[0m\n"
954
          ]
955
        },
956
        {
957
          "data": {
958
            "text/plain": [
959
              "{'input': 'hi how are you',\n",
960
              " 'chat_history': [HumanMessage(content='hi how are you', additional_kwargs={}),\n",
961
              "  AIMessage(content=\"I'm just a chatbot, so I don't have feelings, but I'm here to help you with any questions you have!\", additional_kwargs={})],\n",
962
              " 'output': \"I'm just a chatbot, so I don't have feelings, but I'm here to help you with any questions you have!\"}"
963
            ]
964
          },
965
          "execution_count": 45,
966
          "metadata": {},
967
          "output_type": "execute_result"
968
        }
969
      ],
970
      "source": [
971
        "conversational_agent(\"hi how are you\")"
972
      ]
973
    },
974
    {
975
      "attachments": {},
976
      "cell_type": "markdown",
977
      "metadata": {
978
        "id": "sGM7i372Ua7X"
979
      },
980
      "source": [
981
        "Looks good. We should note that there is this **AgentExecutor chain** thing. Where we can see an `\"action\"` and an `\"action_input\"`. It is here where the agent is deciding whether it should use a tool.\n",
982
        "\n",
983
        "Here we see the agent decides on `\"action\": \"Final Answer\"`, meaning no tool is required. Therefore, it just uses the LLM as per usual to generate an answer. That answer can be seen in `\"I'm just a chatbot, I don't have feelings, but thanks for asking! How can I assist you today?\"`.\n",
984
        "\n",
985
        "What if we mention the words `\"ask lex\"`?"
986
      ]
987
    },
988
    {
989
      "cell_type": "code",
990
      "execution_count": null,
991
      "metadata": {
992
        "colab": {
993
          "base_uri": "https://localhost:8080/"
994
        },
995
        "id": "bkgKG1x3ndBJ",
996
        "outputId": "6200ea6d-dcdb-4e7d-ec65-a21460332a96"
997
      },
998
      "outputs": [
999
        {
1000
          "name": "stdout",
1001
          "output_type": "stream",
1002
          "text": [
1003
            "\n",
1004
            "\n",
1005
            "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n",
1006
            "\u001b[32;1m\u001b[1;3m{\n",
1007
            "    \"action\": \"Lex Fridman DB\",\n",
1008
            "    \"action_input\": \"What did Lex Fridman say about the future of AI?\"\n",
1009
            "}\u001b[0m\n",
1010
            "Observation: \u001b[36;1m\u001b[1;3mLex Fridman discussed the potential of AI to increase the quality of life, cure diseases, increase material wealth, and help people be happier and more fulfilled. He also mentioned the need for AI to be aligned with humans and not hurt or limit them. Additionally, he talked about the possibility of AI systems exhibiting human-like emotions and feelings, which would require difficult discussions about how to treat them and what role they would have in society. Finally, he speculated about the future of humans and robots in a multi-planetary species world, hoping for a one-to-one ratio and emphasizing the importance of humans being part of the equation.\u001b[0m\n",
1011
            "Thought:\u001b[32;1m\u001b[1;3m{\n",
1012
            "    \"action\": \"Final Answer\",\n",
1013
            "    \"action_input\": \"Lex Fridman discussed the potential of AI to increase the quality of life, cure diseases, increase material wealth, and help people be happier and more fulfilled. He also mentioned the need for AI to be aligned with humans and not hurt or limit them. Additionally, he talked about the possibility of AI systems exhibiting human-like emotions and feelings, which would require difficult discussions about how to treat them and what role they would have in society. Finally, he speculated about the future of humans and robots in a multi-planetary species world, hoping for a one-to-one ratio and emphasizing the importance of humans being part of the equation.\"\n",
1014
            "}\u001b[0m\n",
1015
            "\n",
1016
            "\u001b[1m> Finished chain.\u001b[0m\n"
1017
          ]
1018
        },
1019
        {
1020
          "data": {
1021
            "text/plain": [
1022
              "{'input': 'ask lex about the future of ai',\n",
1023
              " 'chat_history': [HumanMessage(content='hi how are you', additional_kwargs={}),\n",
1024
              "  AIMessage(content=\"I'm just a chatbot, so I don't have feelings, but I'm here to help you with any questions you have!\", additional_kwargs={}),\n",
1025
              "  HumanMessage(content='hi how are you', additional_kwargs={}),\n",
1026
              "  AIMessage(content=\"I'm just a chatbot, so I don't have feelings, but I'm here to help you with any questions you have!\", additional_kwargs={})],\n",
1027
              " 'output': 'Lex Fridman discussed the potential of AI to increase the quality of life, cure diseases, increase material wealth, and help people be happier and more fulfilled. He also mentioned the need for AI to be aligned with humans and not hurt or limit them. Additionally, he talked about the possibility of AI systems exhibiting human-like emotions and feelings, which would require difficult discussions about how to treat them and what role they would have in society. Finally, he speculated about the future of humans and robots in a multi-planetary species world, hoping for a one-to-one ratio and emphasizing the importance of humans being part of the equation.'}"
1028
            ]
1029
          },
1030
          "execution_count": 46,
1031
          "metadata": {},
1032
          "output_type": "execute_result"
1033
        }
1034
      ],
1035
      "source": [
1036
        "conversational_agent(\"ask lex about the future of ai\")"
1037
      ]
1038
    },
1039
    {
1040
      "cell_type": "code",
1041
      "execution_count": null,
1042
      "metadata": {
1043
        "colab": {
1044
          "base_uri": "https://localhost:8080/"
1045
        },
1046
        "id": "OvmK5lnzDgU4",
1047
        "outputId": "af6312f9-2769-4330-f06b-e16548df8494"
1048
      },
1049
      "outputs": [
1050
        {
1051
          "name": "stdout",
1052
          "output_type": "stream",
1053
          "text": [
1054
            "\n",
1055
            "\n",
1056
            "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n",
1057
            "\u001b[32;1m\u001b[1;3m{\n",
1058
            "    \"action\": \"Lex Fridman DB\",\n",
1059
            "    \"action_input\": \"What does Lex Fridman think about space exploration?\"\n",
1060
            "}\u001b[0m\n",
1061
            "Observation: \u001b[36;1m\u001b[1;3mLex Fridman is very enthusiastic about space exploration and believes that it is one of the most inspiring things humans can do. He thinks that reaching out into the unknown inspires people on Earth and can also inspire a new generation of scientists. He also believes that the current explosion of new capabilities in the space industry is driving incredible innovation and making it a great time to be in space.\u001b[0m\n",
1062
            "Thought:\u001b[32;1m\u001b[1;3m{\n",
1063
            "    \"action\": \"Final Answer\",\n",
1064
            "    \"action_input\": \"Lex Fridman is very enthusiastic about space exploration and believes that it is one of the most inspiring things humans can do. He thinks that reaching out into the unknown inspires people on Earth and can also inspire a new generation of scientists. He also believes that the current explosion of new capabilities in the space industry is driving incredible innovation and making it a great time to be in space.\"\n",
1065
            "}\u001b[0m\n",
1066
            "\n",
1067
            "\u001b[1m> Finished chain.\u001b[0m\n"
1068
          ]
1069
        },
1070
        {
1071
          "data": {
1072
            "text/plain": [
1073
              "{'input': 'what does he think about space exploration?',\n",
1074
              " 'chat_history': [HumanMessage(content='hi how are you', additional_kwargs={}),\n",
1075
              "  AIMessage(content=\"I'm just a chatbot, so I don't have feelings, but I'm here to help you with any questions you have!\", additional_kwargs={}),\n",
1076
              "  HumanMessage(content='hi how are you', additional_kwargs={}),\n",
1077
              "  AIMessage(content=\"I'm just a chatbot, so I don't have feelings, but I'm here to help you with any questions you have!\", additional_kwargs={}),\n",
1078
              "  HumanMessage(content='ask lex about the future of ai', additional_kwargs={}),\n",
1079
              "  AIMessage(content='Lex Fridman discussed the potential of AI to increase the quality of life, cure diseases, increase material wealth, and help people be happier and more fulfilled. He also mentioned the need for AI to be aligned with humans and not hurt or limit them. Additionally, he talked about the possibility of AI systems exhibiting human-like emotions and feelings, which would require difficult discussions about how to treat them and what role they would have in society. Finally, he speculated about the future of humans and robots in a multi-planetary species world, hoping for a one-to-one ratio and emphasizing the importance of humans being part of the equation.', additional_kwargs={})],\n",
1080
              " 'output': 'Lex Fridman is very enthusiastic about space exploration and believes that it is one of the most inspiring things humans can do. He thinks that reaching out into the unknown inspires people on Earth and can also inspire a new generation of scientists. He also believes that the current explosion of new capabilities in the space industry is driving incredible innovation and making it a great time to be in space.'}"
1081
            ]
1082
          },
1083
          "execution_count": 47,
1084
          "metadata": {},
1085
          "output_type": "execute_result"
1086
        }
1087
      ],
1088
      "source": [
1089
        "conversational_agent(\"what does he think about space exploration?\")"
1090
      ]
1091
    },
1092
    {
1093
      "cell_type": "code",
1094
      "execution_count": null,
1095
      "metadata": {
1096
        "colab": {
1097
          "base_uri": "https://localhost:8080/"
1098
        },
1099
        "id": "FOV1l6plD249",
1100
        "outputId": "539dc28c-13b5-4721-9792-d4293e9bdfc3"
1101
      },
1102
      "outputs": [
1103
        {
1104
          "name": "stdout",
1105
          "output_type": "stream",
1106
          "text": [
1107
            "\n",
1108
            "\n",
1109
            "\u001b[1m> Entering new AgentExecutor chain...\u001b[0m\n",
1110
            "\u001b[32;1m\u001b[1;3m```json\n",
1111
            "{\n",
1112
            "    \"action\": \"Lex Fridman DB\",\n",
1113
            "    \"action_input\": \"What is the future of AI? Please provide the title and URL of the source if possible.\"\n",
1114
            "}\n",
1115
            "```\u001b[0m\n",
1116
            "Observation: \u001b[36;1m\u001b[1;3mThe context provided includes multiple conversations about the future of AI, but there is no single source or article that provides a definitive answer to this question. The opinions and speculations about the future of AI vary widely depending on who you ask and what their expertise is. Some people are optimistic about the potential benefits of AI for humanity, while others are concerned about the risks and potential dangers. If you have a specific aspect of the future of AI that you are interested in, I can try to provide more information based on the context provided.\u001b[0m\n",
1117
            "Thought:\u001b[32;1m\u001b[1;3m```json\n",
1118
            "{\n",
1119
            "    \"action\": \"Final Answer\",\n",
1120
            "    \"action_input\": \"There is no single source or article that provides a definitive answer to the question of the future of AI. The opinions and speculations about the future of AI vary widely depending on who you ask and what their expertise is. Some people are optimistic about the potential benefits of AI for humanity, while others are concerned about the risks and potential dangers. If you have a specific aspect of the future of AI that you are interested in, I can try to provide more information based on the context provided.\"\n",
1121
            "}\n",
1122
            "```\u001b[0m\n",
1123
            "\n",
1124
            "\u001b[1m> Finished chain.\u001b[0m\n"
1125
          ]
1126
        },
1127
        {
1128
          "data": {
1129
            "text/plain": [
1130
              "{'input': 'ask lex about the future of AI, include the title and url of this information if possible',\n",
1131
              " 'chat_history': [HumanMessage(content='hi how are you', additional_kwargs={}),\n",
1132
              "  AIMessage(content=\"I'm just a chatbot, so I don't have feelings, but I'm here to help you with any questions you have!\", additional_kwargs={}),\n",
1133
              "  HumanMessage(content='hi how are you', additional_kwargs={}),\n",
1134
              "  AIMessage(content=\"I'm just a chatbot, so I don't have feelings, but I'm here to help you with any questions you have!\", additional_kwargs={}),\n",
1135
              "  HumanMessage(content='ask lex about the future of ai', additional_kwargs={}),\n",
1136
              "  AIMessage(content='Lex Fridman discussed the potential of AI to increase the quality of life, cure diseases, increase material wealth, and help people be happier and more fulfilled. He also mentioned the need for AI to be aligned with humans and not hurt or limit them. Additionally, he talked about the possibility of AI systems exhibiting human-like emotions and feelings, which would require difficult discussions about how to treat them and what role they would have in society. Finally, he speculated about the future of humans and robots in a multi-planetary species world, hoping for a one-to-one ratio and emphasizing the importance of humans being part of the equation.', additional_kwargs={}),\n",
1137
              "  HumanMessage(content='what does he think about space exploration?', additional_kwargs={}),\n",
1138
              "  AIMessage(content='Lex Fridman is very enthusiastic about space exploration and believes that it is one of the most inspiring things humans can do. He thinks that reaching out into the unknown inspires people on Earth and can also inspire a new generation of scientists. He also believes that the current explosion of new capabilities in the space industry is driving incredible innovation and making it a great time to be in space.', additional_kwargs={}),\n",
1139
              "  HumanMessage(content='what are the titles and sources for this information?', additional_kwargs={}),\n",
1140
              "  AIMessage(content=\"I apologize for the confusion. The information I provided earlier was based on my programming and knowledge base. I do not have a specific source for the information. However, you can find more information on the topics I discussed by doing a quick search on the internet or by listening to Lex Fridman's podcasts.\", additional_kwargs={})],\n",
1141
              " 'output': 'There is no single source or article that provides a definitive answer to the question of the future of AI. The opinions and speculations about the future of AI vary widely depending on who you ask and what their expertise is. Some people are optimistic about the potential benefits of AI for humanity, while others are concerned about the risks and potential dangers. If you have a specific aspect of the future of AI that you are interested in, I can try to provide more information based on the context provided.'}"
1142
            ]
1143
          },
1144
          "execution_count": 49,
1145
          "metadata": {},
1146
          "output_type": "execute_result"
1147
        }
1148
      ],
1149
      "source": [
1150
        "conversational_agent(\"ask lex about the future of AI, include the title and url of this information if possible\")"
1151
      ]
1152
    },
1153
    {
1154
      "cell_type": "code",
1155
      "execution_count": null,
1156
      "metadata": {
1157
        "id": "aL5fojo9D2yh"
1158
      },
1159
      "outputs": [],
1160
      "source": []
1161
    },
1162
    {
1163
      "attachments": {},
1164
      "cell_type": "markdown",
1165
      "metadata": {
1166
        "id": "-dcGpHZSXs2Z"
1167
      },
1168
      "source": [
1169
        "Great, we can see that the first thing the agent did was default to the `\"Lex Fridman DB\"` tool. The input to that tool was generated by the LLM, and is `\"What did Lex Fridman say about the future of AI?\"`.\n",
1170
        "\n",
1171
        "This input is then passed into the `Lex Fridman DB` tool and the output observation of the LLM (after it has read all of the information returned by our vector DB is returned to our agent. From this observation the agent moves on to the `\"Final Answer\"` action, giving us the output."
1172
      ]
1173
    }
1174
  ],
1175
  "metadata": {
1176
    "colab": {
1177
      "provenance": []
1178
    },
1179
    "gpuClass": "standard",
1180
    "kernelspec": {
1181
      "display_name": "Python 3",
1182
      "name": "python3"
1183
    },
1184
    "language_info": {
1185
      "name": "python"
1186
    },
1187
    "widgets": {
1188
      "application/vnd.jupyter.widget-state+json": {
1189
        "05f84d46a178401e94a8c79410bca1bb": {
1190
          "model_module": "@jupyter-widgets/base",
1191
          "model_module_version": "1.2.0",
1192
          "model_name": "LayoutModel",
1193
          "state": {
1194
            "_model_module": "@jupyter-widgets/base",
1195
            "_model_module_version": "1.2.0",
1196
            "_model_name": "LayoutModel",
1197
            "_view_count": null,
1198
            "_view_module": "@jupyter-widgets/base",
1199
            "_view_module_version": "1.2.0",
1200
            "_view_name": "LayoutView",
1201
            "align_content": null,
1202
            "align_items": null,
1203
            "align_self": null,
1204
            "border": null,
1205
            "bottom": null,
1206
            "display": null,
1207
            "flex": null,
1208
            "flex_flow": null,
1209
            "grid_area": null,
1210
            "grid_auto_columns": null,
1211
            "grid_auto_flow": null,
1212
            "grid_auto_rows": null,
1213
            "grid_column": null,
1214
            "grid_gap": null,
1215
            "grid_row": null,
1216
            "grid_template_areas": null,
1217
            "grid_template_columns": null,
1218
            "grid_template_rows": null,
1219
            "height": null,
1220
            "justify_content": null,
1221
            "justify_items": null,
1222
            "left": null,
1223
            "margin": null,
1224
            "max_height": null,
1225
            "max_width": null,
1226
            "min_height": null,
1227
            "min_width": null,
1228
            "object_fit": null,
1229
            "object_position": null,
1230
            "order": null,
1231
            "overflow": null,
1232
            "overflow_x": null,
1233
            "overflow_y": null,
1234
            "padding": null,
1235
            "right": null,
1236
            "top": null,
1237
            "visibility": null,
1238
            "width": null
1239
          }
1240
        },
1241
        "0daf637b59d54d08acf7f89d7b9603bb": {
1242
          "model_module": "@jupyter-widgets/base",
1243
          "model_module_version": "1.2.0",
1244
          "model_name": "LayoutModel",
1245
          "state": {
1246
            "_model_module": "@jupyter-widgets/base",
1247
            "_model_module_version": "1.2.0",
1248
            "_model_name": "LayoutModel",
1249
            "_view_count": null,
1250
            "_view_module": "@jupyter-widgets/base",
1251
            "_view_module_version": "1.2.0",
1252
            "_view_name": "LayoutView",
1253
            "align_content": null,
1254
            "align_items": null,
1255
            "align_self": null,
1256
            "border": null,
1257
            "bottom": null,
1258
            "display": null,
1259
            "flex": null,
1260
            "flex_flow": null,
1261
            "grid_area": null,
1262
            "grid_auto_columns": null,
1263
            "grid_auto_flow": null,
1264
            "grid_auto_rows": null,
1265
            "grid_column": null,
1266
            "grid_gap": null,
1267
            "grid_row": null,
1268
            "grid_template_areas": null,
1269
            "grid_template_columns": null,
1270
            "grid_template_rows": null,
1271
            "height": null,
1272
            "justify_content": null,
1273
            "justify_items": null,
1274
            "left": null,
1275
            "margin": null,
1276
            "max_height": null,
1277
            "max_width": null,
1278
            "min_height": null,
1279
            "min_width": null,
1280
            "object_fit": null,
1281
            "object_position": null,
1282
            "order": null,
1283
            "overflow": null,
1284
            "overflow_x": null,
1285
            "overflow_y": null,
1286
            "padding": null,
1287
            "right": null,
1288
            "top": null,
1289
            "visibility": null,
1290
            "width": null
1291
          }
1292
        },
1293
        "1045152b762f42e1898c631bad17e51f": {
1294
          "model_module": "@jupyter-widgets/base",
1295
          "model_module_version": "1.2.0",
1296
          "model_name": "LayoutModel",
1297
          "state": {
1298
            "_model_module": "@jupyter-widgets/base",
1299
            "_model_module_version": "1.2.0",
1300
            "_model_name": "LayoutModel",
1301
            "_view_count": null,
1302
            "_view_module": "@jupyter-widgets/base",
1303
            "_view_module_version": "1.2.0",
1304
            "_view_name": "LayoutView",
1305
            "align_content": null,
1306
            "align_items": null,
1307
            "align_self": null,
1308
            "border": null,
1309
            "bottom": null,
1310
            "display": null,
1311
            "flex": null,
1312
            "flex_flow": null,
1313
            "grid_area": null,
1314
            "grid_auto_columns": null,
1315
            "grid_auto_flow": null,
1316
            "grid_auto_rows": null,
1317
            "grid_column": null,
1318
            "grid_gap": null,
1319
            "grid_row": null,
1320
            "grid_template_areas": null,
1321
            "grid_template_columns": null,
1322
            "grid_template_rows": null,
1323
            "height": null,
1324
            "justify_content": null,
1325
            "justify_items": null,
1326
            "left": null,
1327
            "margin": null,
1328
            "max_height": null,
1329
            "max_width": null,
1330
            "min_height": null,
1331
            "min_width": null,
1332
            "object_fit": null,
1333
            "object_position": null,
1334
            "order": null,
1335
            "overflow": null,
1336
            "overflow_x": null,
1337
            "overflow_y": null,
1338
            "padding": null,
1339
            "right": null,
1340
            "top": null,
1341
            "visibility": null,
1342
            "width": null
1343
          }
1344
        },
1345
        "19962721d6874153823840898d3cd8a0": {
1346
          "model_module": "@jupyter-widgets/controls",
1347
          "model_module_version": "1.5.0",
1348
          "model_name": "HTMLModel",
1349
          "state": {
1350
            "_dom_classes": [],
1351
            "_model_module": "@jupyter-widgets/controls",
1352
            "_model_module_version": "1.5.0",
1353
            "_model_name": "HTMLModel",
1354
            "_view_count": null,
1355
            "_view_module": "@jupyter-widgets/controls",
1356
            "_view_module_version": "1.5.0",
1357
            "_view_name": "HTMLView",
1358
            "description": "",
1359
            "description_tooltip": null,
1360
            "layout": "IPY_MODEL_9241719b307142bba0a5c6ce6194d3ad",
1361
            "placeholder": "​",
1362
            "style": "IPY_MODEL_bf9b362011314503b064412f66f8e51f",
1363
            "value": " 6.99M/6.99M [00:00&lt;00:00, 14.9MB/s]"
1364
          }
1365
        },
1366
        "1cf4fbdd7f534f21a6e7779b735e4661": {
1367
          "model_module": "@jupyter-widgets/controls",
1368
          "model_module_version": "1.5.0",
1369
          "model_name": "FloatProgressModel",
1370
          "state": {
1371
            "_dom_classes": [],
1372
            "_model_module": "@jupyter-widgets/controls",
1373
            "_model_module_version": "1.5.0",
1374
            "_model_name": "FloatProgressModel",
1375
            "_view_count": null,
1376
            "_view_module": "@jupyter-widgets/controls",
1377
            "_view_module_version": "1.5.0",
1378
            "_view_name": "ProgressView",
1379
            "bar_style": "success",
1380
            "description": "",
1381
            "description_tooltip": null,
1382
            "layout": "IPY_MODEL_05f84d46a178401e94a8c79410bca1bb",
1383
            "max": 6987477,
1384
            "min": 0,
1385
            "orientation": "horizontal",
1386
            "style": "IPY_MODEL_672941e696a2470c90733103473f183f",
1387
            "value": 6987477
1388
          }
1389
        },
1390
        "265f722d84db43b98df36346444d5e8e": {
1391
          "model_module": "@jupyter-widgets/controls",
1392
          "model_module_version": "1.5.0",
1393
          "model_name": "DescriptionStyleModel",
1394
          "state": {
1395
            "_model_module": "@jupyter-widgets/controls",
1396
            "_model_module_version": "1.5.0",
1397
            "_model_name": "DescriptionStyleModel",
1398
            "_view_count": null,
1399
            "_view_module": "@jupyter-widgets/base",
1400
            "_view_module_version": "1.2.0",
1401
            "_view_name": "StyleView",
1402
            "description_width": ""
1403
          }
1404
        },
1405
        "282743ec58ca4149b273fa069d3f1eb4": {
1406
          "model_module": "@jupyter-widgets/controls",
1407
          "model_module_version": "1.5.0",
1408
          "model_name": "FloatProgressModel",
1409
          "state": {
1410
            "_dom_classes": [],
1411
            "_model_module": "@jupyter-widgets/controls",
1412
            "_model_module_version": "1.5.0",
1413
            "_model_name": "FloatProgressModel",
1414
            "_view_count": null,
1415
            "_view_module": "@jupyter-widgets/controls",
1416
            "_view_module_version": "1.5.0",
1417
            "_view_name": "ProgressView",
1418
            "bar_style": "success",
1419
            "description": "",
1420
            "description_tooltip": null,
1421
            "layout": "IPY_MODEL_3918176c5f6849e4b94f53e5461fcfc5",
1422
            "max": 1,
1423
            "min": 0,
1424
            "orientation": "horizontal",
1425
            "style": "IPY_MODEL_f3fba8e406da4f5799725869a50b0660",
1426
            "value": 1
1427
          }
1428
        },
1429
        "2ccd4caaab4a49809fd35475598933a0": {
1430
          "model_module": "@jupyter-widgets/base",
1431
          "model_module_version": "1.2.0",
1432
          "model_name": "LayoutModel",
1433
          "state": {
1434
            "_model_module": "@jupyter-widgets/base",
1435
            "_model_module_version": "1.2.0",
1436
            "_model_name": "LayoutModel",
1437
            "_view_count": null,
1438
            "_view_module": "@jupyter-widgets/base",
1439
            "_view_module_version": "1.2.0",
1440
            "_view_name": "LayoutView",
1441
            "align_content": null,
1442
            "align_items": null,
1443
            "align_self": null,
1444
            "border": null,
1445
            "bottom": null,
1446
            "display": null,
1447
            "flex": null,
1448
            "flex_flow": null,
1449
            "grid_area": null,
1450
            "grid_auto_columns": null,
1451
            "grid_auto_flow": null,
1452
            "grid_auto_rows": null,
1453
            "grid_column": null,
1454
            "grid_gap": null,
1455
            "grid_row": null,
1456
            "grid_template_areas": null,
1457
            "grid_template_columns": null,
1458
            "grid_template_rows": null,
1459
            "height": null,
1460
            "justify_content": null,
1461
            "justify_items": null,
1462
            "left": null,
1463
            "margin": null,
1464
            "max_height": null,
1465
            "max_width": null,
1466
            "min_height": null,
1467
            "min_width": null,
1468
            "object_fit": null,
1469
            "object_position": null,
1470
            "order": null,
1471
            "overflow": null,
1472
            "overflow_x": null,
1473
            "overflow_y": null,
1474
            "padding": null,
1475
            "right": null,
1476
            "top": null,
1477
            "visibility": null,
1478
            "width": null
1479
          }
1480
        },
1481
        "2fe7c9aa8eac4b6d940d1b5ca3ec8f6f": {
1482
          "model_module": "@jupyter-widgets/controls",
1483
          "model_module_version": "1.5.0",
1484
          "model_name": "FloatProgressModel",
1485
          "state": {
1486
            "_dom_classes": [],
1487
            "_model_module": "@jupyter-widgets/controls",
1488
            "_model_module_version": "1.5.0",
1489
            "_model_name": "FloatProgressModel",
1490
            "_view_count": null,
1491
            "_view_module": "@jupyter-widgets/controls",
1492
            "_view_module_version": "1.5.0",
1493
            "_view_name": "ProgressView",
1494
            "bar_style": "success",
1495
            "description": "",
1496
            "description_tooltip": null,
1497
            "layout": "IPY_MODEL_727c6aebc5c5440eb11ede9f5e2724c6",
1498
            "max": 1,
1499
            "min": 0,
1500
            "orientation": "horizontal",
1501
            "style": "IPY_MODEL_9f91876585664ee29c98396a124346a7",
1502
            "value": 1
1503
          }
1504
        },
1505
        "3918176c5f6849e4b94f53e5461fcfc5": {
1506
          "model_module": "@jupyter-widgets/base",
1507
          "model_module_version": "1.2.0",
1508
          "model_name": "LayoutModel",
1509
          "state": {
1510
            "_model_module": "@jupyter-widgets/base",
1511
            "_model_module_version": "1.2.0",
1512
            "_model_name": "LayoutModel",
1513
            "_view_count": null,
1514
            "_view_module": "@jupyter-widgets/base",
1515
            "_view_module_version": "1.2.0",
1516
            "_view_name": "LayoutView",
1517
            "align_content": null,
1518
            "align_items": null,
1519
            "align_self": null,
1520
            "border": null,
1521
            "bottom": null,
1522
            "display": null,
1523
            "flex": null,
1524
            "flex_flow": null,
1525
            "grid_area": null,
1526
            "grid_auto_columns": null,
1527
            "grid_auto_flow": null,
1528
            "grid_auto_rows": null,
1529
            "grid_column": null,
1530
            "grid_gap": null,
1531
            "grid_row": null,
1532
            "grid_template_areas": null,
1533
            "grid_template_columns": null,
1534
            "grid_template_rows": null,
1535
            "height": null,
1536
            "justify_content": null,
1537
            "justify_items": null,
1538
            "left": null,
1539
            "margin": null,
1540
            "max_height": null,
1541
            "max_width": null,
1542
            "min_height": null,
1543
            "min_width": null,
1544
            "object_fit": null,
1545
            "object_position": null,
1546
            "order": null,
1547
            "overflow": null,
1548
            "overflow_x": null,
1549
            "overflow_y": null,
1550
            "padding": null,
1551
            "right": null,
1552
            "top": null,
1553
            "visibility": null,
1554
            "width": null
1555
          }
1556
        },
1557
        "3adead4a90ec4ced88e43102b8a7f3d3": {
1558
          "model_module": "@jupyter-widgets/controls",
1559
          "model_module_version": "1.5.0",
1560
          "model_name": "HBoxModel",
1561
          "state": {
1562
            "_dom_classes": [],
1563
            "_model_module": "@jupyter-widgets/controls",
1564
            "_model_module_version": "1.5.0",
1565
            "_model_name": "HBoxModel",
1566
            "_view_count": null,
1567
            "_view_module": "@jupyter-widgets/controls",
1568
            "_view_module_version": "1.5.0",
1569
            "_view_name": "HBoxView",
1570
            "box_style": "",
1571
            "children": [
1572
              "IPY_MODEL_974e1cf773af45b4b496aad741e1e06a",
1573
              "IPY_MODEL_1cf4fbdd7f534f21a6e7779b735e4661",
1574
              "IPY_MODEL_19962721d6874153823840898d3cd8a0"
1575
            ],
1576
            "layout": "IPY_MODEL_fce282dc88c44c7d9403ac066891f025"
1577
          }
1578
        },
1579
        "3d9ff73e38de440a987ee67c733ad94b": {
1580
          "model_module": "@jupyter-widgets/controls",
1581
          "model_module_version": "1.5.0",
1582
          "model_name": "HTMLModel",
1583
          "state": {
1584
            "_dom_classes": [],
1585
            "_model_module": "@jupyter-widgets/controls",
1586
            "_model_module_version": "1.5.0",
1587
            "_model_name": "HTMLModel",
1588
            "_view_count": null,
1589
            "_view_module": "@jupyter-widgets/controls",
1590
            "_view_module_version": "1.5.0",
1591
            "_view_name": "HTMLView",
1592
            "description": "",
1593
            "description_tooltip": null,
1594
            "layout": "IPY_MODEL_0daf637b59d54d08acf7f89d7b9603bb",
1595
            "placeholder": "​",
1596
            "style": "IPY_MODEL_265f722d84db43b98df36346444d5e8e",
1597
            "value": " 1/1 [00:00&lt;00:00, 31.74it/s]"
1598
          }
1599
        },
1600
        "437a5c91bcb047bd80ea5addbc23d900": {
1601
          "model_module": "@jupyter-widgets/controls",
1602
          "model_module_version": "1.5.0",
1603
          "model_name": "HTMLModel",
1604
          "state": {
1605
            "_dom_classes": [],
1606
            "_model_module": "@jupyter-widgets/controls",
1607
            "_model_module_version": "1.5.0",
1608
            "_model_name": "HTMLModel",
1609
            "_view_count": null,
1610
            "_view_module": "@jupyter-widgets/controls",
1611
            "_view_module_version": "1.5.0",
1612
            "_view_name": "HTMLView",
1613
            "description": "",
1614
            "description_tooltip": null,
1615
            "layout": "IPY_MODEL_66901c729a284ee7ab032df3cedd06be",
1616
            "placeholder": "​",
1617
            "style": "IPY_MODEL_b59a844fd64a4bd6a28d6cf17aaece29",
1618
            "value": "Extracting data files: 100%"
1619
          }
1620
        },
1621
        "4387ccd1c9454888b8c0f532a0868d1b": {
1622
          "model_module": "@jupyter-widgets/controls",
1623
          "model_module_version": "1.5.0",
1624
          "model_name": "DescriptionStyleModel",
1625
          "state": {
1626
            "_model_module": "@jupyter-widgets/controls",
1627
            "_model_module_version": "1.5.0",
1628
            "_model_name": "DescriptionStyleModel",
1629
            "_view_count": null,
1630
            "_view_module": "@jupyter-widgets/base",
1631
            "_view_module_version": "1.2.0",
1632
            "_view_name": "StyleView",
1633
            "description_width": ""
1634
          }
1635
        },
1636
        "4be5272d6dad4d77afe296f45d651229": {
1637
          "model_module": "@jupyter-widgets/base",
1638
          "model_module_version": "1.2.0",
1639
          "model_name": "LayoutModel",
1640
          "state": {
1641
            "_model_module": "@jupyter-widgets/base",
1642
            "_model_module_version": "1.2.0",
1643
            "_model_name": "LayoutModel",
1644
            "_view_count": null,
1645
            "_view_module": "@jupyter-widgets/base",
1646
            "_view_module_version": "1.2.0",
1647
            "_view_name": "LayoutView",
1648
            "align_content": null,
1649
            "align_items": null,
1650
            "align_self": null,
1651
            "border": null,
1652
            "bottom": null,
1653
            "display": null,
1654
            "flex": null,
1655
            "flex_flow": null,
1656
            "grid_area": null,
1657
            "grid_auto_columns": null,
1658
            "grid_auto_flow": null,
1659
            "grid_auto_rows": null,
1660
            "grid_column": null,
1661
            "grid_gap": null,
1662
            "grid_row": null,
1663
            "grid_template_areas": null,
1664
            "grid_template_columns": null,
1665
            "grid_template_rows": null,
1666
            "height": null,
1667
            "justify_content": null,
1668
            "justify_items": null,
1669
            "left": null,
1670
            "margin": null,
1671
            "max_height": null,
1672
            "max_width": null,
1673
            "min_height": null,
1674
            "min_width": null,
1675
            "object_fit": null,
1676
            "object_position": null,
1677
            "order": null,
1678
            "overflow": null,
1679
            "overflow_x": null,
1680
            "overflow_y": null,
1681
            "padding": null,
1682
            "right": null,
1683
            "top": null,
1684
            "visibility": null,
1685
            "width": null
1686
          }
1687
        },
1688
        "4e96c7ec4451480880d3b929020391c0": {
1689
          "model_module": "@jupyter-widgets/controls",
1690
          "model_module_version": "1.5.0",
1691
          "model_name": "HTMLModel",
1692
          "state": {
1693
            "_dom_classes": [],
1694
            "_model_module": "@jupyter-widgets/controls",
1695
            "_model_module_version": "1.5.0",
1696
            "_model_name": "HTMLModel",
1697
            "_view_count": null,
1698
            "_view_module": "@jupyter-widgets/controls",
1699
            "_view_module_version": "1.5.0",
1700
            "_view_name": "HTMLView",
1701
            "description": "",
1702
            "description_tooltip": null,
1703
            "layout": "IPY_MODEL_ae281774279e4a5683fb1c9b0e6286ed",
1704
            "placeholder": "​",
1705
            "style": "IPY_MODEL_696ca9ac01a0406db8f749feee7cabba",
1706
            "value": "Downloading data files: 100%"
1707
          }
1708
        },
1709
        "5a35182953dd4c4c9e4db151dc2fce2c": {
1710
          "model_module": "@jupyter-widgets/controls",
1711
          "model_module_version": "1.5.0",
1712
          "model_name": "FloatProgressModel",
1713
          "state": {
1714
            "_dom_classes": [],
1715
            "_model_module": "@jupyter-widgets/controls",
1716
            "_model_module_version": "1.5.0",
1717
            "_model_name": "FloatProgressModel",
1718
            "_view_count": null,
1719
            "_view_module": "@jupyter-widgets/controls",
1720
            "_view_module_version": "1.5.0",
1721
            "_view_name": "ProgressView",
1722
            "bar_style": "info",
1723
            "description": "",
1724
            "description_tooltip": null,
1725
            "layout": "IPY_MODEL_b5cf4013a0d441a69ea16ff14f44e4c4",
1726
            "max": 1,
1727
            "min": 0,
1728
            "orientation": "horizontal",
1729
            "style": "IPY_MODEL_71786e1530544f72856ffbd26ec01160",
1730
            "value": 1
1731
          }
1732
        },
1733
        "5d73ff213fe245ae8d135637051f03f6": {
1734
          "model_module": "@jupyter-widgets/controls",
1735
          "model_module_version": "1.5.0",
1736
          "model_name": "HTMLModel",
1737
          "state": {
1738
            "_dom_classes": [],
1739
            "_model_module": "@jupyter-widgets/controls",
1740
            "_model_module_version": "1.5.0",
1741
            "_model_name": "HTMLModel",
1742
            "_view_count": null,
1743
            "_view_module": "@jupyter-widgets/controls",
1744
            "_view_module_version": "1.5.0",
1745
            "_view_name": "HTMLView",
1746
            "description": "",
1747
            "description_tooltip": null,
1748
            "layout": "IPY_MODEL_1045152b762f42e1898c631bad17e51f",
1749
            "placeholder": "​",
1750
            "style": "IPY_MODEL_b1ffc13351ef4cfea9cbb52f342fa968",
1751
            "value": " 1/1 [00:00&lt;00:00,  1.15it/s]"
1752
          }
1753
        },
1754
        "649a542ce0284222a7229db6f6b99f03": {
1755
          "model_module": "@jupyter-widgets/controls",
1756
          "model_module_version": "1.5.0",
1757
          "model_name": "DescriptionStyleModel",
1758
          "state": {
1759
            "_model_module": "@jupyter-widgets/controls",
1760
            "_model_module_version": "1.5.0",
1761
            "_model_name": "DescriptionStyleModel",
1762
            "_view_count": null,
1763
            "_view_module": "@jupyter-widgets/base",
1764
            "_view_module_version": "1.2.0",
1765
            "_view_name": "StyleView",
1766
            "description_width": ""
1767
          }
1768
        },
1769
        "66901c729a284ee7ab032df3cedd06be": {
1770
          "model_module": "@jupyter-widgets/base",
1771
          "model_module_version": "1.2.0",
1772
          "model_name": "LayoutModel",
1773
          "state": {
1774
            "_model_module": "@jupyter-widgets/base",
1775
            "_model_module_version": "1.2.0",
1776
            "_model_name": "LayoutModel",
1777
            "_view_count": null,
1778
            "_view_module": "@jupyter-widgets/base",
1779
            "_view_module_version": "1.2.0",
1780
            "_view_name": "LayoutView",
1781
            "align_content": null,
1782
            "align_items": null,
1783
            "align_self": null,
1784
            "border": null,
1785
            "bottom": null,
1786
            "display": null,
1787
            "flex": null,
1788
            "flex_flow": null,
1789
            "grid_area": null,
1790
            "grid_auto_columns": null,
1791
            "grid_auto_flow": null,
1792
            "grid_auto_rows": null,
1793
            "grid_column": null,
1794
            "grid_gap": null,
1795
            "grid_row": null,
1796
            "grid_template_areas": null,
1797
            "grid_template_columns": null,
1798
            "grid_template_rows": null,
1799
            "height": null,
1800
            "justify_content": null,
1801
            "justify_items": null,
1802
            "left": null,
1803
            "margin": null,
1804
            "max_height": null,
1805
            "max_width": null,
1806
            "min_height": null,
1807
            "min_width": null,
1808
            "object_fit": null,
1809
            "object_position": null,
1810
            "order": null,
1811
            "overflow": null,
1812
            "overflow_x": null,
1813
            "overflow_y": null,
1814
            "padding": null,
1815
            "right": null,
1816
            "top": null,
1817
            "visibility": null,
1818
            "width": null
1819
          }
1820
        },
1821
        "672941e696a2470c90733103473f183f": {
1822
          "model_module": "@jupyter-widgets/controls",
1823
          "model_module_version": "1.5.0",
1824
          "model_name": "ProgressStyleModel",
1825
          "state": {
1826
            "_model_module": "@jupyter-widgets/controls",
1827
            "_model_module_version": "1.5.0",
1828
            "_model_name": "ProgressStyleModel",
1829
            "_view_count": null,
1830
            "_view_module": "@jupyter-widgets/base",
1831
            "_view_module_version": "1.2.0",
1832
            "_view_name": "StyleView",
1833
            "bar_color": null,
1834
            "description_width": ""
1835
          }
1836
        },
1837
        "696ca9ac01a0406db8f749feee7cabba": {
1838
          "model_module": "@jupyter-widgets/controls",
1839
          "model_module_version": "1.5.0",
1840
          "model_name": "DescriptionStyleModel",
1841
          "state": {
1842
            "_model_module": "@jupyter-widgets/controls",
1843
            "_model_module_version": "1.5.0",
1844
            "_model_name": "DescriptionStyleModel",
1845
            "_view_count": null,
1846
            "_view_module": "@jupyter-widgets/base",
1847
            "_view_module_version": "1.2.0",
1848
            "_view_name": "StyleView",
1849
            "description_width": ""
1850
          }
1851
        },
1852
        "6f530ecab4a14a299a8572923c8df4eb": {
1853
          "model_module": "@jupyter-widgets/base",
1854
          "model_module_version": "1.2.0",
1855
          "model_name": "LayoutModel",
1856
          "state": {
1857
            "_model_module": "@jupyter-widgets/base",
1858
            "_model_module_version": "1.2.0",
1859
            "_model_name": "LayoutModel",
1860
            "_view_count": null,
1861
            "_view_module": "@jupyter-widgets/base",
1862
            "_view_module_version": "1.2.0",
1863
            "_view_name": "LayoutView",
1864
            "align_content": null,
1865
            "align_items": null,
1866
            "align_self": null,
1867
            "border": null,
1868
            "bottom": null,
1869
            "display": null,
1870
            "flex": null,
1871
            "flex_flow": null,
1872
            "grid_area": null,
1873
            "grid_auto_columns": null,
1874
            "grid_auto_flow": null,
1875
            "grid_auto_rows": null,
1876
            "grid_column": null,
1877
            "grid_gap": null,
1878
            "grid_row": null,
1879
            "grid_template_areas": null,
1880
            "grid_template_columns": null,
1881
            "grid_template_rows": null,
1882
            "height": null,
1883
            "justify_content": null,
1884
            "justify_items": null,
1885
            "left": null,
1886
            "margin": null,
1887
            "max_height": null,
1888
            "max_width": null,
1889
            "min_height": null,
1890
            "min_width": null,
1891
            "object_fit": null,
1892
            "object_position": null,
1893
            "order": null,
1894
            "overflow": null,
1895
            "overflow_x": null,
1896
            "overflow_y": null,
1897
            "padding": null,
1898
            "right": null,
1899
            "top": null,
1900
            "visibility": null,
1901
            "width": null
1902
          }
1903
        },
1904
        "71786e1530544f72856ffbd26ec01160": {
1905
          "model_module": "@jupyter-widgets/controls",
1906
          "model_module_version": "1.5.0",
1907
          "model_name": "ProgressStyleModel",
1908
          "state": {
1909
            "_model_module": "@jupyter-widgets/controls",
1910
            "_model_module_version": "1.5.0",
1911
            "_model_name": "ProgressStyleModel",
1912
            "_view_count": null,
1913
            "_view_module": "@jupyter-widgets/base",
1914
            "_view_module_version": "1.2.0",
1915
            "_view_name": "StyleView",
1916
            "bar_color": null,
1917
            "description_width": ""
1918
          }
1919
        },
1920
        "727c6aebc5c5440eb11ede9f5e2724c6": {
1921
          "model_module": "@jupyter-widgets/base",
1922
          "model_module_version": "1.2.0",
1923
          "model_name": "LayoutModel",
1924
          "state": {
1925
            "_model_module": "@jupyter-widgets/base",
1926
            "_model_module_version": "1.2.0",
1927
            "_model_name": "LayoutModel",
1928
            "_view_count": null,
1929
            "_view_module": "@jupyter-widgets/base",
1930
            "_view_module_version": "1.2.0",
1931
            "_view_name": "LayoutView",
1932
            "align_content": null,
1933
            "align_items": null,
1934
            "align_self": null,
1935
            "border": null,
1936
            "bottom": null,
1937
            "display": null,
1938
            "flex": null,
1939
            "flex_flow": null,
1940
            "grid_area": null,
1941
            "grid_auto_columns": null,
1942
            "grid_auto_flow": null,
1943
            "grid_auto_rows": null,
1944
            "grid_column": null,
1945
            "grid_gap": null,
1946
            "grid_row": null,
1947
            "grid_template_areas": null,
1948
            "grid_template_columns": null,
1949
            "grid_template_rows": null,
1950
            "height": null,
1951
            "justify_content": null,
1952
            "justify_items": null,
1953
            "left": null,
1954
            "margin": null,
1955
            "max_height": null,
1956
            "max_width": null,
1957
            "min_height": null,
1958
            "min_width": null,
1959
            "object_fit": null,
1960
            "object_position": null,
1961
            "order": null,
1962
            "overflow": null,
1963
            "overflow_x": null,
1964
            "overflow_y": null,
1965
            "padding": null,
1966
            "right": null,
1967
            "top": null,
1968
            "visibility": null,
1969
            "width": null
1970
          }
1971
        },
1972
        "74ed392c1fc04b4687a9b984b67f1873": {
1973
          "model_module": "@jupyter-widgets/controls",
1974
          "model_module_version": "1.5.0",
1975
          "model_name": "HBoxModel",
1976
          "state": {
1977
            "_dom_classes": [],
1978
            "_model_module": "@jupyter-widgets/controls",
1979
            "_model_module_version": "1.5.0",
1980
            "_model_name": "HBoxModel",
1981
            "_view_count": null,
1982
            "_view_module": "@jupyter-widgets/controls",
1983
            "_view_module_version": "1.5.0",
1984
            "_view_name": "HBoxView",
1985
            "box_style": "",
1986
            "children": [
1987
              "IPY_MODEL_437a5c91bcb047bd80ea5addbc23d900",
1988
              "IPY_MODEL_282743ec58ca4149b273fa069d3f1eb4",
1989
              "IPY_MODEL_3d9ff73e38de440a987ee67c733ad94b"
1990
            ],
1991
            "layout": "IPY_MODEL_4be5272d6dad4d77afe296f45d651229"
1992
          }
1993
        },
1994
        "76f7d8b0c51742d7808f8297653adb48": {
1995
          "model_module": "@jupyter-widgets/base",
1996
          "model_module_version": "1.2.0",
1997
          "model_name": "LayoutModel",
1998
          "state": {
1999
            "_model_module": "@jupyter-widgets/base",
2000
            "_model_module_version": "1.2.0",
2001
            "_model_name": "LayoutModel",
2002
            "_view_count": null,
2003
            "_view_module": "@jupyter-widgets/base",
2004
            "_view_module_version": "1.2.0",
2005
            "_view_name": "LayoutView",
2006
            "align_content": null,
2007
            "align_items": null,
2008
            "align_self": null,
2009
            "border": null,
2010
            "bottom": null,
2011
            "display": null,
2012
            "flex": null,
2013
            "flex_flow": null,
2014
            "grid_area": null,
2015
            "grid_auto_columns": null,
2016
            "grid_auto_flow": null,
2017
            "grid_auto_rows": null,
2018
            "grid_column": null,
2019
            "grid_gap": null,
2020
            "grid_row": null,
2021
            "grid_template_areas": null,
2022
            "grid_template_columns": null,
2023
            "grid_template_rows": null,
2024
            "height": null,
2025
            "justify_content": null,
2026
            "justify_items": null,
2027
            "left": null,
2028
            "margin": null,
2029
            "max_height": null,
2030
            "max_width": null,
2031
            "min_height": null,
2032
            "min_width": null,
2033
            "object_fit": null,
2034
            "object_position": null,
2035
            "order": null,
2036
            "overflow": null,
2037
            "overflow_x": null,
2038
            "overflow_y": null,
2039
            "padding": null,
2040
            "right": null,
2041
            "top": null,
2042
            "visibility": "hidden",
2043
            "width": null
2044
          }
2045
        },
2046
        "7b42a94359514a719c0127c8189715cc": {
2047
          "model_module": "@jupyter-widgets/controls",
2048
          "model_module_version": "1.5.0",
2049
          "model_name": "HBoxModel",
2050
          "state": {
2051
            "_dom_classes": [],
2052
            "_model_module": "@jupyter-widgets/controls",
2053
            "_model_module_version": "1.5.0",
2054
            "_model_name": "HBoxModel",
2055
            "_view_count": null,
2056
            "_view_module": "@jupyter-widgets/controls",
2057
            "_view_module_version": "1.5.0",
2058
            "_view_name": "HBoxView",
2059
            "box_style": "",
2060
            "children": [
2061
              "IPY_MODEL_4e96c7ec4451480880d3b929020391c0",
2062
              "IPY_MODEL_2fe7c9aa8eac4b6d940d1b5ca3ec8f6f",
2063
              "IPY_MODEL_5d73ff213fe245ae8d135637051f03f6"
2064
            ],
2065
            "layout": "IPY_MODEL_2ccd4caaab4a49809fd35475598933a0"
2066
          }
2067
        },
2068
        "846e801ba51b451b930b5ceb801ee080": {
2069
          "model_module": "@jupyter-widgets/base",
2070
          "model_module_version": "1.2.0",
2071
          "model_name": "LayoutModel",
2072
          "state": {
2073
            "_model_module": "@jupyter-widgets/base",
2074
            "_model_module_version": "1.2.0",
2075
            "_model_name": "LayoutModel",
2076
            "_view_count": null,
2077
            "_view_module": "@jupyter-widgets/base",
2078
            "_view_module_version": "1.2.0",
2079
            "_view_name": "LayoutView",
2080
            "align_content": null,
2081
            "align_items": null,
2082
            "align_self": null,
2083
            "border": null,
2084
            "bottom": null,
2085
            "display": null,
2086
            "flex": null,
2087
            "flex_flow": null,
2088
            "grid_area": null,
2089
            "grid_auto_columns": null,
2090
            "grid_auto_flow": null,
2091
            "grid_auto_rows": null,
2092
            "grid_column": null,
2093
            "grid_gap": null,
2094
            "grid_row": null,
2095
            "grid_template_areas": null,
2096
            "grid_template_columns": null,
2097
            "grid_template_rows": null,
2098
            "height": null,
2099
            "justify_content": null,
2100
            "justify_items": null,
2101
            "left": null,
2102
            "margin": null,
2103
            "max_height": null,
2104
            "max_width": null,
2105
            "min_height": null,
2106
            "min_width": null,
2107
            "object_fit": null,
2108
            "object_position": null,
2109
            "order": null,
2110
            "overflow": null,
2111
            "overflow_x": null,
2112
            "overflow_y": null,
2113
            "padding": null,
2114
            "right": null,
2115
            "top": null,
2116
            "visibility": null,
2117
            "width": null
2118
          }
2119
        },
2120
        "9241719b307142bba0a5c6ce6194d3ad": {
2121
          "model_module": "@jupyter-widgets/base",
2122
          "model_module_version": "1.2.0",
2123
          "model_name": "LayoutModel",
2124
          "state": {
2125
            "_model_module": "@jupyter-widgets/base",
2126
            "_model_module_version": "1.2.0",
2127
            "_model_name": "LayoutModel",
2128
            "_view_count": null,
2129
            "_view_module": "@jupyter-widgets/base",
2130
            "_view_module_version": "1.2.0",
2131
            "_view_name": "LayoutView",
2132
            "align_content": null,
2133
            "align_items": null,
2134
            "align_self": null,
2135
            "border": null,
2136
            "bottom": null,
2137
            "display": null,
2138
            "flex": null,
2139
            "flex_flow": null,
2140
            "grid_area": null,
2141
            "grid_auto_columns": null,
2142
            "grid_auto_flow": null,
2143
            "grid_auto_rows": null,
2144
            "grid_column": null,
2145
            "grid_gap": null,
2146
            "grid_row": null,
2147
            "grid_template_areas": null,
2148
            "grid_template_columns": null,
2149
            "grid_template_rows": null,
2150
            "height": null,
2151
            "justify_content": null,
2152
            "justify_items": null,
2153
            "left": null,
2154
            "margin": null,
2155
            "max_height": null,
2156
            "max_width": null,
2157
            "min_height": null,
2158
            "min_width": null,
2159
            "object_fit": null,
2160
            "object_position": null,
2161
            "order": null,
2162
            "overflow": null,
2163
            "overflow_x": null,
2164
            "overflow_y": null,
2165
            "padding": null,
2166
            "right": null,
2167
            "top": null,
2168
            "visibility": null,
2169
            "width": null
2170
          }
2171
        },
2172
        "974e1cf773af45b4b496aad741e1e06a": {
2173
          "model_module": "@jupyter-widgets/controls",
2174
          "model_module_version": "1.5.0",
2175
          "model_name": "HTMLModel",
2176
          "state": {
2177
            "_dom_classes": [],
2178
            "_model_module": "@jupyter-widgets/controls",
2179
            "_model_module_version": "1.5.0",
2180
            "_model_name": "HTMLModel",
2181
            "_view_count": null,
2182
            "_view_module": "@jupyter-widgets/controls",
2183
            "_view_module_version": "1.5.0",
2184
            "_view_name": "HTMLView",
2185
            "description": "",
2186
            "description_tooltip": null,
2187
            "layout": "IPY_MODEL_be4361412b1243eaad79958bd0502d0b",
2188
            "placeholder": "​",
2189
            "style": "IPY_MODEL_4387ccd1c9454888b8c0f532a0868d1b",
2190
            "value": "Downloading data: 100%"
2191
          }
2192
        },
2193
        "9f91876585664ee29c98396a124346a7": {
2194
          "model_module": "@jupyter-widgets/controls",
2195
          "model_module_version": "1.5.0",
2196
          "model_name": "ProgressStyleModel",
2197
          "state": {
2198
            "_model_module": "@jupyter-widgets/controls",
2199
            "_model_module_version": "1.5.0",
2200
            "_model_name": "ProgressStyleModel",
2201
            "_view_count": null,
2202
            "_view_module": "@jupyter-widgets/base",
2203
            "_view_module_version": "1.2.0",
2204
            "_view_name": "StyleView",
2205
            "bar_color": null,
2206
            "description_width": ""
2207
          }
2208
        },
2209
        "ae281774279e4a5683fb1c9b0e6286ed": {
2210
          "model_module": "@jupyter-widgets/base",
2211
          "model_module_version": "1.2.0",
2212
          "model_name": "LayoutModel",
2213
          "state": {
2214
            "_model_module": "@jupyter-widgets/base",
2215
            "_model_module_version": "1.2.0",
2216
            "_model_name": "LayoutModel",
2217
            "_view_count": null,
2218
            "_view_module": "@jupyter-widgets/base",
2219
            "_view_module_version": "1.2.0",
2220
            "_view_name": "LayoutView",
2221
            "align_content": null,
2222
            "align_items": null,
2223
            "align_self": null,
2224
            "border": null,
2225
            "bottom": null,
2226
            "display": null,
2227
            "flex": null,
2228
            "flex_flow": null,
2229
            "grid_area": null,
2230
            "grid_auto_columns": null,
2231
            "grid_auto_flow": null,
2232
            "grid_auto_rows": null,
2233
            "grid_column": null,
2234
            "grid_gap": null,
2235
            "grid_row": null,
2236
            "grid_template_areas": null,
2237
            "grid_template_columns": null,
2238
            "grid_template_rows": null,
2239
            "height": null,
2240
            "justify_content": null,
2241
            "justify_items": null,
2242
            "left": null,
2243
            "margin": null,
2244
            "max_height": null,
2245
            "max_width": null,
2246
            "min_height": null,
2247
            "min_width": null,
2248
            "object_fit": null,
2249
            "object_position": null,
2250
            "order": null,
2251
            "overflow": null,
2252
            "overflow_x": null,
2253
            "overflow_y": null,
2254
            "padding": null,
2255
            "right": null,
2256
            "top": null,
2257
            "visibility": null,
2258
            "width": null
2259
          }
2260
        },
2261
        "b1ffc13351ef4cfea9cbb52f342fa968": {
2262
          "model_module": "@jupyter-widgets/controls",
2263
          "model_module_version": "1.5.0",
2264
          "model_name": "DescriptionStyleModel",
2265
          "state": {
2266
            "_model_module": "@jupyter-widgets/controls",
2267
            "_model_module_version": "1.5.0",
2268
            "_model_name": "DescriptionStyleModel",
2269
            "_view_count": null,
2270
            "_view_module": "@jupyter-widgets/base",
2271
            "_view_module_version": "1.2.0",
2272
            "_view_name": "StyleView",
2273
            "description_width": ""
2274
          }
2275
        },
2276
        "b59a844fd64a4bd6a28d6cf17aaece29": {
2277
          "model_module": "@jupyter-widgets/controls",
2278
          "model_module_version": "1.5.0",
2279
          "model_name": "DescriptionStyleModel",
2280
          "state": {
2281
            "_model_module": "@jupyter-widgets/controls",
2282
            "_model_module_version": "1.5.0",
2283
            "_model_name": "DescriptionStyleModel",
2284
            "_view_count": null,
2285
            "_view_module": "@jupyter-widgets/base",
2286
            "_view_module_version": "1.2.0",
2287
            "_view_name": "StyleView",
2288
            "description_width": ""
2289
          }
2290
        },
2291
        "b5cf4013a0d441a69ea16ff14f44e4c4": {
2292
          "model_module": "@jupyter-widgets/base",
2293
          "model_module_version": "1.2.0",
2294
          "model_name": "LayoutModel",
2295
          "state": {
2296
            "_model_module": "@jupyter-widgets/base",
2297
            "_model_module_version": "1.2.0",
2298
            "_model_name": "LayoutModel",
2299
            "_view_count": null,
2300
            "_view_module": "@jupyter-widgets/base",
2301
            "_view_module_version": "1.2.0",
2302
            "_view_name": "LayoutView",
2303
            "align_content": null,
2304
            "align_items": null,
2305
            "align_self": null,
2306
            "border": null,
2307
            "bottom": null,
2308
            "display": null,
2309
            "flex": null,
2310
            "flex_flow": null,
2311
            "grid_area": null,
2312
            "grid_auto_columns": null,
2313
            "grid_auto_flow": null,
2314
            "grid_auto_rows": null,
2315
            "grid_column": null,
2316
            "grid_gap": null,
2317
            "grid_row": null,
2318
            "grid_template_areas": null,
2319
            "grid_template_columns": null,
2320
            "grid_template_rows": null,
2321
            "height": null,
2322
            "justify_content": null,
2323
            "justify_items": null,
2324
            "left": null,
2325
            "margin": null,
2326
            "max_height": null,
2327
            "max_width": null,
2328
            "min_height": null,
2329
            "min_width": null,
2330
            "object_fit": null,
2331
            "object_position": null,
2332
            "order": null,
2333
            "overflow": null,
2334
            "overflow_x": null,
2335
            "overflow_y": null,
2336
            "padding": null,
2337
            "right": null,
2338
            "top": null,
2339
            "visibility": null,
2340
            "width": "20px"
2341
          }
2342
        },
2343
        "be4361412b1243eaad79958bd0502d0b": {
2344
          "model_module": "@jupyter-widgets/base",
2345
          "model_module_version": "1.2.0",
2346
          "model_name": "LayoutModel",
2347
          "state": {
2348
            "_model_module": "@jupyter-widgets/base",
2349
            "_model_module_version": "1.2.0",
2350
            "_model_name": "LayoutModel",
2351
            "_view_count": null,
2352
            "_view_module": "@jupyter-widgets/base",
2353
            "_view_module_version": "1.2.0",
2354
            "_view_name": "LayoutView",
2355
            "align_content": null,
2356
            "align_items": null,
2357
            "align_self": null,
2358
            "border": null,
2359
            "bottom": null,
2360
            "display": null,
2361
            "flex": null,
2362
            "flex_flow": null,
2363
            "grid_area": null,
2364
            "grid_auto_columns": null,
2365
            "grid_auto_flow": null,
2366
            "grid_auto_rows": null,
2367
            "grid_column": null,
2368
            "grid_gap": null,
2369
            "grid_row": null,
2370
            "grid_template_areas": null,
2371
            "grid_template_columns": null,
2372
            "grid_template_rows": null,
2373
            "height": null,
2374
            "justify_content": null,
2375
            "justify_items": null,
2376
            "left": null,
2377
            "margin": null,
2378
            "max_height": null,
2379
            "max_width": null,
2380
            "min_height": null,
2381
            "min_width": null,
2382
            "object_fit": null,
2383
            "object_position": null,
2384
            "order": null,
2385
            "overflow": null,
2386
            "overflow_x": null,
2387
            "overflow_y": null,
2388
            "padding": null,
2389
            "right": null,
2390
            "top": null,
2391
            "visibility": null,
2392
            "width": null
2393
          }
2394
        },
2395
        "bf9b362011314503b064412f66f8e51f": {
2396
          "model_module": "@jupyter-widgets/controls",
2397
          "model_module_version": "1.5.0",
2398
          "model_name": "DescriptionStyleModel",
2399
          "state": {
2400
            "_model_module": "@jupyter-widgets/controls",
2401
            "_model_module_version": "1.5.0",
2402
            "_model_name": "DescriptionStyleModel",
2403
            "_view_count": null,
2404
            "_view_module": "@jupyter-widgets/base",
2405
            "_view_module_version": "1.2.0",
2406
            "_view_name": "StyleView",
2407
            "description_width": ""
2408
          }
2409
        },
2410
        "c7763f4356714d558701b54485039613": {
2411
          "model_module": "@jupyter-widgets/controls",
2412
          "model_module_version": "1.5.0",
2413
          "model_name": "HBoxModel",
2414
          "state": {
2415
            "_dom_classes": [],
2416
            "_model_module": "@jupyter-widgets/controls",
2417
            "_model_module_version": "1.5.0",
2418
            "_model_name": "HBoxModel",
2419
            "_view_count": null,
2420
            "_view_module": "@jupyter-widgets/controls",
2421
            "_view_module_version": "1.5.0",
2422
            "_view_name": "HBoxView",
2423
            "box_style": "",
2424
            "children": [
2425
              "IPY_MODEL_d6c342c5d7594c07bf546143adde3f2d",
2426
              "IPY_MODEL_5a35182953dd4c4c9e4db151dc2fce2c",
2427
              "IPY_MODEL_cd138a72677b4d0abbbaa4a0161ac999"
2428
            ],
2429
            "layout": "IPY_MODEL_76f7d8b0c51742d7808f8297653adb48"
2430
          }
2431
        },
2432
        "cd138a72677b4d0abbbaa4a0161ac999": {
2433
          "model_module": "@jupyter-widgets/controls",
2434
          "model_module_version": "1.5.0",
2435
          "model_name": "HTMLModel",
2436
          "state": {
2437
            "_dom_classes": [],
2438
            "_model_module": "@jupyter-widgets/controls",
2439
            "_model_module_version": "1.5.0",
2440
            "_model_name": "HTMLModel",
2441
            "_view_count": null,
2442
            "_view_module": "@jupyter-widgets/controls",
2443
            "_view_module_version": "1.5.0",
2444
            "_view_name": "HTMLView",
2445
            "description": "",
2446
            "description_tooltip": null,
2447
            "layout": "IPY_MODEL_846e801ba51b451b930b5ceb801ee080",
2448
            "placeholder": "​",
2449
            "style": "IPY_MODEL_649a542ce0284222a7229db6f6b99f03",
2450
            "value": " 98/0 [00:00&lt;00:00, 900.52 examples/s]"
2451
          }
2452
        },
2453
        "d6c342c5d7594c07bf546143adde3f2d": {
2454
          "model_module": "@jupyter-widgets/controls",
2455
          "model_module_version": "1.5.0",
2456
          "model_name": "HTMLModel",
2457
          "state": {
2458
            "_dom_classes": [],
2459
            "_model_module": "@jupyter-widgets/controls",
2460
            "_model_module_version": "1.5.0",
2461
            "_model_name": "HTMLModel",
2462
            "_view_count": null,
2463
            "_view_module": "@jupyter-widgets/controls",
2464
            "_view_module_version": "1.5.0",
2465
            "_view_name": "HTMLView",
2466
            "description": "",
2467
            "description_tooltip": null,
2468
            "layout": "IPY_MODEL_6f530ecab4a14a299a8572923c8df4eb",
2469
            "placeholder": "​",
2470
            "style": "IPY_MODEL_d7b86543a6d649328e848c2a284aca92",
2471
            "value": "Generating train split: "
2472
          }
2473
        },
2474
        "d7b86543a6d649328e848c2a284aca92": {
2475
          "model_module": "@jupyter-widgets/controls",
2476
          "model_module_version": "1.5.0",
2477
          "model_name": "DescriptionStyleModel",
2478
          "state": {
2479
            "_model_module": "@jupyter-widgets/controls",
2480
            "_model_module_version": "1.5.0",
2481
            "_model_name": "DescriptionStyleModel",
2482
            "_view_count": null,
2483
            "_view_module": "@jupyter-widgets/base",
2484
            "_view_module_version": "1.2.0",
2485
            "_view_name": "StyleView",
2486
            "description_width": ""
2487
          }
2488
        },
2489
        "f3fba8e406da4f5799725869a50b0660": {
2490
          "model_module": "@jupyter-widgets/controls",
2491
          "model_module_version": "1.5.0",
2492
          "model_name": "ProgressStyleModel",
2493
          "state": {
2494
            "_model_module": "@jupyter-widgets/controls",
2495
            "_model_module_version": "1.5.0",
2496
            "_model_name": "ProgressStyleModel",
2497
            "_view_count": null,
2498
            "_view_module": "@jupyter-widgets/base",
2499
            "_view_module_version": "1.2.0",
2500
            "_view_name": "StyleView",
2501
            "bar_color": null,
2502
            "description_width": ""
2503
          }
2504
        },
2505
        "fce282dc88c44c7d9403ac066891f025": {
2506
          "model_module": "@jupyter-widgets/base",
2507
          "model_module_version": "1.2.0",
2508
          "model_name": "LayoutModel",
2509
          "state": {
2510
            "_model_module": "@jupyter-widgets/base",
2511
            "_model_module_version": "1.2.0",
2512
            "_model_name": "LayoutModel",
2513
            "_view_count": null,
2514
            "_view_module": "@jupyter-widgets/base",
2515
            "_view_module_version": "1.2.0",
2516
            "_view_name": "LayoutView",
2517
            "align_content": null,
2518
            "align_items": null,
2519
            "align_self": null,
2520
            "border": null,
2521
            "bottom": null,
2522
            "display": null,
2523
            "flex": null,
2524
            "flex_flow": null,
2525
            "grid_area": null,
2526
            "grid_auto_columns": null,
2527
            "grid_auto_flow": null,
2528
            "grid_auto_rows": null,
2529
            "grid_column": null,
2530
            "grid_gap": null,
2531
            "grid_row": null,
2532
            "grid_template_areas": null,
2533
            "grid_template_columns": null,
2534
            "grid_template_rows": null,
2535
            "height": null,
2536
            "justify_content": null,
2537
            "justify_items": null,
2538
            "left": null,
2539
            "margin": null,
2540
            "max_height": null,
2541
            "max_width": null,
2542
            "min_height": null,
2543
            "min_width": null,
2544
            "object_fit": null,
2545
            "object_position": null,
2546
            "order": null,
2547
            "overflow": null,
2548
            "overflow_x": null,
2549
            "overflow_y": null,
2550
            "padding": null,
2551
            "right": null,
2552
            "top": null,
2553
            "visibility": null,
2554
            "width": null
2555
          }
2556
        }
2557
      }
2558
    }
2559
  },
2560
  "nbformat": 4,
2561
  "nbformat_minor": 0
2562
}
2563

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.