darabos commited on
Commit
911c23f
·
1 Parent(s): 99895fc

Fix up LynxScribe demo after recent changes.

Browse files
lynxkite-app/data/LynxScribe demo CHANGED
@@ -7,41 +7,43 @@
7
  "data": {
8
  "title": "Input chat",
9
  "params": {
10
- "chat": "who is the CIO of Lynx?"
11
  },
12
  "display": null,
13
  "error": null,
 
14
  "meta": {
15
- "outputs": {
16
- "output": {
17
- "type": {
18
- "type": "None"
19
- },
20
- "position": "right",
21
- "name": "output"
22
- }
23
- },
24
  "inputs": {},
25
  "params": {
26
  "chat": {
 
27
  "type": {
28
  "type": "<class 'str'>"
29
  },
30
- "name": "chat",
31
- "default": null
 
 
 
 
 
 
 
 
32
  }
33
  },
34
  "name": "Input chat",
35
  "type": "basic"
36
- }
 
37
  },
38
  "position": {
39
  "x": -493.5496596237119,
40
  "y": 20.90123252513356
41
  },
42
  "height": 186.0,
43
- "parentId": null,
44
- "width": 259.0
45
  },
46
  {
47
  "id": "View 1",
@@ -57,7 +59,7 @@
57
  ],
58
  "data": [
59
  [
60
- "The Chief Innovation Officer (CIO) of Lynx Analytics is Gabor Benedek. He is responsible for defining the methodological roadmap for Lynx's predictive analytics consulting and product development departments. If you need more specific information or have follow-up questions, feel free to ask!\n\nPlease visit https://www.lynxanalytics.com/team-leadership for further information."
61
  ]
62
  ]
63
  }
@@ -66,27 +68,27 @@
66
  "error": null,
67
  "meta": {
68
  "type": "table_view",
69
- "outputs": {},
70
- "params": {},
71
  "name": "View",
72
  "inputs": {
73
  "input": {
74
- "position": "left",
75
  "name": "input",
76
  "type": {
77
  "type": "<class 'inspect._empty'>"
78
- }
 
79
  }
80
- }
 
 
81
  }
82
  },
83
  "position": {
84
- "x": 722.1450069267316,
85
- "y": -785.6076562320527
86
  },
87
- "height": 950.0,
88
  "parentId": null,
89
- "width": 1256.0
90
  },
91
  {
92
  "id": "LLM 1",
@@ -100,35 +102,35 @@
100
  "error": null,
101
  "meta": {
102
  "inputs": {},
 
 
 
 
 
 
 
 
 
103
  "type": "basic",
104
- "name": "LLM",
105
  "params": {
106
  "name": {
 
107
  "name": "name",
108
  "type": {
109
  "type": "<class 'str'>"
110
- },
111
- "default": "openai"
112
  }
113
  },
114
- "outputs": {
115
- "output": {
116
- "name": "output",
117
- "type": {
118
- "type": "None"
119
- },
120
- "position": "top"
121
- }
122
- }
123
  }
124
  },
125
  "position": {
126
  "x": -312.5774211084781,
127
  "y": 1093.4019527511366
128
  },
129
- "height": 200.0,
130
  "width": 200.0,
131
- "parentId": null
132
  },
133
  {
134
  "id": "Scenario selector 1",
@@ -136,49 +138,49 @@
136
  "data": {
137
  "title": "Scenario selector",
138
  "params": {
139
- "node_types": "intent_cluster",
140
- "scenario_file": "/home/darabos/nvme/lynxscribe/examples/chat_api/scenarios.yaml"
141
  },
142
  "display": null,
143
  "error": null,
144
  "meta": {
145
- "type": "basic",
146
- "name": "Scenario selector",
147
- "inputs": {},
148
- "outputs": {
149
- "output": {
150
- "type": {
151
- "type": "None"
152
- },
153
- "position": "top",
154
- "name": "output"
155
- }
156
- },
157
  "params": {
158
  "scenario_file": {
159
  "type": {
160
  "type": "<class 'str'>"
161
  },
162
- "default": null,
163
- "name": "scenario_file"
164
  },
165
  "node_types": {
 
166
  "type": {
167
  "type": "<class 'str'>"
168
  },
169
- "name": "node_types",
170
- "default": "intent_cluster"
171
  }
172
- }
 
 
 
 
 
 
 
 
 
 
 
 
173
  }
174
  },
175
  "position": {
176
  "x": -549.1300345090008,
177
  "y": 1086.4852248156676
178
  },
179
- "width": 200.0,
180
  "height": 200.0,
181
- "parentId": null
182
  },
183
  {
184
  "id": "Chat API 1",
@@ -192,48 +194,48 @@
192
  "error": null,
193
  "meta": {
194
  "name": "Chat API",
 
195
  "outputs": {
196
  "output": {
197
- "position": "top",
198
- "name": "output",
199
  "type": {
200
  "type": "None"
201
- }
202
- }
203
- },
204
- "params": {
205
- "model": {
206
- "type": {
207
- "type": "<class 'str'>"
208
  },
209
- "default": "gpt-4o-mini",
210
- "name": "model"
211
  }
212
  },
213
  "inputs": {
214
- "knowledge_base": {
 
215
  "type": {
216
  "type": "<class 'inspect._empty'>"
217
  },
218
- "name": "knowledge_base",
219
  "position": "bottom"
220
  },
221
- "chatbot": {
 
 
222
  "type": {
223
  "type": "<class 'inspect._empty'>"
224
- },
225
- "position": "bottom",
226
- "name": "chatbot"
227
  },
228
- "chat_processor": {
229
- "position": "bottom",
230
  "type": {
231
  "type": "<class 'inspect._empty'>"
232
  },
233
- "name": "chat_processor"
 
234
  }
235
  },
236
- "type": "basic"
 
 
 
 
 
 
 
 
237
  }
238
  },
239
  "position": {
@@ -241,8 +243,8 @@
241
  "y": 258.20943122219336
242
  },
243
  "parentId": null,
244
- "height": 200.0,
245
- "width": 200.0
246
  },
247
  {
248
  "id": "Knowledge base 1",
@@ -250,13 +252,15 @@
250
  "data": {
251
  "title": "Knowledge base",
252
  "params": {
253
- "nodes_path": "/home/darabos/nvme/lynxscribe/examples/chat_api/data/lynx/nodes.pickle",
254
  "edges_path": "/home/darabos/nvme/lynxscribe/examples/chat_api/data/lynx/edges.pickle",
255
- "template_cluster_path": "/home/darabos/nvme/lynxscribe/examples/chat_api/data/lynx/tempclusters.pickle"
256
  },
257
  "display": null,
258
  "error": null,
259
  "meta": {
 
 
260
  "params": {
261
  "nodes_path": {
262
  "name": "nodes_path",
@@ -265,31 +269,29 @@
265
  "type": "<class 'str'>"
266
  }
267
  },
268
- "edges_path": {
269
  "type": {
270
  "type": "<class 'str'>"
271
  },
272
- "name": "edges_path",
273
- "default": "edges.pickle"
274
- },
275
- "template_cluster_path": {
276
  "name": "template_cluster_path",
277
- "default": "tempclusters.pickle",
 
 
 
 
278
  "type": {
279
  "type": "<class 'str'>"
280
  }
281
  }
282
  },
283
- "name": "Knowledge base",
284
  "inputs": {},
285
- "type": "basic",
286
  "outputs": {
287
  "output": {
 
288
  "name": "output",
289
  "type": {
290
  "type": "None"
291
- },
292
- "position": "top"
293
  }
294
  }
295
  }
@@ -298,9 +300,9 @@
298
  "x": 598.8683124946176,
299
  "y": 609.9499973808545
300
  },
 
301
  "height": 320.0,
302
- "parentId": null,
303
- "width": 336.0
304
  },
305
  {
306
  "id": "RAG chatbot 1",
@@ -309,74 +311,74 @@
309
  "title": "RAG chatbot",
310
  "params": {
311
  "limits_by_type": "{\"information\": [2, 3], \"summary\": [2, 3]}",
312
- "negative_answer": "I'm sorry, but the data I've been trained on does not contain any information related to your question.",
313
  "max_results": "5",
 
314
  "strict_limits": true
315
  },
316
  "display": null,
317
  "error": null,
318
  "meta": {
319
- "params": {
320
- "negative_answer": {
321
- "default": "I'm sorry, but the data I've been trained on does not contain any information related to your question.",
322
- "name": "negative_answer",
323
  "type": {
324
- "type": "<class 'str'>"
325
  }
326
- },
 
 
327
  "max_results": {
328
- "name": "max_results",
329
  "type": {
330
  "type": "<class 'int'>"
331
  },
332
- "default": 5.0
333
  },
334
  "strict_limits": {
335
- "default": true,
336
  "name": "strict_limits",
 
337
  "type": {
338
  "type": "<class 'bool'>"
339
  }
340
  },
 
 
 
 
 
 
 
341
  "limits_by_type": {
342
- "name": "limits_by_type",
343
  "default": "{}",
 
344
  "type": {
345
  "type": "<class 'str'>"
346
  }
347
  }
348
  },
349
- "outputs": {
350
- "output": {
351
- "type": {
352
- "type": "None"
353
- },
354
- "position": "top",
355
- "name": "output"
356
- }
357
- },
358
- "type": "basic",
359
  "name": "RAG chatbot",
 
360
  "inputs": {
361
  "rag_graph": {
362
- "name": "rag_graph",
363
  "type": {
364
  "type": "<class 'inspect._empty'>"
365
  },
 
366
  "position": "bottom"
367
  },
368
- "scenario_selector": {
369
- "name": "scenario_selector",
 
370
  "type": {
371
  "type": "<class 'inspect._empty'>"
372
- },
373
- "position": "bottom"
374
  },
375
- "llm": {
376
- "name": "llm",
377
  "type": {
378
  "type": "<class 'inspect._empty'>"
379
  },
 
380
  "position": "bottom"
381
  }
382
  }
@@ -387,9 +389,9 @@
387
  "x": -533.1301830766971,
388
  "y": 547.294980747757
389
  },
390
- "width": 339.0,
391
  "parentId": null,
392
- "height": 399.0
 
393
  },
394
  {
395
  "id": "RAG graph 1",
@@ -400,43 +402,43 @@
400
  "display": null,
401
  "error": null,
402
  "meta": {
403
- "name": "RAG graph",
404
  "inputs": {
405
- "vector_store": {
406
- "name": "vector_store",
407
  "type": {
408
  "type": "<class 'inspect._empty'>"
409
  },
410
- "position": "bottom"
 
411
  },
412
- "text_embedder": {
 
413
  "type": {
414
  "type": "<class 'inspect._empty'>"
415
  },
416
- "position": "bottom",
417
- "name": "text_embedder"
418
  }
419
  },
 
420
  "params": {},
421
  "outputs": {
422
  "output": {
423
  "position": "top",
424
- "name": "output",
425
  "type": {
426
  "type": "None"
427
- }
 
428
  }
429
- },
430
- "type": "basic"
431
  }
432
  },
433
  "position": {
434
  "x": -817.8208895639339,
435
  "y": 1014.836542916127
436
  },
437
- "height": 200.0,
438
  "width": 200.0,
439
- "parentId": null
440
  },
441
  {
442
  "id": "Vector store 1",
@@ -453,31 +455,31 @@
453
  "meta": {
454
  "params": {
455
  "collection_name": {
456
- "default": "lynx",
457
  "type": {
458
  "type": "<class 'str'>"
459
  },
 
460
  "name": "collection_name"
461
  },
462
  "name": {
463
  "default": "chromadb",
464
- "name": "name",
465
  "type": {
466
  "type": "<class 'str'>"
467
- }
 
468
  }
469
  },
 
470
  "name": "Vector store",
471
  "outputs": {
472
  "output": {
473
- "name": "output",
474
  "type": {
475
  "type": "None"
476
  },
477
- "position": "top"
 
478
  }
479
  },
480
- "type": "basic",
481
  "inputs": {}
482
  }
483
  },
@@ -500,33 +502,33 @@
500
  "display": null,
501
  "error": null,
502
  "meta": {
503
- "type": "basic",
504
  "params": {
505
  "model": {
 
506
  "type": {
507
  "type": "<class 'str'>"
508
  },
509
- "name": "model",
510
- "default": "text-embedding-ada-002"
511
- }
512
- },
513
- "inputs": {
514
- "llm": {
515
- "name": "llm",
516
- "position": "bottom",
517
- "type": {
518
- "type": "<class 'inspect._empty'>"
519
- }
520
  }
521
  },
522
  "name": "Text embedder",
523
  "outputs": {
524
  "output": {
525
- "name": "output",
526
  "type": {
527
  "type": "None"
528
  },
529
- "position": "top"
 
 
 
 
 
 
 
 
 
 
 
530
  }
531
  }
532
  }
@@ -536,8 +538,8 @@
536
  "y": 1343.5978526690794
537
  },
538
  "width": 200.0,
539
- "parentId": null,
540
- "height": 200.0
541
  },
542
  {
543
  "id": "LLM 2",
@@ -550,36 +552,36 @@
550
  "display": null,
551
  "error": null,
552
  "meta": {
553
- "inputs": {},
 
 
 
 
 
 
 
 
 
554
  "type": "basic",
 
555
  "params": {
556
  "name": {
557
- "name": "name",
558
  "default": "openai",
 
559
  "type": {
560
  "type": "<class 'str'>"
561
  }
562
  }
563
- },
564
- "outputs": {
565
- "output": {
566
- "name": "output",
567
- "type": {
568
- "type": "None"
569
- },
570
- "position": "top"
571
- }
572
- },
573
- "name": "LLM"
574
  }
575
  },
576
  "position": {
577
  "x": -727.6171373682814,
578
  "y": 1649.7242636905507
579
  },
580
- "height": 200.0,
581
  "width": 200.0,
582
- "parentId": null
 
583
  },
584
  {
585
  "id": "Truncate history 1",
@@ -592,18 +594,6 @@
592
  "display": null,
593
  "error": null,
594
  "meta": {
595
- "name": "Truncate history",
596
- "inputs": {},
597
- "type": "basic",
598
- "params": {
599
- "max_tokens": {
600
- "type": {
601
- "type": "<class 'int'>"
602
- },
603
- "default": 10000.0,
604
- "name": "max_tokens"
605
- }
606
- },
607
  "outputs": {
608
  "output": {
609
  "type": {
@@ -612,7 +602,19 @@
612
  "name": "output",
613
  "position": "top"
614
  }
615
- }
 
 
 
 
 
 
 
 
 
 
 
 
616
  }
617
  },
618
  "position": {
@@ -620,8 +622,8 @@
620
  "y": 1044.7639853229612
621
  },
622
  "height": 200.0,
623
- "parentId": null,
624
- "width": 200.0
625
  },
626
  {
627
  "id": "Chat processor 1",
@@ -631,38 +633,38 @@
631
  "params": {},
632
  "display": null,
633
  "error": null,
634
- "collapsed": true,
635
  "__execution_delay": null,
 
636
  "meta": {
 
637
  "inputs": {
638
  "processor": {
 
639
  "position": "bottom",
640
  "type": {
641
  "type": "<class 'inspect._empty'>"
642
- },
643
- "name": "processor"
644
  }
645
  },
646
  "params": {},
647
- "name": "Chat processor",
648
  "outputs": {
649
  "output": {
650
- "position": "top",
651
- "name": "output",
652
  "type": {
653
  "type": "None"
654
- }
 
 
655
  }
656
- },
657
- "type": "basic"
658
  }
659
  },
660
  "position": {
661
  "x": 182.89729246405872,
662
  "y": 778.546274223181
663
  },
664
- "width": 200.0,
665
  "parentId": null,
 
666
  "height": 200.0
667
  },
668
  {
@@ -671,23 +673,26 @@
671
  "data": {
672
  "title": "Mask",
673
  "params": {
674
675
- "regex": "([a-z0-9!#$%&'*+\\/=?^_`{|.}~-]+@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)",
676
  "mask_pattern": "masked_email_address_{}",
677
- "name": "email"
 
 
678
  },
679
  "display": null,
680
  "error": null,
681
  "meta": {
 
682
  "outputs": {
683
  "output": {
684
  "position": "top",
 
685
  "type": {
686
  "type": "None"
687
- },
688
- "name": "output"
689
  }
690
  },
 
 
691
  "params": {
692
  "name": {
693
  "default": "",
@@ -698,17 +703,10 @@
698
  },
699
  "exceptions": {
700
  "name": "exceptions",
701
- "default": "",
702
- "type": {
703
- "type": "<class 'str'>"
704
- }
705
- },
706
- "mask_pattern": {
707
- "default": "",
708
  "type": {
709
  "type": "<class 'str'>"
710
  },
711
- "name": "mask_pattern"
712
  },
713
  "regex": {
714
  "type": {
@@ -716,20 +714,24 @@
716
  },
717
  "name": "regex",
718
  "default": ""
 
 
 
 
 
 
 
719
  }
720
- },
721
- "type": "basic",
722
- "inputs": {},
723
- "name": "Mask"
724
  }
725
  },
726
  "position": {
727
  "x": 233.69759202223884,
728
  "y": 1041.6145468043276
729
  },
730
- "width": 200.0,
731
  "parentId": null,
732
- "height": 200.0
733
  },
734
  {
735
  "id": "Mask 2",
@@ -737,54 +739,54 @@
737
  "data": {
738
  "title": "Mask",
739
  "params": {
740
- "mask_pattern": "masked_credit_card_number_{}",
741
- "exceptions": "",
742
  "regex": "((?:(?:\\\\d{4}[- ]?){3}\\\\d{4}|\\\\d{15,16}))(?![\\\\d])",
743
- "name": "credit_card"
 
 
744
  },
745
  "display": null,
746
  "error": null,
747
  "meta": {
748
- "name": "Mask",
749
  "outputs": {
750
  "output": {
751
  "name": "output",
 
752
  "type": {
753
  "type": "None"
754
- },
755
- "position": "top"
756
  }
757
  },
758
- "type": "basic",
759
  "inputs": {},
 
 
760
  "params": {
761
- "mask_pattern": {
762
- "default": "",
763
  "type": {
764
  "type": "<class 'str'>"
765
  },
766
- "name": "mask_pattern"
 
767
  },
768
- "name": {
769
  "default": "",
770
- "name": "name",
771
  "type": {
772
  "type": "<class 'str'>"
773
- }
 
774
  },
775
- "exceptions": {
776
- "default": "",
777
  "type": {
778
  "type": "<class 'str'>"
779
  },
780
- "name": "exceptions"
781
  },
782
- "regex": {
 
783
  "default": "",
784
  "type": {
785
  "type": "<class 'str'>"
786
- },
787
- "name": "regex"
788
  }
789
  }
790
  }
@@ -793,9 +795,9 @@
793
  "x": 513.2761671440603,
794
  "y": 1034.8547191984255
795
  },
796
- "height": 200.0,
797
  "parentId": null,
798
- "width": 200.0
799
  },
800
  {
801
  "id": "Test Chat API 2",
@@ -807,46 +809,46 @@
807
  },
808
  "display": null,
809
  "error": null,
 
 
810
  "meta": {
811
- "outputs": {
812
- "output": {
813
- "position": "right",
814
  "type": {
815
- "type": "None"
816
  },
817
- "name": "output"
818
  }
819
  },
820
- "type": "basic",
821
  "inputs": {
822
- "chat_api": {
823
- "name": "chat_api",
 
824
  "type": {
825
  "type": "<class 'inspect._empty'>"
826
- },
827
- "position": "bottom"
828
  },
829
- "message": {
 
830
  "type": {
831
  "type": "<class 'inspect._empty'>"
832
  },
833
- "name": "message",
834
- "position": "left"
835
  }
836
  },
837
- "name": "Test Chat API",
838
- "params": {
839
- "show_details": {
840
  "type": {
841
- "type": "<class 'bool'>"
842
  },
843
- "name": "show_details",
844
- "default": false
845
  }
846
- }
847
- },
848
- "__execution_delay": 0.0,
849
- "collapsed": false
850
  },
851
  "position": {
852
  "x": -57.377776548056346,
 
7
  "data": {
8
  "title": "Input chat",
9
  "params": {
10
+ "chat": "who is the CTO of Lynx?"
11
  },
12
  "display": null,
13
  "error": null,
14
+ "collapsed": null,
15
  "meta": {
 
 
 
 
 
 
 
 
 
16
  "inputs": {},
17
  "params": {
18
  "chat": {
19
+ "default": null,
20
  "type": {
21
  "type": "<class 'str'>"
22
  },
23
+ "name": "chat"
24
+ }
25
+ },
26
+ "outputs": {
27
+ "output": {
28
+ "name": "output",
29
+ "type": {
30
+ "type": "None"
31
+ },
32
+ "position": "right"
33
  }
34
  },
35
  "name": "Input chat",
36
  "type": "basic"
37
+ },
38
+ "__execution_delay": 0.0
39
  },
40
  "position": {
41
  "x": -493.5496596237119,
42
  "y": 20.90123252513356
43
  },
44
  "height": 186.0,
45
+ "width": 259.0,
46
+ "parentId": null
47
  },
48
  {
49
  "id": "View 1",
 
59
  ],
60
  "data": [
61
  [
62
+ "TheThe Chief Technology Officer (CTO) of Lynx Analytics is Chema Lizano. He leads the technology strategy and roadmap at the company, overseeing the vision, development, and implementation of solutions across various clients and environments. If you have any more questions regarding our team or services, feel free to ask!\n\nPlease visit https://www.lynxanalytics.com/board for further information."
63
  ]
64
  ]
65
  }
 
68
  "error": null,
69
  "meta": {
70
  "type": "table_view",
 
 
71
  "name": "View",
72
  "inputs": {
73
  "input": {
 
74
  "name": "input",
75
  "type": {
76
  "type": "<class 'inspect._empty'>"
77
+ },
78
+ "position": "left"
79
  }
80
+ },
81
+ "outputs": {},
82
+ "params": {}
83
  }
84
  },
85
  "position": {
86
+ "x": 731.7440706129762,
87
+ "y": -716.4943976910913
88
  },
89
+ "width": 1256.0,
90
  "parentId": null,
91
+ "height": 950.0
92
  },
93
  {
94
  "id": "LLM 1",
 
102
  "error": null,
103
  "meta": {
104
  "inputs": {},
105
+ "outputs": {
106
+ "output": {
107
+ "type": {
108
+ "type": "None"
109
+ },
110
+ "name": "output",
111
+ "position": "top"
112
+ }
113
+ },
114
  "type": "basic",
 
115
  "params": {
116
  "name": {
117
+ "default": "openai",
118
  "name": "name",
119
  "type": {
120
  "type": "<class 'str'>"
121
+ }
 
122
  }
123
  },
124
+ "name": "LLM"
 
 
 
 
 
 
 
 
125
  }
126
  },
127
  "position": {
128
  "x": -312.5774211084781,
129
  "y": 1093.4019527511366
130
  },
131
+ "parentId": null,
132
  "width": 200.0,
133
+ "height": 200.0
134
  },
135
  {
136
  "id": "Scenario selector 1",
 
138
  "data": {
139
  "title": "Scenario selector",
140
  "params": {
141
+ "scenario_file": "/home/darabos/nvme/lynxscribe/examples/chat_api/scenarios.yaml",
142
+ "node_types": "intent_cluster"
143
  },
144
  "display": null,
145
  "error": null,
146
  "meta": {
 
 
 
 
 
 
 
 
 
 
 
 
147
  "params": {
148
  "scenario_file": {
149
  "type": {
150
  "type": "<class 'str'>"
151
  },
152
+ "name": "scenario_file",
153
+ "default": null
154
  },
155
  "node_types": {
156
+ "default": "intent_cluster",
157
  "type": {
158
  "type": "<class 'str'>"
159
  },
160
+ "name": "node_types"
 
161
  }
162
+ },
163
+ "inputs": {},
164
+ "outputs": {
165
+ "output": {
166
+ "position": "top",
167
+ "name": "output",
168
+ "type": {
169
+ "type": "None"
170
+ }
171
+ }
172
+ },
173
+ "type": "basic",
174
+ "name": "Scenario selector"
175
  }
176
  },
177
  "position": {
178
  "x": -549.1300345090008,
179
  "y": 1086.4852248156676
180
  },
181
+ "parentId": null,
182
  "height": 200.0,
183
+ "width": 200.0
184
  },
185
  {
186
  "id": "Chat API 1",
 
194
  "error": null,
195
  "meta": {
196
  "name": "Chat API",
197
+ "type": "basic",
198
  "outputs": {
199
  "output": {
 
 
200
  "type": {
201
  "type": "None"
 
 
 
 
 
 
 
202
  },
203
+ "position": "top",
204
+ "name": "output"
205
  }
206
  },
207
  "inputs": {
208
+ "chatbot": {
209
+ "name": "chatbot",
210
  "type": {
211
  "type": "<class 'inspect._empty'>"
212
  },
 
213
  "position": "bottom"
214
  },
215
+ "chat_processor": {
216
+ "name": "chat_processor",
217
+ "position": "bottom",
218
  "type": {
219
  "type": "<class 'inspect._empty'>"
220
+ }
 
 
221
  },
222
+ "knowledge_base": {
 
223
  "type": {
224
  "type": "<class 'inspect._empty'>"
225
  },
226
+ "position": "bottom",
227
+ "name": "knowledge_base"
228
  }
229
  },
230
+ "params": {
231
+ "model": {
232
+ "default": "gpt-4o-mini",
233
+ "type": {
234
+ "type": "<class 'str'>"
235
+ },
236
+ "name": "model"
237
+ }
238
+ }
239
  }
240
  },
241
  "position": {
 
243
  "y": 258.20943122219336
244
  },
245
  "parentId": null,
246
+ "width": 200.0,
247
+ "height": 200.0
248
  },
249
  {
250
  "id": "Knowledge base 1",
 
252
  "data": {
253
  "title": "Knowledge base",
254
  "params": {
255
+ "template_cluster_path": "/home/darabos/nvme/lynxscribe/examples/chat_api/data/lynx/tempclusters.pickle",
256
  "edges_path": "/home/darabos/nvme/lynxscribe/examples/chat_api/data/lynx/edges.pickle",
257
+ "nodes_path": "/home/darabos/nvme/lynxscribe/examples/chat_api/data/lynx/nodes.pickle"
258
  },
259
  "display": null,
260
  "error": null,
261
  "meta": {
262
+ "name": "Knowledge base",
263
+ "type": "basic",
264
  "params": {
265
  "nodes_path": {
266
  "name": "nodes_path",
 
269
  "type": "<class 'str'>"
270
  }
271
  },
272
+ "template_cluster_path": {
273
  "type": {
274
  "type": "<class 'str'>"
275
  },
 
 
 
 
276
  "name": "template_cluster_path",
277
+ "default": "tempclusters.pickle"
278
+ },
279
+ "edges_path": {
280
+ "name": "edges_path",
281
+ "default": "edges.pickle",
282
  "type": {
283
  "type": "<class 'str'>"
284
  }
285
  }
286
  },
 
287
  "inputs": {},
 
288
  "outputs": {
289
  "output": {
290
+ "position": "top",
291
  "name": "output",
292
  "type": {
293
  "type": "None"
294
+ }
 
295
  }
296
  }
297
  }
 
300
  "x": 598.8683124946176,
301
  "y": 609.9499973808545
302
  },
303
+ "width": 336.0,
304
  "height": 320.0,
305
+ "parentId": null
 
306
  },
307
  {
308
  "id": "RAG chatbot 1",
 
311
  "title": "RAG chatbot",
312
  "params": {
313
  "limits_by_type": "{\"information\": [2, 3], \"summary\": [2, 3]}",
 
314
  "max_results": "5",
315
+ "negative_answer": "I'm sorry, but the data I've been trained on does not contain any information related to your question.",
316
  "strict_limits": true
317
  },
318
  "display": null,
319
  "error": null,
320
  "meta": {
321
+ "outputs": {
322
+ "output": {
323
+ "position": "top",
324
+ "name": "output",
325
  "type": {
326
+ "type": "None"
327
  }
328
+ }
329
+ },
330
+ "params": {
331
  "max_results": {
332
+ "default": 5.0,
333
  "type": {
334
  "type": "<class 'int'>"
335
  },
336
+ "name": "max_results"
337
  },
338
  "strict_limits": {
 
339
  "name": "strict_limits",
340
+ "default": true,
341
  "type": {
342
  "type": "<class 'bool'>"
343
  }
344
  },
345
+ "negative_answer": {
346
+ "default": "I'm sorry, but the data I've been trained on does not contain any information related to your question.",
347
+ "name": "negative_answer",
348
+ "type": {
349
+ "type": "<class 'str'>"
350
+ }
351
+ },
352
  "limits_by_type": {
 
353
  "default": "{}",
354
+ "name": "limits_by_type",
355
  "type": {
356
  "type": "<class 'str'>"
357
  }
358
  }
359
  },
 
 
 
 
 
 
 
 
 
 
360
  "name": "RAG chatbot",
361
+ "type": "basic",
362
  "inputs": {
363
  "rag_graph": {
 
364
  "type": {
365
  "type": "<class 'inspect._empty'>"
366
  },
367
+ "name": "rag_graph",
368
  "position": "bottom"
369
  },
370
+ "llm": {
371
+ "name": "llm",
372
+ "position": "bottom",
373
  "type": {
374
  "type": "<class 'inspect._empty'>"
375
+ }
 
376
  },
377
+ "scenario_selector": {
 
378
  "type": {
379
  "type": "<class 'inspect._empty'>"
380
  },
381
+ "name": "scenario_selector",
382
  "position": "bottom"
383
  }
384
  }
 
389
  "x": -533.1301830766971,
390
  "y": 547.294980747757
391
  },
 
392
  "parentId": null,
393
+ "height": 399.0,
394
+ "width": 339.0
395
  },
396
  {
397
  "id": "RAG graph 1",
 
402
  "display": null,
403
  "error": null,
404
  "meta": {
405
+ "type": "basic",
406
  "inputs": {
407
+ "text_embedder": {
 
408
  "type": {
409
  "type": "<class 'inspect._empty'>"
410
  },
411
+ "position": "bottom",
412
+ "name": "text_embedder"
413
  },
414
+ "vector_store": {
415
+ "position": "bottom",
416
  "type": {
417
  "type": "<class 'inspect._empty'>"
418
  },
419
+ "name": "vector_store"
 
420
  }
421
  },
422
+ "name": "RAG graph",
423
  "params": {},
424
  "outputs": {
425
  "output": {
426
  "position": "top",
 
427
  "type": {
428
  "type": "None"
429
+ },
430
+ "name": "output"
431
  }
432
+ }
 
433
  }
434
  },
435
  "position": {
436
  "x": -817.8208895639339,
437
  "y": 1014.836542916127
438
  },
439
+ "parentId": null,
440
  "width": 200.0,
441
+ "height": 200.0
442
  },
443
  {
444
  "id": "Vector store 1",
 
455
  "meta": {
456
  "params": {
457
  "collection_name": {
 
458
  "type": {
459
  "type": "<class 'str'>"
460
  },
461
+ "default": "lynx",
462
  "name": "collection_name"
463
  },
464
  "name": {
465
  "default": "chromadb",
 
466
  "type": {
467
  "type": "<class 'str'>"
468
+ },
469
+ "name": "name"
470
  }
471
  },
472
+ "type": "basic",
473
  "name": "Vector store",
474
  "outputs": {
475
  "output": {
 
476
  "type": {
477
  "type": "None"
478
  },
479
+ "position": "top",
480
+ "name": "output"
481
  }
482
  },
 
483
  "inputs": {}
484
  }
485
  },
 
502
  "display": null,
503
  "error": null,
504
  "meta": {
 
505
  "params": {
506
  "model": {
507
+ "default": "text-embedding-ada-002",
508
  "type": {
509
  "type": "<class 'str'>"
510
  },
511
+ "name": "model"
 
 
 
 
 
 
 
 
 
 
512
  }
513
  },
514
  "name": "Text embedder",
515
  "outputs": {
516
  "output": {
 
517
  "type": {
518
  "type": "None"
519
  },
520
+ "position": "top",
521
+ "name": "output"
522
+ }
523
+ },
524
+ "type": "basic",
525
+ "inputs": {
526
+ "llm": {
527
+ "type": {
528
+ "type": "<class 'inspect._empty'>"
529
+ },
530
+ "name": "llm",
531
+ "position": "bottom"
532
  }
533
  }
534
  }
 
538
  "y": 1343.5978526690794
539
  },
540
  "width": 200.0,
541
+ "height": 200.0,
542
+ "parentId": null
543
  },
544
  {
545
  "id": "LLM 2",
 
552
  "display": null,
553
  "error": null,
554
  "meta": {
555
+ "outputs": {
556
+ "output": {
557
+ "position": "top",
558
+ "name": "output",
559
+ "type": {
560
+ "type": "None"
561
+ }
562
+ }
563
+ },
564
+ "name": "LLM",
565
  "type": "basic",
566
+ "inputs": {},
567
  "params": {
568
  "name": {
 
569
  "default": "openai",
570
+ "name": "name",
571
  "type": {
572
  "type": "<class 'str'>"
573
  }
574
  }
575
+ }
 
 
 
 
 
 
 
 
 
 
576
  }
577
  },
578
  "position": {
579
  "x": -727.6171373682814,
580
  "y": 1649.7242636905507
581
  },
 
582
  "width": 200.0,
583
+ "parentId": null,
584
+ "height": 200.0
585
  },
586
  {
587
  "id": "Truncate history 1",
 
594
  "display": null,
595
  "error": null,
596
  "meta": {
 
 
 
 
 
 
 
 
 
 
 
 
597
  "outputs": {
598
  "output": {
599
  "type": {
 
602
  "name": "output",
603
  "position": "top"
604
  }
605
+ },
606
+ "type": "basic",
607
+ "params": {
608
+ "max_tokens": {
609
+ "default": 10000.0,
610
+ "name": "max_tokens",
611
+ "type": {
612
+ "type": "<class 'int'>"
613
+ }
614
+ }
615
+ },
616
+ "name": "Truncate history",
617
+ "inputs": {}
618
  }
619
  },
620
  "position": {
 
622
  "y": 1044.7639853229612
623
  },
624
  "height": 200.0,
625
+ "width": 200.0,
626
+ "parentId": null
627
  },
628
  {
629
  "id": "Chat processor 1",
 
633
  "params": {},
634
  "display": null,
635
  "error": null,
 
636
  "__execution_delay": null,
637
+ "collapsed": true,
638
  "meta": {
639
+ "name": "Chat processor",
640
  "inputs": {
641
  "processor": {
642
+ "name": "processor",
643
  "position": "bottom",
644
  "type": {
645
  "type": "<class 'inspect._empty'>"
646
+ }
 
647
  }
648
  },
649
  "params": {},
650
+ "type": "basic",
651
  "outputs": {
652
  "output": {
 
 
653
  "type": {
654
  "type": "None"
655
+ },
656
+ "position": "top",
657
+ "name": "output"
658
  }
659
+ }
 
660
  }
661
  },
662
  "position": {
663
  "x": 182.89729246405872,
664
  "y": 778.546274223181
665
  },
 
666
  "parentId": null,
667
+ "width": 200.0,
668
  "height": 200.0
669
  },
670
  {
 
673
  "data": {
674
  "title": "Mask",
675
  "params": {
 
 
676
  "mask_pattern": "masked_email_address_{}",
677
+ "name": "email",
678
679
+ "regex": "([a-z0-9!#$%&'*+\\/=?^_`{|.}~-]+@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)"
680
  },
681
  "display": null,
682
  "error": null,
683
  "meta": {
684
+ "inputs": {},
685
  "outputs": {
686
  "output": {
687
  "position": "top",
688
+ "name": "output",
689
  "type": {
690
  "type": "None"
691
+ }
 
692
  }
693
  },
694
+ "type": "basic",
695
+ "name": "Mask",
696
  "params": {
697
  "name": {
698
  "default": "",
 
703
  },
704
  "exceptions": {
705
  "name": "exceptions",
 
 
 
 
 
 
 
706
  "type": {
707
  "type": "<class 'str'>"
708
  },
709
+ "default": ""
710
  },
711
  "regex": {
712
  "type": {
 
714
  },
715
  "name": "regex",
716
  "default": ""
717
+ },
718
+ "mask_pattern": {
719
+ "default": "",
720
+ "type": {
721
+ "type": "<class 'str'>"
722
+ },
723
+ "name": "mask_pattern"
724
  }
725
+ }
 
 
 
726
  }
727
  },
728
  "position": {
729
  "x": 233.69759202223884,
730
  "y": 1041.6145468043276
731
  },
732
+ "height": 200.0,
733
  "parentId": null,
734
+ "width": 200.0
735
  },
736
  {
737
  "id": "Mask 2",
 
739
  "data": {
740
  "title": "Mask",
741
  "params": {
 
 
742
  "regex": "((?:(?:\\\\d{4}[- ]?){3}\\\\d{4}|\\\\d{15,16}))(?![\\\\d])",
743
+ "exceptions": "",
744
+ "name": "credit_card",
745
+ "mask_pattern": "masked_credit_card_number_{}"
746
  },
747
  "display": null,
748
  "error": null,
749
  "meta": {
 
750
  "outputs": {
751
  "output": {
752
  "name": "output",
753
+ "position": "top",
754
  "type": {
755
  "type": "None"
756
+ }
 
757
  }
758
  },
 
759
  "inputs": {},
760
+ "name": "Mask",
761
+ "type": "basic",
762
  "params": {
763
+ "exceptions": {
 
764
  "type": {
765
  "type": "<class 'str'>"
766
  },
767
+ "default": "",
768
+ "name": "exceptions"
769
  },
770
+ "regex": {
771
  "default": "",
 
772
  "type": {
773
  "type": "<class 'str'>"
774
+ },
775
+ "name": "regex"
776
  },
777
+ "mask_pattern": {
778
+ "name": "mask_pattern",
779
  "type": {
780
  "type": "<class 'str'>"
781
  },
782
+ "default": ""
783
  },
784
+ "name": {
785
+ "name": "name",
786
  "default": "",
787
  "type": {
788
  "type": "<class 'str'>"
789
+ }
 
790
  }
791
  }
792
  }
 
795
  "x": 513.2761671440603,
796
  "y": 1034.8547191984255
797
  },
798
+ "width": 200.0,
799
  "parentId": null,
800
+ "height": 200.0
801
  },
802
  {
803
  "id": "Test Chat API 2",
 
809
  },
810
  "display": null,
811
  "error": null,
812
+ "collapsed": false,
813
+ "__execution_delay": 0.0,
814
  "meta": {
815
+ "params": {
816
+ "show_details": {
817
+ "default": false,
818
  "type": {
819
+ "type": "<class 'bool'>"
820
  },
821
+ "name": "show_details"
822
  }
823
  },
 
824
  "inputs": {
825
+ "message": {
826
+ "name": "message",
827
+ "position": "left",
828
  "type": {
829
  "type": "<class 'inspect._empty'>"
830
+ }
 
831
  },
832
+ "chat_api": {
833
+ "position": "bottom",
834
  "type": {
835
  "type": "<class 'inspect._empty'>"
836
  },
837
+ "name": "chat_api"
 
838
  }
839
  },
840
+ "outputs": {
841
+ "output": {
842
+ "position": "right",
843
  "type": {
844
+ "type": "None"
845
  },
846
+ "name": "output"
 
847
  }
848
+ },
849
+ "name": "Test Chat API",
850
+ "type": "basic"
851
+ }
852
  },
853
  "position": {
854
  "x": -57.377776548056346,
lynxkite-lynxscribe/src/lynxkite_plugins/lynxscribe/__init__.py CHANGED
@@ -1,2 +1,5 @@
1
  from . import lynxscribe_ops
2
  from . import llm_ops
 
 
 
 
1
  from . import lynxscribe_ops
2
  from . import llm_ops
3
+ from .lynxscribe_ops import api_service_post, api_service_get
4
+
5
+ __all__ = ["api_service_post", "api_service_get"]
lynxkite-lynxscribe/src/lynxkite_plugins/lynxscribe/lynxscribe_ops.py CHANGED
@@ -160,11 +160,12 @@ async def test_chat_api(message, chat_api, *, show_details=False):
160
  model="",
161
  messages=[{"role": "user", "content": message["text"]}],
162
  )
163
- response = await chat_api.answer(request)
 
164
  if show_details:
165
- return {**response.__dict__}
166
  else:
167
- return {"answer": response.choices[0].message.content}
168
 
169
 
170
  @op("Input chat")
@@ -237,22 +238,9 @@ async def get_chat_api(ws):
237
 
238
  async def stream_chat_api_response(request):
239
  chat_api = await get_chat_api(request["model"])
240
- response = await chat_api.answer(request)
241
- response = response.model_dump()
242
- yield json.dumps(
243
- {
244
- **response,
245
- "id": "asd",
246
- "object": "chat.completion.chunk",
247
- "model": request["model"],
248
- "choices": [
249
- {
250
- "index": 0,
251
- "delta": {"role": "assistant", "content": response["answer"]},
252
- }
253
- ],
254
- }
255
- )
256
 
257
 
258
  async def api_service_post(request):
 
160
  model="",
161
  messages=[{"role": "user", "content": message["text"]}],
162
  )
163
+ response = await chat_api.answer(request, stream=False)
164
+ answer = response.choices[0].message.content
165
  if show_details:
166
+ return {"answer": answer, **response.__dict__}
167
  else:
168
+ return {"answer": answer}
169
 
170
 
171
  @op("Input chat")
 
238
 
239
  async def stream_chat_api_response(request):
240
  chat_api = await get_chat_api(request["model"])
241
+ request = ChatCompletionPrompt(**request)
242
+ async for chunk in await chat_api.answer(request, stream=True):
243
+ yield chunk.model_dump_json()
 
 
 
 
 
 
 
 
 
 
 
 
 
244
 
245
 
246
  async def api_service_post(request):