Spaces:
Running
Running
RAG demo working great!
Browse files- data/Graph RAG +309 -235
- server/llm_ops.py +4 -3
- web/src/NodeWithTableView.svelte +1 -1
data/Graph RAG
CHANGED
@@ -37,8 +37,8 @@
|
|
37 |
}
|
38 |
},
|
39 |
"position": {
|
40 |
-
"x": -
|
41 |
-
"y": -
|
42 |
},
|
43 |
"parentId": null
|
44 |
},
|
@@ -212,53 +212,6 @@
|
|
212 |
"width": 539,
|
213 |
"height": 296
|
214 |
},
|
215 |
-
{
|
216 |
-
"id": "Predict links 1",
|
217 |
-
"type": "basic",
|
218 |
-
"data": {
|
219 |
-
"title": "Predict links",
|
220 |
-
"params": {},
|
221 |
-
"display": null,
|
222 |
-
"error": null,
|
223 |
-
"meta": {
|
224 |
-
"name": "Predict links",
|
225 |
-
"params": {},
|
226 |
-
"inputs": {
|
227 |
-
"nodes": {
|
228 |
-
"name": "nodes",
|
229 |
-
"type": {
|
230 |
-
"type": "<class 'inspect._empty'>"
|
231 |
-
},
|
232 |
-
"position": "top"
|
233 |
-
},
|
234 |
-
"edges": {
|
235 |
-
"name": "edges",
|
236 |
-
"type": {
|
237 |
-
"type": "<class 'inspect._empty'>"
|
238 |
-
},
|
239 |
-
"position": "top"
|
240 |
-
}
|
241 |
-
},
|
242 |
-
"outputs": {
|
243 |
-
"output": {
|
244 |
-
"name": "output",
|
245 |
-
"type": {
|
246 |
-
"type": "None"
|
247 |
-
},
|
248 |
-
"position": "right"
|
249 |
-
}
|
250 |
-
},
|
251 |
-
"type": "basic",
|
252 |
-
"sub_nodes": null
|
253 |
-
},
|
254 |
-
"collapsed": true
|
255 |
-
},
|
256 |
-
"position": {
|
257 |
-
"x": -53.86764005751337,
|
258 |
-
"y": -37.21387561499284
|
259 |
-
},
|
260 |
-
"parentId": null
|
261 |
-
},
|
262 |
{
|
263 |
"id": "Split document 1",
|
264 |
"type": "basic",
|
@@ -309,25 +262,27 @@
|
|
309 |
"parentId": null
|
310 |
},
|
311 |
{
|
312 |
-
"id": "
|
313 |
"type": "basic",
|
314 |
"data": {
|
315 |
-
"title": "
|
316 |
-
"params": {
|
|
|
|
|
317 |
"display": null,
|
318 |
"error": null,
|
319 |
"meta": {
|
320 |
-
"name": "
|
321 |
-
"params": {
|
322 |
-
|
323 |
-
|
324 |
-
"
|
325 |
"type": {
|
326 |
-
"type": "<class '
|
327 |
-
}
|
328 |
-
"position": "top"
|
329 |
}
|
330 |
},
|
|
|
331 |
"outputs": {
|
332 |
"output": {
|
333 |
"name": "output",
|
@@ -339,42 +294,49 @@
|
|
339 |
},
|
340 |
"type": "basic",
|
341 |
"sub_nodes": null
|
342 |
-
}
|
|
|
343 |
},
|
344 |
"position": {
|
345 |
-
"x": -
|
346 |
-
"y":
|
347 |
},
|
348 |
-
"parentId": null
|
|
|
|
|
349 |
},
|
350 |
{
|
351 |
-
"id": "
|
352 |
"type": "basic",
|
353 |
"data": {
|
354 |
-
"title": "
|
355 |
-
"params": {
|
|
|
|
|
|
|
356 |
"display": null,
|
357 |
"error": null,
|
358 |
"meta": {
|
359 |
-
"name": "
|
360 |
-
"params": {
|
361 |
-
|
362 |
-
|
363 |
-
"
|
364 |
"type": {
|
365 |
-
"type": "<class '
|
366 |
-
}
|
367 |
-
"position": "top"
|
368 |
},
|
369 |
-
"
|
370 |
-
"name": "
|
|
|
371 |
"type": {
|
372 |
-
"
|
373 |
-
}
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
|
|
378 |
"type": {
|
379 |
"type": "<class 'inspect._empty'>"
|
380 |
},
|
@@ -392,85 +354,59 @@
|
|
392 |
},
|
393 |
"type": "basic",
|
394 |
"sub_nodes": null
|
395 |
-
}
|
396 |
-
"collapsed": false
|
397 |
},
|
398 |
"position": {
|
399 |
-
"x":
|
400 |
-
"y":
|
401 |
},
|
402 |
"parentId": null
|
403 |
},
|
404 |
{
|
405 |
-
"id": "
|
406 |
"type": "basic",
|
407 |
"data": {
|
408 |
-
"title": "
|
409 |
"params": {
|
410 |
-
"
|
|
|
|
|
|
|
411 |
},
|
412 |
"display": null,
|
413 |
"error": null,
|
414 |
"meta": {
|
415 |
-
"name": "
|
416 |
"params": {
|
417 |
-
"
|
418 |
-
"name": "
|
419 |
-
"default":
|
420 |
"type": {
|
421 |
-
"
|
|
|
|
|
|
|
422 |
}
|
423 |
-
}
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
"output": {
|
428 |
-
"name": "output",
|
429 |
"type": {
|
430 |
-
"type": "
|
431 |
-
}
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
"sub_nodes": null
|
437 |
-
},
|
438 |
-
"beingResized": false
|
439 |
-
},
|
440 |
-
"position": {
|
441 |
-
"x": -857.4114014537504,
|
442 |
-
"y": 146.20705074522004
|
443 |
-
},
|
444 |
-
"parentId": null,
|
445 |
-
"width": 346,
|
446 |
-
"height": 120
|
447 |
-
},
|
448 |
-
{
|
449 |
-
"id": "Create prompt 1",
|
450 |
-
"type": "basic",
|
451 |
-
"data": {
|
452 |
-
"title": "Create prompt",
|
453 |
-
"params": {
|
454 |
-
"save_as": "prompt",
|
455 |
-
"template": "{text}"
|
456 |
-
},
|
457 |
-
"display": null,
|
458 |
-
"error": null,
|
459 |
-
"meta": {
|
460 |
-
"name": "Create prompt",
|
461 |
-
"params": {
|
462 |
-
"save_as": {
|
463 |
-
"name": "save_as",
|
464 |
-
"default": "prompt",
|
465 |
"type": {
|
466 |
"type": "<class 'str'>"
|
467 |
}
|
468 |
},
|
469 |
-
"
|
470 |
-
"name": "
|
471 |
-
"default":
|
472 |
"type": {
|
473 |
-
"
|
474 |
}
|
475 |
}
|
476 |
},
|
@@ -481,6 +417,13 @@
|
|
481 |
"type": "<class 'inspect._empty'>"
|
482 |
},
|
483 |
"position": "left"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
484 |
}
|
485 |
},
|
486 |
"outputs": {
|
@@ -497,13 +440,13 @@
|
|
497 |
}
|
498 |
},
|
499 |
"position": {
|
500 |
-
"x":
|
501 |
-
"y":
|
502 |
},
|
503 |
"parentId": null
|
504 |
},
|
505 |
{
|
506 |
-
"id": "View
|
507 |
"type": "table_view",
|
508 |
"data": {
|
509 |
"title": "View",
|
@@ -513,18 +456,14 @@
|
|
513 |
"df": {
|
514 |
"columns": [
|
515 |
"text",
|
516 |
-
"rag"
|
517 |
-
"prompt"
|
518 |
],
|
519 |
"data": [
|
520 |
[
|
521 |
"What's your cheapest drink?",
|
522 |
[
|
523 |
-
"### 6. **Drinks**"
|
524 |
-
|
525 |
-
"Available options: Coke, Diet Coke, Sprite, Root Beer, Lemonade."
|
526 |
-
],
|
527 |
-
"{text}"
|
528 |
]
|
529 |
]
|
530 |
}
|
@@ -550,56 +489,45 @@
|
|
550 |
"beingResized": false
|
551 |
},
|
552 |
"position": {
|
553 |
-
"x":
|
554 |
-
"y":
|
555 |
},
|
556 |
"parentId": null,
|
557 |
-
"width":
|
558 |
-
"height":
|
559 |
},
|
560 |
{
|
561 |
-
"id": "
|
562 |
"type": "basic",
|
563 |
"data": {
|
564 |
-
"title": "
|
565 |
"params": {
|
566 |
-
"
|
567 |
-
"
|
568 |
-
"
|
569 |
-
"num_matches": "1"
|
570 |
},
|
571 |
"display": null,
|
572 |
"error": null,
|
573 |
"meta": {
|
574 |
-
"name": "
|
575 |
"params": {
|
576 |
-
"
|
577 |
-
"name": "
|
578 |
-
"default":
|
579 |
-
"type": {
|
580 |
-
"enum": [
|
581 |
-
"Chroma",
|
582 |
-
"Custom"
|
583 |
-
]
|
584 |
-
}
|
585 |
-
},
|
586 |
-
"input_field": {
|
587 |
-
"name": "input_field",
|
588 |
-
"default": "text",
|
589 |
"type": {
|
590 |
"type": "<class 'str'>"
|
591 |
}
|
592 |
},
|
593 |
-
"
|
594 |
-
"name": "
|
595 |
-
"default":
|
596 |
"type": {
|
597 |
"type": "<class 'str'>"
|
598 |
}
|
599 |
},
|
600 |
-
"
|
601 |
-
"name": "
|
602 |
-
"default":
|
603 |
"type": {
|
604 |
"type": "<class 'int'>"
|
605 |
}
|
@@ -612,13 +540,6 @@
|
|
612 |
"type": "<class 'inspect._empty'>"
|
613 |
},
|
614 |
"position": "left"
|
615 |
-
},
|
616 |
-
"db": {
|
617 |
-
"name": "db",
|
618 |
-
"type": {
|
619 |
-
"type": "<class 'inspect._empty'>"
|
620 |
-
},
|
621 |
-
"position": "top"
|
622 |
}
|
623 |
},
|
624 |
"outputs": {
|
@@ -635,13 +556,13 @@
|
|
635 |
}
|
636 |
},
|
637 |
"position": {
|
638 |
-
"x":
|
639 |
-
"y":
|
640 |
},
|
641 |
"parentId": null
|
642 |
},
|
643 |
{
|
644 |
-
"id": "View
|
645 |
"type": "table_view",
|
646 |
"data": {
|
647 |
"title": "View",
|
@@ -651,14 +572,20 @@
|
|
651 |
"df": {
|
652 |
"columns": [
|
653 |
"text",
|
654 |
-
"rag"
|
|
|
|
|
655 |
],
|
656 |
"data": [
|
657 |
[
|
658 |
"What's your cheapest drink?",
|
659 |
[
|
660 |
-
"### 6. **Drinks**"
|
661 |
-
|
|
|
|
|
|
|
|
|
662 |
]
|
663 |
]
|
664 |
}
|
@@ -680,16 +607,156 @@
|
|
680 |
"outputs": {},
|
681 |
"type": "table_view",
|
682 |
"sub_nodes": null
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
683 |
},
|
684 |
-
"
|
685 |
},
|
686 |
"position": {
|
687 |
-
"x": -
|
688 |
-
"y":
|
689 |
},
|
690 |
-
"parentId": null
|
691 |
-
|
692 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
693 |
}
|
694 |
],
|
695 |
"edges": [
|
@@ -708,39 +775,46 @@
|
|
708 |
"targetHandle": "input"
|
709 |
},
|
710 |
{
|
711 |
-
"id": "xy-
|
712 |
-
"source": "
|
713 |
-
"target": "
|
714 |
"sourceHandle": "output",
|
715 |
"targetHandle": "input"
|
716 |
},
|
717 |
{
|
718 |
-
"id": "xy-edge__Split document 1output-
|
719 |
"source": "Split document 1",
|
720 |
-
"target": "
|
721 |
"sourceHandle": "output",
|
722 |
-
"targetHandle": "
|
723 |
},
|
724 |
{
|
725 |
-
"id": "xy-
|
726 |
-
"source": "
|
727 |
-
"target": "
|
728 |
"sourceHandle": "output",
|
729 |
-
"targetHandle": "
|
730 |
},
|
731 |
{
|
732 |
-
"id": "xy-
|
733 |
-
"source": "
|
734 |
-
"target": "
|
735 |
"sourceHandle": "output",
|
736 |
-
"targetHandle": "
|
737 |
},
|
738 |
{
|
739 |
-
"id": "xy-
|
740 |
-
"source": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
741 |
"target": "Add neighbors 1",
|
742 |
"sourceHandle": "output",
|
743 |
-
"targetHandle": "
|
744 |
},
|
745 |
{
|
746 |
"id": "xy-edge__Add neighbors 1output-Create prompt 1input",
|
@@ -750,39 +824,39 @@
|
|
750 |
"targetHandle": "input"
|
751 |
},
|
752 |
{
|
753 |
-
"id": "xy-
|
754 |
-
"source": "
|
755 |
-
"target": "
|
756 |
"sourceHandle": "output",
|
757 |
"targetHandle": "input"
|
758 |
},
|
759 |
{
|
760 |
-
"id": "xy-
|
761 |
-
"source": "
|
762 |
-
"target": "
|
763 |
"sourceHandle": "output",
|
764 |
-
"targetHandle": "
|
765 |
},
|
766 |
{
|
767 |
-
"id": "xy-
|
768 |
-
"source": "
|
769 |
-
"target": "
|
770 |
"sourceHandle": "output",
|
771 |
-
"targetHandle": "
|
772 |
},
|
773 |
{
|
774 |
-
"id": "xy-
|
775 |
-
"source": "
|
776 |
-
"target": "
|
777 |
"sourceHandle": "output",
|
778 |
-
"targetHandle": "
|
779 |
},
|
780 |
{
|
781 |
-
"id": "xy-
|
782 |
-
"source": "
|
783 |
-
"target": "
|
784 |
"sourceHandle": "output",
|
785 |
-
"targetHandle": "
|
786 |
}
|
787 |
]
|
788 |
}
|
|
|
37 |
}
|
38 |
},
|
39 |
"position": {
|
40 |
+
"x": -849.9937814890327,
|
41 |
+
"y": -303.5069988257918
|
42 |
},
|
43 |
"parentId": null
|
44 |
},
|
|
|
212 |
"width": 539,
|
213 |
"height": 296
|
214 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
215 |
{
|
216 |
"id": "Split document 1",
|
217 |
"type": "basic",
|
|
|
262 |
"parentId": null
|
263 |
},
|
264 |
{
|
265 |
+
"id": "Input chat 1",
|
266 |
"type": "basic",
|
267 |
"data": {
|
268 |
+
"title": "Input chat",
|
269 |
+
"params": {
|
270 |
+
"chat": "What's your cheapest drink?"
|
271 |
+
},
|
272 |
"display": null,
|
273 |
"error": null,
|
274 |
"meta": {
|
275 |
+
"name": "Input chat",
|
276 |
+
"params": {
|
277 |
+
"chat": {
|
278 |
+
"name": "chat",
|
279 |
+
"default": null,
|
280 |
"type": {
|
281 |
+
"type": "<class 'str'>"
|
282 |
+
}
|
|
|
283 |
}
|
284 |
},
|
285 |
+
"inputs": {},
|
286 |
"outputs": {
|
287 |
"output": {
|
288 |
"name": "output",
|
|
|
294 |
},
|
295 |
"type": "basic",
|
296 |
"sub_nodes": null
|
297 |
+
},
|
298 |
+
"beingResized": false
|
299 |
},
|
300 |
"position": {
|
301 |
+
"x": -857.4114014537504,
|
302 |
+
"y": 146.20705074522004
|
303 |
},
|
304 |
+
"parentId": null,
|
305 |
+
"width": 346,
|
306 |
+
"height": 120
|
307 |
},
|
308 |
{
|
309 |
+
"id": "Create prompt 1",
|
310 |
"type": "basic",
|
311 |
"data": {
|
312 |
+
"title": "Create prompt",
|
313 |
+
"params": {
|
314 |
+
"save_as": "prompt",
|
315 |
+
"template": "\n{% for item in rag %}\n---\n{{item}}\n{% endfor %}\n---\nIs the information above sufficient to answer the following question?\n- {{text}}\n\nIf the information is insufficient please say so. Otherwise, provide the answer."
|
316 |
+
},
|
317 |
"display": null,
|
318 |
"error": null,
|
319 |
"meta": {
|
320 |
+
"name": "Create prompt",
|
321 |
+
"params": {
|
322 |
+
"save_as": {
|
323 |
+
"name": "save_as",
|
324 |
+
"default": "prompt",
|
325 |
"type": {
|
326 |
+
"type": "<class 'str'>"
|
327 |
+
}
|
|
|
328 |
},
|
329 |
+
"template": {
|
330 |
+
"name": "template",
|
331 |
+
"default": null,
|
332 |
"type": {
|
333 |
+
"format": "textarea"
|
334 |
+
}
|
335 |
+
}
|
336 |
+
},
|
337 |
+
"inputs": {
|
338 |
+
"input": {
|
339 |
+
"name": "input",
|
340 |
"type": {
|
341 |
"type": "<class 'inspect._empty'>"
|
342 |
},
|
|
|
354 |
},
|
355 |
"type": "basic",
|
356 |
"sub_nodes": null
|
357 |
+
}
|
|
|
358 |
},
|
359 |
"position": {
|
360 |
+
"x": 324.81988008998496,
|
361 |
+
"y": -9.071826950189632
|
362 |
},
|
363 |
"parentId": null
|
364 |
},
|
365 |
{
|
366 |
+
"id": "RAG 1",
|
367 |
"type": "basic",
|
368 |
"data": {
|
369 |
+
"title": "RAG",
|
370 |
"params": {
|
371 |
+
"engine": "Custom",
|
372 |
+
"input_field": "text",
|
373 |
+
"db_field": "text",
|
374 |
+
"num_matches": "1"
|
375 |
},
|
376 |
"display": null,
|
377 |
"error": null,
|
378 |
"meta": {
|
379 |
+
"name": "RAG",
|
380 |
"params": {
|
381 |
+
"engine": {
|
382 |
+
"name": "engine",
|
383 |
+
"default": "Chroma",
|
384 |
"type": {
|
385 |
+
"enum": [
|
386 |
+
"Chroma",
|
387 |
+
"Custom"
|
388 |
+
]
|
389 |
}
|
390 |
+
},
|
391 |
+
"input_field": {
|
392 |
+
"name": "input_field",
|
393 |
+
"default": "text",
|
|
|
|
|
394 |
"type": {
|
395 |
+
"type": "<class 'str'>"
|
396 |
+
}
|
397 |
+
},
|
398 |
+
"db_field": {
|
399 |
+
"name": "db_field",
|
400 |
+
"default": "text",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
401 |
"type": {
|
402 |
"type": "<class 'str'>"
|
403 |
}
|
404 |
},
|
405 |
+
"num_matches": {
|
406 |
+
"name": "num_matches",
|
407 |
+
"default": 10,
|
408 |
"type": {
|
409 |
+
"type": "<class 'int'>"
|
410 |
}
|
411 |
}
|
412 |
},
|
|
|
417 |
"type": "<class 'inspect._empty'>"
|
418 |
},
|
419 |
"position": "left"
|
420 |
+
},
|
421 |
+
"db": {
|
422 |
+
"name": "db",
|
423 |
+
"type": {
|
424 |
+
"type": "<class 'inspect._empty'>"
|
425 |
+
},
|
426 |
+
"position": "top"
|
427 |
}
|
428 |
},
|
429 |
"outputs": {
|
|
|
440 |
}
|
441 |
},
|
442 |
"position": {
|
443 |
+
"x": -449.6099563104567,
|
444 |
+
"y": 56.69054032617606
|
445 |
},
|
446 |
"parentId": null
|
447 |
},
|
448 |
{
|
449 |
+
"id": "View 3",
|
450 |
"type": "table_view",
|
451 |
"data": {
|
452 |
"title": "View",
|
|
|
456 |
"df": {
|
457 |
"columns": [
|
458 |
"text",
|
459 |
+
"rag"
|
|
|
460 |
],
|
461 |
"data": [
|
462 |
[
|
463 |
"What's your cheapest drink?",
|
464 |
[
|
465 |
+
"### 6. **Drinks**"
|
466 |
+
]
|
|
|
|
|
|
|
467 |
]
|
468 |
]
|
469 |
}
|
|
|
489 |
"beingResized": false
|
490 |
},
|
491 |
"position": {
|
492 |
+
"x": -557.8656197388839,
|
493 |
+
"y": 397.32347851191355
|
494 |
},
|
495 |
"parentId": null,
|
496 |
+
"width": 296,
|
497 |
+
"height": 228
|
498 |
},
|
499 |
{
|
500 |
+
"id": "Ask LLM 1",
|
501 |
"type": "basic",
|
502 |
"data": {
|
503 |
+
"title": "Ask LLM",
|
504 |
"params": {
|
505 |
+
"model": "google/gemma-2-2b-it",
|
506 |
+
"accepted_regex": null,
|
507 |
+
"max_tokens": 100
|
|
|
508 |
},
|
509 |
"display": null,
|
510 |
"error": null,
|
511 |
"meta": {
|
512 |
+
"name": "Ask LLM",
|
513 |
"params": {
|
514 |
+
"model": {
|
515 |
+
"name": "model",
|
516 |
+
"default": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
517 |
"type": {
|
518 |
"type": "<class 'str'>"
|
519 |
}
|
520 |
},
|
521 |
+
"accepted_regex": {
|
522 |
+
"name": "accepted_regex",
|
523 |
+
"default": null,
|
524 |
"type": {
|
525 |
"type": "<class 'str'>"
|
526 |
}
|
527 |
},
|
528 |
+
"max_tokens": {
|
529 |
+
"name": "max_tokens",
|
530 |
+
"default": 100,
|
531 |
"type": {
|
532 |
"type": "<class 'int'>"
|
533 |
}
|
|
|
540 |
"type": "<class 'inspect._empty'>"
|
541 |
},
|
542 |
"position": "left"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
543 |
}
|
544 |
},
|
545 |
"outputs": {
|
|
|
556 |
}
|
557 |
},
|
558 |
"position": {
|
559 |
+
"x": 649.0730411878703,
|
560 |
+
"y": 29.290926423828694
|
561 |
},
|
562 |
"parentId": null
|
563 |
},
|
564 |
{
|
565 |
+
"id": "View 4",
|
566 |
"type": "table_view",
|
567 |
"data": {
|
568 |
"title": "View",
|
|
|
572 |
"df": {
|
573 |
"columns": [
|
574 |
"text",
|
575 |
+
"rag",
|
576 |
+
"prompt",
|
577 |
+
"response"
|
578 |
],
|
579 |
"data": [
|
580 |
[
|
581 |
"What's your cheapest drink?",
|
582 |
[
|
583 |
+
"### 6. **Drinks**",
|
584 |
+
"| Size | Price |\n|--------------------|---------------|\n| 20 oz Bottle | $1.99 |\n| 2-Liter Bottle | $3.50 |",
|
585 |
+
"Available options: Coke, Diet Coke, Sprite, Root Beer, Lemonade."
|
586 |
+
],
|
587 |
+
"\n\n---\n### 6. **Drinks**\n\n---\n| Size | Price |\n|--------------------|---------------|\n| 20 oz Bottle | $1.99 |\n| 2-Liter Bottle | $3.50 |\n\n---\nAvailable options: Coke, Diet Coke, Sprite, Root Beer, Lemonade.\n\n---\nIs the information above sufficient to answer the following question?\n- What's your cheapest drink?\n\nIf the information is insufficient please say so. Otherwise, provide the answer.",
|
588 |
+
"The information is sufficient to answer the question. \n\n**Answer:** The cheapest drink is the 20 oz bottle of Coke at $1.99. \n"
|
589 |
]
|
590 |
]
|
591 |
}
|
|
|
607 |
"outputs": {},
|
608 |
"type": "table_view",
|
609 |
"sub_nodes": null
|
610 |
+
}
|
611 |
+
},
|
612 |
+
"position": {
|
613 |
+
"x": 927.877424966716,
|
614 |
+
"y": -205.07566047558328
|
615 |
+
},
|
616 |
+
"parentId": null
|
617 |
+
},
|
618 |
+
{
|
619 |
+
"id": "Build document graph 1",
|
620 |
+
"type": "basic",
|
621 |
+
"data": {
|
622 |
+
"title": "Build document graph",
|
623 |
+
"params": {},
|
624 |
+
"display": null,
|
625 |
+
"error": null,
|
626 |
+
"meta": {
|
627 |
+
"name": "Build document graph",
|
628 |
+
"params": {},
|
629 |
+
"inputs": {
|
630 |
+
"input": {
|
631 |
+
"name": "input",
|
632 |
+
"type": {
|
633 |
+
"type": "<class 'inspect._empty'>"
|
634 |
+
},
|
635 |
+
"position": "top"
|
636 |
+
}
|
637 |
+
},
|
638 |
+
"outputs": {
|
639 |
+
"output": {
|
640 |
+
"name": "output",
|
641 |
+
"type": {
|
642 |
+
"type": "None"
|
643 |
+
},
|
644 |
+
"position": "right"
|
645 |
+
}
|
646 |
+
},
|
647 |
+
"type": "basic",
|
648 |
+
"sub_nodes": null
|
649 |
},
|
650 |
+
"collapsed": true
|
651 |
},
|
652 |
"position": {
|
653 |
+
"x": -36.39166052931119,
|
654 |
+
"y": -212.34993098590766
|
655 |
},
|
656 |
+
"parentId": null
|
657 |
+
},
|
658 |
+
{
|
659 |
+
"id": "Add neighbors 1",
|
660 |
+
"type": "basic",
|
661 |
+
"data": {
|
662 |
+
"title": "Add neighbors",
|
663 |
+
"params": {},
|
664 |
+
"display": null,
|
665 |
+
"error": null,
|
666 |
+
"meta": {
|
667 |
+
"name": "Add neighbors",
|
668 |
+
"params": {},
|
669 |
+
"inputs": {
|
670 |
+
"nodes": {
|
671 |
+
"name": "nodes",
|
672 |
+
"type": {
|
673 |
+
"type": "<class 'inspect._empty'>"
|
674 |
+
},
|
675 |
+
"position": "top"
|
676 |
+
},
|
677 |
+
"edges": {
|
678 |
+
"name": "edges",
|
679 |
+
"type": {
|
680 |
+
"type": "<class 'inspect._empty'>"
|
681 |
+
},
|
682 |
+
"position": "top"
|
683 |
+
},
|
684 |
+
"item": {
|
685 |
+
"name": "item",
|
686 |
+
"type": {
|
687 |
+
"type": "<class 'inspect._empty'>"
|
688 |
+
},
|
689 |
+
"position": "left"
|
690 |
+
}
|
691 |
+
},
|
692 |
+
"outputs": {
|
693 |
+
"output": {
|
694 |
+
"name": "output",
|
695 |
+
"type": {
|
696 |
+
"type": "None"
|
697 |
+
},
|
698 |
+
"position": "right"
|
699 |
+
}
|
700 |
+
},
|
701 |
+
"type": "basic",
|
702 |
+
"sub_nodes": null
|
703 |
+
},
|
704 |
+
"collapsed": true
|
705 |
+
},
|
706 |
+
"position": {
|
707 |
+
"x": -2.516468588848724,
|
708 |
+
"y": 167.64180115746848
|
709 |
+
},
|
710 |
+
"parentId": null
|
711 |
+
},
|
712 |
+
{
|
713 |
+
"id": "Predict links 1",
|
714 |
+
"type": "basic",
|
715 |
+
"data": {
|
716 |
+
"title": "Predict links",
|
717 |
+
"params": {},
|
718 |
+
"display": null,
|
719 |
+
"error": null,
|
720 |
+
"meta": {
|
721 |
+
"name": "Predict links",
|
722 |
+
"params": {},
|
723 |
+
"inputs": {
|
724 |
+
"nodes": {
|
725 |
+
"name": "nodes",
|
726 |
+
"type": {
|
727 |
+
"type": "<class 'inspect._empty'>"
|
728 |
+
},
|
729 |
+
"position": "top"
|
730 |
+
},
|
731 |
+
"edges": {
|
732 |
+
"name": "edges",
|
733 |
+
"type": {
|
734 |
+
"type": "<class 'inspect._empty'>"
|
735 |
+
},
|
736 |
+
"position": "top"
|
737 |
+
}
|
738 |
+
},
|
739 |
+
"outputs": {
|
740 |
+
"output": {
|
741 |
+
"name": "output",
|
742 |
+
"type": {
|
743 |
+
"type": "None"
|
744 |
+
},
|
745 |
+
"position": "right"
|
746 |
+
}
|
747 |
+
},
|
748 |
+
"type": "basic",
|
749 |
+
"position": {
|
750 |
+
"x": 656,
|
751 |
+
"y": 179
|
752 |
+
}
|
753 |
+
}
|
754 |
+
},
|
755 |
+
"position": {
|
756 |
+
"x": 34.865308360949726,
|
757 |
+
"y": -37.44504613652989
|
758 |
+
},
|
759 |
+
"parentId": null
|
760 |
}
|
761 |
],
|
762 |
"edges": [
|
|
|
775 |
"targetHandle": "input"
|
776 |
},
|
777 |
{
|
778 |
+
"id": "xy-edge__Input chat 1output-RAG 1input",
|
779 |
+
"source": "Input chat 1",
|
780 |
+
"target": "RAG 1",
|
781 |
"sourceHandle": "output",
|
782 |
"targetHandle": "input"
|
783 |
},
|
784 |
{
|
785 |
+
"id": "xy-edge__Split document 1output-RAG 1db",
|
786 |
"source": "Split document 1",
|
787 |
+
"target": "RAG 1",
|
788 |
"sourceHandle": "output",
|
789 |
+
"targetHandle": "db"
|
790 |
},
|
791 |
{
|
792 |
+
"id": "xy-edge__RAG 1output-View 3input",
|
793 |
+
"source": "RAG 1",
|
794 |
+
"target": "View 3",
|
795 |
"sourceHandle": "output",
|
796 |
+
"targetHandle": "input"
|
797 |
},
|
798 |
{
|
799 |
+
"id": "xy-edge__Create prompt 1output-Ask LLM 1input",
|
800 |
+
"source": "Create prompt 1",
|
801 |
+
"target": "Ask LLM 1",
|
802 |
"sourceHandle": "output",
|
803 |
+
"targetHandle": "input"
|
804 |
},
|
805 |
{
|
806 |
+
"id": "xy-edge__Ask LLM 1output-View 4input",
|
807 |
+
"source": "Ask LLM 1",
|
808 |
+
"target": "View 4",
|
809 |
+
"sourceHandle": "output",
|
810 |
+
"targetHandle": "input"
|
811 |
+
},
|
812 |
+
{
|
813 |
+
"id": "xy-edge__RAG 1output-Add neighbors 1item",
|
814 |
+
"source": "RAG 1",
|
815 |
"target": "Add neighbors 1",
|
816 |
"sourceHandle": "output",
|
817 |
+
"targetHandle": "item"
|
818 |
},
|
819 |
{
|
820 |
"id": "xy-edge__Add neighbors 1output-Create prompt 1input",
|
|
|
824 |
"targetHandle": "input"
|
825 |
},
|
826 |
{
|
827 |
+
"id": "xy-edge__Split document 1output-Build document graph 1input",
|
828 |
+
"source": "Split document 1",
|
829 |
+
"target": "Build document graph 1",
|
830 |
"sourceHandle": "output",
|
831 |
"targetHandle": "input"
|
832 |
},
|
833 |
{
|
834 |
+
"id": "xy-edge__Split document 1output-Add neighbors 1nodes",
|
835 |
+
"source": "Split document 1",
|
836 |
+
"target": "Add neighbors 1",
|
837 |
"sourceHandle": "output",
|
838 |
+
"targetHandle": "nodes"
|
839 |
},
|
840 |
{
|
841 |
+
"id": "xy-edge__Split document 1output-Predict links 1nodes",
|
842 |
+
"source": "Split document 1",
|
843 |
+
"target": "Predict links 1",
|
844 |
"sourceHandle": "output",
|
845 |
+
"targetHandle": "nodes"
|
846 |
},
|
847 |
{
|
848 |
+
"id": "xy-edge__Build document graph 1output-Predict links 1edges",
|
849 |
+
"source": "Build document graph 1",
|
850 |
+
"target": "Predict links 1",
|
851 |
"sourceHandle": "output",
|
852 |
+
"targetHandle": "edges"
|
853 |
},
|
854 |
{
|
855 |
+
"id": "xy-edge__Predict links 1output-Add neighbors 1edges",
|
856 |
+
"source": "Predict links 1",
|
857 |
+
"target": "Add neighbors 1",
|
858 |
"sourceHandle": "output",
|
859 |
+
"targetHandle": "edges"
|
860 |
}
|
861 |
]
|
862 |
}
|
server/llm_ops.py
CHANGED
@@ -9,7 +9,8 @@ import numpy as np
|
|
9 |
import pandas as pd
|
10 |
from .executors import one_by_one
|
11 |
|
12 |
-
|
|
|
13 |
jinja = jinja2.Environment()
|
14 |
chroma_client = chromadb.Client()
|
15 |
LLM_CACHE = {}
|
@@ -20,14 +21,14 @@ op = ops.op_registration(ENV)
|
|
20 |
def chat(*args, **kwargs):
|
21 |
key = json.dumps({'method': 'chat', 'args': args, 'kwargs': kwargs})
|
22 |
if key not in LLM_CACHE:
|
23 |
-
completion =
|
24 |
LLM_CACHE[key] = [c.message.content for c in completion.choices]
|
25 |
return LLM_CACHE[key]
|
26 |
|
27 |
def embedding(*args, **kwargs):
|
28 |
key = json.dumps({'method': 'embedding', 'args': args, 'kwargs': kwargs})
|
29 |
if key not in LLM_CACHE:
|
30 |
-
res =
|
31 |
[data] = res.data
|
32 |
LLM_CACHE[key] = data.embedding
|
33 |
return LLM_CACHE[key]
|
|
|
9 |
import pandas as pd
|
10 |
from .executors import one_by_one
|
11 |
|
12 |
+
chat_client = openai.OpenAI(base_url="http://localhost:8080/v1")
|
13 |
+
embedding_client = openai.OpenAI(base_url="http://localhost:7997/")
|
14 |
jinja = jinja2.Environment()
|
15 |
chroma_client = chromadb.Client()
|
16 |
LLM_CACHE = {}
|
|
|
21 |
def chat(*args, **kwargs):
|
22 |
key = json.dumps({'method': 'chat', 'args': args, 'kwargs': kwargs})
|
23 |
if key not in LLM_CACHE:
|
24 |
+
completion = chat_client.chat.completions.create(*args, **kwargs)
|
25 |
LLM_CACHE[key] = [c.message.content for c in completion.choices]
|
26 |
return LLM_CACHE[key]
|
27 |
|
28 |
def embedding(*args, **kwargs):
|
29 |
key = json.dumps({'method': 'embedding', 'args': args, 'kwargs': kwargs})
|
30 |
if key not in LLM_CACHE:
|
31 |
+
res = embedding_client.embeddings.create(*args, **kwargs)
|
32 |
[data] = res.data
|
33 |
LLM_CACHE[key] = data.embedding
|
34 |
return LLM_CACHE[key]
|
web/src/NodeWithTableView.svelte
CHANGED
@@ -19,7 +19,7 @@
|
|
19 |
<dl>
|
20 |
{#each df.columns as c, i}
|
21 |
<dt>{c}</dt>
|
22 |
-
<dd>{df.data[0][i]}</dd>
|
23 |
{/each}
|
24 |
</dl>
|
25 |
{/if}
|
|
|
19 |
<dl>
|
20 |
{#each df.columns as c, i}
|
21 |
<dt>{c}</dt>
|
22 |
+
<dd><pre>{df.data[0][i]}</pre></dd>
|
23 |
{/each}
|
24 |
</dl>
|
25 |
{/if}
|