|
46 | 46 | }, |
47 | 47 | { |
48 | 48 | "cell_type": "code", |
49 | | - "execution_count": 1, |
| 49 | + "execution_count": null, |
50 | 50 | "metadata": { |
51 | 51 | "vscode": { |
52 | 52 | "languageId": "shellscript" |
53 | 53 | } |
54 | 54 | }, |
55 | | - "outputs": [ |
56 | | - { |
57 | | - "name": "stdout", |
58 | | - "output_type": "stream", |
59 | | - "text": [ |
60 | | - "Collecting langchain==0.0.245\n", |
61 | | - " Using cached langchain-0.0.245-py3-none-any.whl (1.4 MB)\n", |
62 | | - "Collecting jq\n", |
63 | | - " Using cached jq-1.4.1-cp310-cp310-macosx_11_0_arm64.whl\n", |
64 | | - "Collecting openai\n", |
65 | | - " Using cached openai-0.27.8-py3-none-any.whl (73 kB)\n", |
66 | | - "Collecting elasticsearch\n", |
67 | | - " Using cached elasticsearch-8.9.0-py3-none-any.whl (395 kB)\n", |
68 | | - "Collecting tiktoken\n", |
69 | | - " Using cached tiktoken-0.4.0-cp310-cp310-macosx_11_0_arm64.whl (761 kB)\n", |
70 | | - "Collecting PyYAML>=5.4.1\n", |
71 | | - " Using cached PyYAML-6.0.1-cp310-cp310-macosx_11_0_arm64.whl (169 kB)\n", |
72 | | - "Collecting tenacity<9.0.0,>=8.1.0\n", |
73 | | - " Using cached tenacity-8.2.2-py3-none-any.whl (24 kB)\n", |
74 | | - "Collecting numpy<2,>=1\n", |
75 | | - " Using cached numpy-1.25.2-cp310-cp310-macosx_11_0_arm64.whl (14.0 MB)\n", |
76 | | - "Collecting pydantic<2,>=1\n", |
77 | | - " Using cached pydantic-1.10.12-cp310-cp310-macosx_11_0_arm64.whl (2.5 MB)\n", |
78 | | - "Collecting aiohttp<4.0.0,>=3.8.3\n", |
79 | | - " Using cached aiohttp-3.8.5-cp310-cp310-macosx_11_0_arm64.whl (343 kB)\n", |
80 | | - "Collecting langsmith<0.1.0,>=0.0.11\n", |
81 | | - " Using cached langsmith-0.0.20-py3-none-any.whl (32 kB)\n", |
82 | | - "Collecting dataclasses-json<0.6.0,>=0.5.7\n", |
83 | | - " Using cached dataclasses_json-0.5.14-py3-none-any.whl (26 kB)\n", |
84 | | - "Collecting numexpr<3.0.0,>=2.8.4\n", |
85 | | - " Using cached numexpr-2.8.5-cp310-cp310-macosx_11_0_arm64.whl (90 kB)\n", |
86 | | - "Collecting requests<3,>=2\n", |
87 | | - " Using cached requests-2.31.0-py3-none-any.whl (62 kB)\n", |
88 | | - "Collecting openapi-schema-pydantic<2.0,>=1.2\n", |
89 | | - " Using cached openapi_schema_pydantic-1.2.4-py3-none-any.whl (90 kB)\n", |
90 | | - "Collecting SQLAlchemy<3,>=1.4\n", |
91 | | - " Using cached SQLAlchemy-2.0.19-cp310-cp310-macosx_11_0_arm64.whl (2.0 MB)\n", |
92 | | - "Collecting async-timeout<5.0.0,>=4.0.0\n", |
93 | | - " Using cached async_timeout-4.0.2-py3-none-any.whl (5.8 kB)\n", |
94 | | - "Collecting tqdm\n", |
95 | | - " Downloading tqdm-4.66.0-py3-none-any.whl (78 kB)\n", |
96 | | - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m78.1/78.1 kB\u001b[0m \u001b[31m2.8 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0m\n", |
97 | | - "\u001b[?25hCollecting elastic-transport<9,>=8\n", |
98 | | - " Using cached elastic_transport-8.4.0-py3-none-any.whl (59 kB)\n", |
99 | | - "Collecting regex>=2022.1.18\n", |
100 | | - " Downloading regex-2023.8.8-cp310-cp310-macosx_11_0_arm64.whl (289 kB)\n", |
101 | | - "\u001b[2K \u001b[90m━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\u001b[0m \u001b[32m289.3/289.3 kB\u001b[0m \u001b[31m5.6 MB/s\u001b[0m eta \u001b[36m0:00:00\u001b[0ma \u001b[36m0:00:01\u001b[0m\n", |
102 | | - "\u001b[?25hCollecting yarl<2.0,>=1.0\n", |
103 | | - " Using cached yarl-1.9.2-cp310-cp310-macosx_11_0_arm64.whl (62 kB)\n", |
104 | | - "Collecting attrs>=17.3.0\n", |
105 | | - " Using cached attrs-23.1.0-py3-none-any.whl (61 kB)\n", |
106 | | - "Collecting frozenlist>=1.1.1\n", |
107 | | - " Using cached frozenlist-1.4.0-cp310-cp310-macosx_11_0_arm64.whl (46 kB)\n", |
108 | | - "Collecting aiosignal>=1.1.2\n", |
109 | | - " Using cached aiosignal-1.3.1-py3-none-any.whl (7.6 kB)\n", |
110 | | - "Collecting charset-normalizer<4.0,>=2.0\n", |
111 | | - " Using cached charset_normalizer-3.2.0-cp310-cp310-macosx_11_0_arm64.whl (124 kB)\n", |
112 | | - "Collecting multidict<7.0,>=4.5\n", |
113 | | - " Using cached multidict-6.0.4-cp310-cp310-macosx_11_0_arm64.whl (29 kB)\n", |
114 | | - "Collecting marshmallow<4.0.0,>=3.18.0\n", |
115 | | - " Using cached marshmallow-3.20.1-py3-none-any.whl (49 kB)\n", |
116 | | - "Collecting typing-inspect<1,>=0.4.0\n", |
117 | | - " Using cached typing_inspect-0.9.0-py3-none-any.whl (8.8 kB)\n", |
118 | | - "Collecting urllib3<2,>=1.26.2\n", |
119 | | - " Using cached urllib3-1.26.16-py2.py3-none-any.whl (143 kB)\n", |
120 | | - "Collecting certifi\n", |
121 | | - " Using cached certifi-2023.7.22-py3-none-any.whl (158 kB)\n", |
122 | | - "Collecting typing-extensions>=4.2.0\n", |
123 | | - " Using cached typing_extensions-4.7.1-py3-none-any.whl (33 kB)\n", |
124 | | - "Collecting idna<4,>=2.5\n", |
125 | | - " Using cached idna-3.4-py3-none-any.whl (61 kB)\n", |
126 | | - "Requirement already satisfied: packaging>=17.0 in /Users/demjened/workspace/elasticsearch-labs/.venv/lib/python3.10/site-packages (from marshmallow<4.0.0,>=3.18.0->dataclasses-json<0.6.0,>=0.5.7->langchain==0.0.245) (23.1)\n", |
127 | | - "Collecting mypy-extensions>=0.3.0\n", |
128 | | - " Using cached mypy_extensions-1.0.0-py3-none-any.whl (4.7 kB)\n", |
129 | | - "Installing collected packages: urllib3, typing-extensions, tqdm, tenacity, regex, PyYAML, numpy, mypy-extensions, multidict, marshmallow, jq, idna, frozenlist, charset-normalizer, certifi, attrs, async-timeout, yarl, typing-inspect, SQLAlchemy, requests, pydantic, numexpr, elastic-transport, aiosignal, tiktoken, openapi-schema-pydantic, langsmith, elasticsearch, dataclasses-json, aiohttp, openai, langchain\n", |
130 | | - "Successfully installed PyYAML-6.0.1 SQLAlchemy-2.0.19 aiohttp-3.8.5 aiosignal-1.3.1 async-timeout-4.0.2 attrs-23.1.0 certifi-2023.7.22 charset-normalizer-3.2.0 dataclasses-json-0.5.14 elastic-transport-8.4.0 elasticsearch-8.9.0 frozenlist-1.4.0 idna-3.4 jq-1.4.1 langchain-0.0.245 langsmith-0.0.20 marshmallow-3.20.1 multidict-6.0.4 mypy-extensions-1.0.0 numexpr-2.8.5 numpy-1.25.2 openai-0.27.8 openapi-schema-pydantic-1.2.4 pydantic-1.10.12 regex-2023.8.8 requests-2.31.0 tenacity-8.2.2 tiktoken-0.4.0 tqdm-4.66.0 typing-extensions-4.7.1 typing-inspect-0.9.0 urllib3-1.26.16 yarl-1.9.2\n", |
131 | | - "\n", |
132 | | - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip available: \u001b[0m\u001b[31;49m22.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.2.1\u001b[0m\n", |
133 | | - "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n", |
134 | | - "Note: you may need to restart the kernel to use updated packages.\n" |
135 | | - ] |
136 | | - } |
137 | | - ], |
| 55 | + "outputs": [], |
138 | 56 | "source": [ |
139 | 57 | "%pip install -U langchain==0.0.245 jq openai elasticsearch tiktoken" |
140 | 58 | ] |
|
150 | 68 | }, |
151 | 69 | { |
152 | 70 | "cell_type": "code", |
153 | | - "execution_count": 2, |
| 71 | + "execution_count": null, |
154 | 72 | "metadata": {}, |
155 | 73 | "outputs": [], |
156 | 74 | "source": [ |
|
171 | 89 | }, |
172 | 90 | { |
173 | 91 | "cell_type": "code", |
174 | | - "execution_count": 52, |
| 92 | + "execution_count": 73, |
175 | 93 | "metadata": {}, |
176 | 94 | "outputs": [ |
177 | 95 | { |
|
207 | 125 | }, |
208 | 126 | { |
209 | 127 | "cell_type": "code", |
210 | | - "execution_count": 22, |
| 128 | + "execution_count": null, |
211 | 129 | "metadata": {}, |
212 | | - "outputs": [ |
213 | | - { |
214 | | - "data": { |
215 | | - "text/plain": [ |
216 | | - "ObjectApiResponse({'acknowledged': True, 'shards_acknowledged': True, 'index': 'workplace_docs'})" |
217 | | - ] |
218 | | - }, |
219 | | - "execution_count": 22, |
220 | | - "metadata": {}, |
221 | | - "output_type": "execute_result" |
222 | | - } |
223 | | - ], |
| 130 | + "outputs": [], |
224 | 131 | "source": [ |
225 | 132 | "mappings = {\n", |
226 | 133 | " \"properties\": {\n", |
|
251 | 158 | }, |
252 | 159 | { |
253 | 160 | "cell_type": "code", |
254 | | - "execution_count": 11, |
| 161 | + "execution_count": 74, |
255 | 162 | "metadata": {}, |
256 | 163 | "outputs": [ |
257 | 164 | { |
|
286 | 193 | }, |
287 | 194 | { |
288 | 195 | "cell_type": "code", |
289 | | - "execution_count": 60, |
| 196 | + "execution_count": 76, |
290 | 197 | "metadata": {}, |
291 | 198 | "outputs": [ |
292 | 199 | { |
|
336 | 243 | }, |
337 | 244 | { |
338 | 245 | "cell_type": "code", |
339 | | - "execution_count": 26, |
| 246 | + "execution_count": 77, |
340 | 247 | "metadata": {}, |
341 | 248 | "outputs": [ |
342 | 249 | { |
|
390 | 297 | }, |
391 | 298 | { |
392 | 299 | "cell_type": "code", |
393 | | - "execution_count": 61, |
| 300 | + "execution_count": 78, |
394 | 301 | "metadata": {}, |
395 | 302 | "outputs": [], |
396 | 303 | "source": [ |
|
426 | 333 | }, |
427 | 334 | { |
428 | 335 | "cell_type": "code", |
429 | | - "execution_count": 62, |
| 336 | + "execution_count": 79, |
430 | 337 | "metadata": {}, |
431 | 338 | "outputs": [ |
432 | 339 | { |
|
437 | 344 | "ANSWER: NASA stands for North America South America. \n", |
438 | 345 | "SUPPORTING DOCUMENTS: ['Sales Organization Overview', 'Code Of Conduct', 'Code Of Conduct', 'Swe Career Matrix']\n", |
439 | 346 | "QUESTION: Which countries are part of it? \n", |
440 | | - "ANSWER: The countries in the North America South America region are the United States, Canada, Mexico, as well as Central and South America. \n", |
| 347 | + "ANSWER: The North America South America region includes the United States, Canada, Mexico, as well as Central and South America. \n", |
441 | 348 | "SUPPORTING DOCUMENTS: ['Sales Organization Overview', 'Sales Organization Overview', 'Sales Organization Overview', 'Fy2024 Company Sales Strategy']\n", |
442 | 349 | "QUESTION: Who are the team's leads? \n", |
443 | | - "ANSWER: The leads of the North America South America (NASA) team are Laura Martinez (Area Vice-President of North America) and Gary Johnson (Area Vice-President of South America). \n", |
444 | | - "SUPPORTING DOCUMENTS: ['Sales Organization Overview', 'Sales Organization Overview', 'Sales Organization Overview', 'Swe Career Matrix']\n" |
| 350 | + "ANSWER: Laura Martinez is the Area Vice-President of North America, and Gary Johnson is the Area Vice-President of South America. \n", |
| 351 | + "SUPPORTING DOCUMENTS: ['Sales Organization Overview', 'Sales Organization Overview', 'Swe Career Matrix', 'Swe Career Matrix']\n" |
445 | 352 | ] |
446 | 353 | } |
447 | 354 | ], |
|
480 | 387 | }, |
481 | 388 | { |
482 | 389 | "cell_type": "code", |
483 | | - "execution_count": 63, |
| 390 | + "execution_count": 80, |
484 | 391 | "metadata": {}, |
485 | 392 | "outputs": [ |
486 | 393 | { |
487 | | - "ename": "NotFoundError", |
488 | | - "evalue": "NotFoundError(404, 'index_not_found_exception', 'no such index [workplace-docs]', workplace-docs, index_or_alias)", |
489 | | - "output_type": "error", |
490 | | - "traceback": [ |
491 | | - "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", |
492 | | - "\u001b[0;31mNotFoundError\u001b[0m Traceback (most recent call last)", |
493 | | - "Cell \u001b[0;32mIn[63], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m elasticsearch_client\u001b[39m.\u001b[39;49mindices\u001b[39m.\u001b[39;49mdelete(index\u001b[39m=\u001b[39;49m\u001b[39m'\u001b[39;49m\u001b[39mworkplace-docs\u001b[39;49m\u001b[39m'\u001b[39;49m)\n", |
494 | | - "File \u001b[0;32m~/workspace/elasticsearch-labs/.venv/lib/python3.10/site-packages/elasticsearch/_sync/client/utils.py:414\u001b[0m, in \u001b[0;36m_rewrite_parameters.<locals>.wrapper.<locals>.wrapped\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 411\u001b[0m \u001b[39mexcept\u001b[39;00m \u001b[39mKeyError\u001b[39;00m:\n\u001b[1;32m 412\u001b[0m \u001b[39mpass\u001b[39;00m\n\u001b[0;32m--> 414\u001b[0m \u001b[39mreturn\u001b[39;00m api(\u001b[39m*\u001b[39;49margs, \u001b[39m*\u001b[39;49m\u001b[39m*\u001b[39;49mkwargs)\n", |
495 | | - "File \u001b[0;32m~/workspace/elasticsearch-labs/.venv/lib/python3.10/site-packages/elasticsearch/_sync/client/indices.py:690\u001b[0m, in \u001b[0;36mIndicesClient.delete\u001b[0;34m(self, index, allow_no_indices, error_trace, expand_wildcards, filter_path, human, ignore_unavailable, master_timeout, pretty, timeout)\u001b[0m\n\u001b[1;32m 688\u001b[0m __query[\u001b[39m\"\u001b[39m\u001b[39mtimeout\u001b[39m\u001b[39m\"\u001b[39m] \u001b[39m=\u001b[39m timeout\n\u001b[1;32m 689\u001b[0m __headers \u001b[39m=\u001b[39m {\u001b[39m\"\u001b[39m\u001b[39maccept\u001b[39m\u001b[39m\"\u001b[39m: \u001b[39m\"\u001b[39m\u001b[39mapplication/json\u001b[39m\u001b[39m\"\u001b[39m}\n\u001b[0;32m--> 690\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49mperform_request( \u001b[39m# type: ignore[return-value]\u001b[39;49;00m\n\u001b[1;32m 691\u001b[0m \u001b[39m\"\u001b[39;49m\u001b[39mDELETE\u001b[39;49m\u001b[39m\"\u001b[39;49m, __path, params\u001b[39m=\u001b[39;49m__query, headers\u001b[39m=\u001b[39;49m__headers\n\u001b[1;32m 692\u001b[0m )\n", |
496 | | - "File \u001b[0;32m~/workspace/elasticsearch-labs/.venv/lib/python3.10/site-packages/elasticsearch/_sync/client/_base.py:389\u001b[0m, in \u001b[0;36mNamespacedClient.perform_request\u001b[0;34m(self, method, path, params, headers, body)\u001b[0m\n\u001b[1;32m 378\u001b[0m \u001b[39mdef\u001b[39;00m \u001b[39mperform_request\u001b[39m(\n\u001b[1;32m 379\u001b[0m \u001b[39mself\u001b[39m,\n\u001b[1;32m 380\u001b[0m method: \u001b[39mstr\u001b[39m,\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 387\u001b[0m \u001b[39m# Use the internal clients .perform_request() implementation\u001b[39;00m\n\u001b[1;32m 388\u001b[0m \u001b[39m# so we take advantage of their transport options.\u001b[39;00m\n\u001b[0;32m--> 389\u001b[0m \u001b[39mreturn\u001b[39;00m \u001b[39mself\u001b[39;49m\u001b[39m.\u001b[39;49m_client\u001b[39m.\u001b[39;49mperform_request(\n\u001b[1;32m 390\u001b[0m method, path, params\u001b[39m=\u001b[39;49mparams, headers\u001b[39m=\u001b[39;49mheaders, body\u001b[39m=\u001b[39;49mbody\n\u001b[1;32m 391\u001b[0m )\n", |
497 | | - "File \u001b[0;32m~/workspace/elasticsearch-labs/.venv/lib/python3.10/site-packages/elasticsearch/_sync/client/_base.py:320\u001b[0m, in \u001b[0;36mBaseClient.perform_request\u001b[0;34m(self, method, path, params, headers, body)\u001b[0m\n\u001b[1;32m 317\u001b[0m \u001b[39mexcept\u001b[39;00m (\u001b[39mValueError\u001b[39;00m, \u001b[39mKeyError\u001b[39;00m, \u001b[39mTypeError\u001b[39;00m):\n\u001b[1;32m 318\u001b[0m \u001b[39mpass\u001b[39;00m\n\u001b[0;32m--> 320\u001b[0m \u001b[39mraise\u001b[39;00m HTTP_EXCEPTIONS\u001b[39m.\u001b[39mget(meta\u001b[39m.\u001b[39mstatus, ApiError)(\n\u001b[1;32m 321\u001b[0m message\u001b[39m=\u001b[39mmessage, meta\u001b[39m=\u001b[39mmeta, body\u001b[39m=\u001b[39mresp_body\n\u001b[1;32m 322\u001b[0m )\n\u001b[1;32m 324\u001b[0m \u001b[39m# 'X-Elastic-Product: Elasticsearch' should be on every 2XX response.\u001b[39;00m\n\u001b[1;32m 325\u001b[0m \u001b[39mif\u001b[39;00m \u001b[39mnot\u001b[39;00m \u001b[39mself\u001b[39m\u001b[39m.\u001b[39m_verified_elasticsearch:\n\u001b[1;32m 326\u001b[0m \u001b[39m# If the header is set we mark the server as verified.\u001b[39;00m\n", |
498 | | - "\u001b[0;31mNotFoundError\u001b[0m: NotFoundError(404, 'index_not_found_exception', 'no such index [workplace-docs]', workplace-docs, index_or_alias)" |
499 | | - ] |
| 394 | + "data": { |
| 395 | + "text/plain": [ |
| 396 | + "ObjectApiResponse({'acknowledged': True})" |
| 397 | + ] |
| 398 | + }, |
| 399 | + "execution_count": 80, |
| 400 | + "metadata": {}, |
| 401 | + "output_type": "execute_result" |
500 | 402 | } |
501 | 403 | ], |
502 | 404 | "source": [ |
|
0 commit comments