|
32 | 32 | }, |
33 | 33 | { |
34 | 34 | "cell_type": "code", |
35 | | - "execution_count": 56, |
| 35 | + "execution_count": 1, |
36 | 36 | "metadata": {}, |
37 | 37 | "outputs": [], |
38 | 38 | "source": [ |
|
88 | 88 | }, |
89 | 89 | { |
90 | 90 | "cell_type": "code", |
91 | | - "execution_count": 57, |
| 91 | + "execution_count": 2, |
92 | 92 | "metadata": {}, |
93 | | - "outputs": [], |
| 93 | + "outputs": [ |
| 94 | + { |
| 95 | + "name": "stderr", |
| 96 | + "output_type": "stream", |
| 97 | + "text": [ |
| 98 | + "/Users/robert.shelton/Library/Caches/pypoetry/virtualenvs/redisvl-56gG2io_-py3.11/lib/python3.11/site-packages/tqdm/auto.py:21: TqdmWarning: IProgress not found. Please update jupyter and ipywidgets. See https://ipywidgets.readthedocs.io/en/stable/user_install.html\n", |
| 99 | + " from .autonotebook import tqdm as notebook_tqdm\n" |
| 100 | + ] |
| 101 | + } |
| 102 | + ], |
94 | 103 | "source": [ |
95 | 104 | "import os\n", |
96 | 105 | "from redisvl.extensions.router import SemanticRouter\n", |
|
110 | 119 | }, |
111 | 120 | { |
112 | 121 | "cell_type": "code", |
113 | | - "execution_count": 63, |
| 122 | + "execution_count": 3, |
114 | 123 | "metadata": {}, |
115 | 124 | "outputs": [ |
116 | 125 | { |
|
144 | 153 | }, |
145 | 154 | { |
146 | 155 | "cell_type": "code", |
147 | | - "execution_count": 64, |
| 156 | + "execution_count": 4, |
148 | 157 | "metadata": {}, |
149 | 158 | "outputs": [ |
150 | 159 | { |
|
153 | 162 | "11" |
154 | 163 | ] |
155 | 164 | }, |
156 | | - "execution_count": 64, |
| 165 | + "execution_count": 4, |
157 | 166 | "metadata": {}, |
158 | 167 | "output_type": "execute_result" |
159 | 168 | } |
|
171 | 180 | }, |
172 | 181 | { |
173 | 182 | "cell_type": "code", |
174 | | - "execution_count": 29, |
| 183 | + "execution_count": 5, |
175 | 184 | "metadata": {}, |
176 | 185 | "outputs": [ |
177 | 186 | { |
|
180 | 189 | "RouteMatch(name='technology', distance=0.419145862261)" |
181 | 190 | ] |
182 | 191 | }, |
183 | | - "execution_count": 29, |
| 192 | + "execution_count": 5, |
184 | 193 | "metadata": {}, |
185 | 194 | "output_type": "execute_result" |
186 | 195 | } |
|
193 | 202 | }, |
194 | 203 | { |
195 | 204 | "cell_type": "code", |
196 | | - "execution_count": 30, |
| 205 | + "execution_count": 6, |
197 | 206 | "metadata": {}, |
198 | 207 | "outputs": [ |
199 | 208 | { |
|
202 | 211 | "RouteMatch(name=None, distance=None)" |
203 | 212 | ] |
204 | 213 | }, |
205 | | - "execution_count": 30, |
| 214 | + "execution_count": 6, |
206 | 215 | "metadata": {}, |
207 | 216 | "output_type": "execute_result" |
208 | 217 | } |
|
222 | 231 | }, |
223 | 232 | { |
224 | 233 | "cell_type": "code", |
225 | | - "execution_count": 37, |
| 234 | + "execution_count": 7, |
226 | 235 | "metadata": {}, |
227 | 236 | "outputs": [ |
228 | 237 | { |
|
232 | 241 | " RouteMatch(name='sports', distance=0.67106004556)]" |
233 | 242 | ] |
234 | 243 | }, |
235 | | - "execution_count": 37, |
| 244 | + "execution_count": 7, |
236 | 245 | "metadata": {}, |
237 | 246 | "output_type": "execute_result" |
238 | 247 | } |
|
245 | 254 | }, |
246 | 255 | { |
247 | 256 | "cell_type": "code", |
248 | | - "execution_count": 38, |
| 257 | + "execution_count": 8, |
249 | 258 | "metadata": {}, |
250 | 259 | "outputs": [ |
251 | 260 | { |
|
255 | 264 | " RouteMatch(name='sports', distance=0.62926441431)]" |
256 | 265 | ] |
257 | 266 | }, |
258 | | - "execution_count": 38, |
| 267 | + "execution_count": 8, |
259 | 268 | "metadata": {}, |
260 | 269 | "output_type": "execute_result" |
261 | 270 | } |
|
284 | 293 | }, |
285 | 294 | { |
286 | 295 | "cell_type": "code", |
287 | | - "execution_count": 39, |
| 296 | + "execution_count": 9, |
288 | 297 | "metadata": {}, |
289 | 298 | "outputs": [], |
290 | 299 | "source": [ |
|
297 | 306 | }, |
298 | 307 | { |
299 | 308 | "cell_type": "code", |
300 | | - "execution_count": 40, |
| 309 | + "execution_count": 10, |
301 | 310 | "metadata": {}, |
302 | 311 | "outputs": [ |
303 | 312 | { |
|
306 | 315 | "[RouteMatch(name='sports', distance=0.663253903389)]" |
307 | 316 | ] |
308 | 317 | }, |
309 | | - "execution_count": 40, |
| 318 | + "execution_count": 10, |
310 | 319 | "metadata": {}, |
311 | 320 | "output_type": "execute_result" |
312 | 321 | } |
|
325 | 334 | }, |
326 | 335 | { |
327 | 336 | "cell_type": "code", |
328 | | - "execution_count": 41, |
| 337 | + "execution_count": 11, |
329 | 338 | "metadata": {}, |
330 | 339 | "outputs": [ |
331 | 340 | { |
|
357 | 366 | " 'routing_config': {'max_k': 3, 'aggregation_method': 'min'}}" |
358 | 367 | ] |
359 | 368 | }, |
360 | | - "execution_count": 41, |
| 369 | + "execution_count": 11, |
361 | 370 | "metadata": {}, |
362 | 371 | "output_type": "execute_result" |
363 | 372 | } |
|
368 | 377 | }, |
369 | 378 | { |
370 | 379 | "cell_type": "code", |
371 | | - "execution_count": 42, |
| 380 | + "execution_count": 12, |
372 | 381 | "metadata": {}, |
373 | 382 | "outputs": [ |
374 | 383 | { |
375 | 384 | "name": "stdout", |
376 | 385 | "output_type": "stream", |
377 | 386 | "text": [ |
378 | | - "\u001b[32m16:05:23\u001b[0m \u001b[34mredisvl.index.index\u001b[0m \u001b[1;30mINFO\u001b[0m Index already exists, not overwriting.\n" |
| 387 | + "\u001b[32m11:57:04\u001b[0m \u001b[34mredisvl.index.index\u001b[0m \u001b[1;30mINFO\u001b[0m Index already exists, not overwriting.\n" |
379 | 388 | ] |
380 | 389 | } |
381 | 390 | ], |
|
387 | 396 | }, |
388 | 397 | { |
389 | 398 | "cell_type": "code", |
390 | | - "execution_count": 43, |
| 399 | + "execution_count": 13, |
391 | 400 | "metadata": {}, |
392 | 401 | "outputs": [], |
393 | 402 | "source": [ |
|
396 | 405 | }, |
397 | 406 | { |
398 | 407 | "cell_type": "code", |
399 | | - "execution_count": 44, |
| 408 | + "execution_count": 14, |
400 | 409 | "metadata": {}, |
401 | 410 | "outputs": [ |
402 | 411 | { |
403 | 412 | "name": "stdout", |
404 | 413 | "output_type": "stream", |
405 | 414 | "text": [ |
406 | | - "\u001b[32m16:05:29\u001b[0m \u001b[34mredisvl.index.index\u001b[0m \u001b[1;30mINFO\u001b[0m Index already exists, not overwriting.\n" |
| 415 | + "\u001b[32m11:57:06\u001b[0m \u001b[34mredisvl.index.index\u001b[0m \u001b[1;30mINFO\u001b[0m Index already exists, not overwriting.\n" |
407 | 416 | ] |
408 | 417 | } |
409 | 418 | ], |
|
422 | 431 | }, |
423 | 432 | { |
424 | 433 | "cell_type": "code", |
425 | | - "execution_count": 45, |
| 434 | + "execution_count": 15, |
426 | 435 | "metadata": {}, |
427 | 436 | "outputs": [ |
428 | 437 | { |
|
432 | 441 | " 'topic-router:technology:7e4bca5853c1c3298b4d001de13c3c7a79a6e0f134f81acc2e7cddbd6845961f']" |
433 | 442 | ] |
434 | 443 | }, |
435 | | - "execution_count": 45, |
| 444 | + "execution_count": 15, |
436 | 445 | "metadata": {}, |
437 | 446 | "output_type": "execute_result" |
438 | 447 | } |
|
450 | 459 | }, |
451 | 460 | { |
452 | 461 | "cell_type": "code", |
453 | | - "execution_count": 47, |
| 462 | + "execution_count": 16, |
454 | 463 | "metadata": {}, |
455 | 464 | "outputs": [ |
456 | 465 | { |
457 | 466 | "data": { |
458 | 467 | "text/plain": [ |
459 | | - "[{'id': 'topic-router:technology:149a9c9919c58534aa0f369e85ad95ba7f00aa0513e0f81e2aff2ea4a717b0e0',\n", |
| 468 | + "[{'id': 'topic-router:technology:f243fb2d073774e81c7815247cb3013794e6225df3cbe3769cee8c6cefaca777',\n", |
| 469 | + " 'reference_id': 'f243fb2d073774e81c7815247cb3013794e6225df3cbe3769cee8c6cefaca777',\n", |
| 470 | + " 'route_name': 'technology',\n", |
| 471 | + " 'reference': 'latest AI trends'},\n", |
| 472 | + " {'id': 'topic-router:technology:851f51cce5a9ccfbbcb66993908be6b7871479af3e3a4b139ad292a1bf7e0676',\n", |
| 473 | + " 'reference_id': '851f51cce5a9ccfbbcb66993908be6b7871479af3e3a4b139ad292a1bf7e0676',\n", |
| 474 | + " 'route_name': 'technology',\n", |
| 475 | + " 'reference': 'what are the latest advancements in AI?'},\n", |
| 476 | + " {'id': 'topic-router:technology:149a9c9919c58534aa0f369e85ad95ba7f00aa0513e0f81e2aff2ea4a717b0e0',\n", |
460 | 477 | " 'reference_id': '149a9c9919c58534aa0f369e85ad95ba7f00aa0513e0f81e2aff2ea4a717b0e0',\n", |
461 | 478 | " 'route_name': 'technology',\n", |
462 | 479 | " 'reference': \"what's trending in tech?\"},\n", |
463 | | - " {'id': 'topic-router:technology:7e4bca5853c1c3298b4d001de13c3c7a79a6e0f134f81acc2e7cddbd6845961f',\n", |
464 | | - " 'reference_id': '7e4bca5853c1c3298b4d001de13c3c7a79a6e0f134f81acc2e7cddbd6845961f',\n", |
465 | | - " 'route_name': 'technology',\n", |
466 | | - " 'reference': 'new tech gadgets'},\n", |
467 | 480 | " {'id': 'topic-router:technology:85cc73a1437df27caa2f075a29c497e5a2e532023fbb75378aedbae80779ab37',\n", |
468 | 481 | " 'reference_id': '85cc73a1437df27caa2f075a29c497e5a2e532023fbb75378aedbae80779ab37',\n", |
469 | 482 | " 'route_name': 'technology',\n", |
470 | | - " 'reference': 'tell me about the newest gadgets'}]" |
| 483 | + " 'reference': 'tell me about the newest gadgets'},\n", |
| 484 | + " {'id': 'topic-router:technology:7e4bca5853c1c3298b4d001de13c3c7a79a6e0f134f81acc2e7cddbd6845961f',\n", |
| 485 | + " 'reference_id': '7e4bca5853c1c3298b4d001de13c3c7a79a6e0f134f81acc2e7cddbd6845961f',\n", |
| 486 | + " 'route_name': 'technology',\n", |
| 487 | + " 'reference': 'new tech gadgets'}]" |
471 | 488 | ] |
472 | 489 | }, |
473 | | - "execution_count": 47, |
| 490 | + "execution_count": 16, |
474 | 491 | "metadata": {}, |
475 | 492 | "output_type": "execute_result" |
476 | 493 | } |
|
483 | 500 | }, |
484 | 501 | { |
485 | 502 | "cell_type": "code", |
486 | | - "execution_count": 48, |
| 503 | + "execution_count": 17, |
487 | 504 | "metadata": {}, |
488 | 505 | "outputs": [ |
489 | 506 | { |
490 | 507 | "data": { |
491 | 508 | "text/plain": [ |
492 | | - "[{'id': 'topic-router:technology:149a9c9919c58534aa0f369e85ad95ba7f00aa0513e0f81e2aff2ea4a717b0e0',\n", |
493 | | - " 'reference_id': '149a9c9919c58534aa0f369e85ad95ba7f00aa0513e0f81e2aff2ea4a717b0e0',\n", |
| 509 | + "[{'id': 'topic-router:technology:f243fb2d073774e81c7815247cb3013794e6225df3cbe3769cee8c6cefaca777',\n", |
| 510 | + " 'reference_id': 'f243fb2d073774e81c7815247cb3013794e6225df3cbe3769cee8c6cefaca777',\n", |
494 | 511 | " 'route_name': 'technology',\n", |
495 | | - " 'reference': \"what's trending in tech?\"}]" |
| 512 | + " 'reference': 'latest AI trends'}]" |
496 | 513 | ] |
497 | 514 | }, |
498 | | - "execution_count": 48, |
| 515 | + "execution_count": 17, |
499 | 516 | "metadata": {}, |
500 | 517 | "output_type": "execute_result" |
501 | 518 | } |
|
515 | 532 | }, |
516 | 533 | { |
517 | 534 | "cell_type": "code", |
518 | | - "execution_count": 51, |
| 535 | + "execution_count": 18, |
519 | 536 | "metadata": {}, |
520 | 537 | "outputs": [ |
521 | 538 | { |
522 | 539 | "data": { |
523 | 540 | "text/plain": [ |
524 | | - "3" |
| 541 | + "5" |
525 | 542 | ] |
526 | 543 | }, |
527 | | - "execution_count": 51, |
| 544 | + "execution_count": 18, |
528 | 545 | "metadata": {}, |
529 | 546 | "output_type": "execute_result" |
530 | 547 | } |
531 | 548 | ], |
532 | 549 | "source": [ |
533 | 550 | "# by route name\n", |
534 | | - "deleted_count = router.delete_route_references(route_name=\"technology\")\n", |
| 551 | + "deleted_count = router.delete_route_references(route_name=\"sports\")\n", |
535 | 552 | "deleted_count" |
536 | 553 | ] |
537 | 554 | }, |
538 | 555 | { |
539 | 556 | "cell_type": "code", |
540 | | - "execution_count": 52, |
| 557 | + "execution_count": 19, |
541 | 558 | "metadata": {}, |
542 | 559 | "outputs": [ |
543 | 560 | { |
|
546 | 563 | "1" |
547 | 564 | ] |
548 | 565 | }, |
549 | | - "execution_count": 52, |
| 566 | + "execution_count": 19, |
550 | 567 | "metadata": {}, |
551 | 568 | "output_type": "execute_result" |
552 | 569 | } |
553 | 570 | ], |
554 | 571 | "source": [ |
555 | 572 | "# by id\n", |
556 | | - "deleted_count = router.delete_route_references(route_name=refs[0][\"route_name\"], reference_ids=[refs[0][\"reference_id\"]])\n", |
| 573 | + "deleted_count = router.delete_route_references(reference_ids=[refs[0][\"reference_id\"]])\n", |
557 | 574 | "deleted_count" |
558 | 575 | ] |
559 | 576 | }, |
|
566 | 583 | }, |
567 | 584 | { |
568 | 585 | "cell_type": "code", |
569 | | - "execution_count": 54, |
| 586 | + "execution_count": 20, |
570 | 587 | "metadata": {}, |
571 | 588 | "outputs": [], |
572 | 589 | "source": [ |
|
576 | 593 | }, |
577 | 594 | { |
578 | 595 | "cell_type": "code", |
579 | | - "execution_count": 55, |
| 596 | + "execution_count": 21, |
580 | 597 | "metadata": {}, |
581 | 598 | "outputs": [], |
582 | 599 | "source": [ |
|
0 commit comments