Flowise

Форк
0
1681 строка · 72.9 Кб
1
{
2
    "description": "Manually construct prompts to query a SQL database",
3
    "categories": "IfElse Function,Variable Set/Get,Custom JS Function,ChatOpenAI,LLM Chain,Langchain",
4
    "framework": "Langchain",
5
    "badge": "new",
6
    "nodes": [
7
        {
8
            "width": 300,
9
            "height": 511,
10
            "id": "promptTemplate_0",
11
            "position": {
12
                "x": 384.84394025989127,
13
                "y": 61.21205260943492
14
            },
15
            "type": "customNode",
16
            "data": {
17
                "id": "promptTemplate_0",
18
                "label": "Prompt Template",
19
                "version": 1,
20
                "name": "promptTemplate",
21
                "type": "PromptTemplate",
22
                "baseClasses": ["PromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate", "Runnable"],
23
                "category": "Prompts",
24
                "description": "Schema to represent a basic prompt for an LLM",
25
                "inputParams": [
26
                    {
27
                        "label": "Template",
28
                        "name": "template",
29
                        "type": "string",
30
                        "rows": 4,
31
                        "placeholder": "What is a good name for a company that makes {product}?",
32
                        "id": "promptTemplate_0-input-template-string"
33
                    },
34
                    {
35
                        "label": "Format Prompt Values",
36
                        "name": "promptValues",
37
                        "type": "json",
38
                        "optional": true,
39
                        "acceptVariable": true,
40
                        "list": true,
41
                        "id": "promptTemplate_0-input-promptValues-json"
42
                    }
43
                ],
44
                "inputAnchors": [],
45
                "inputs": {
46
                    "template": "Based on the provided SQL table schema and question below, return a SQL SELECT ALL query that would answer the user's question. For example: SELECT * FROM table WHERE id = '1'.\n------------\nSCHEMA: {schema}\n------------\nQUESTION: {question}\n------------\nSQL QUERY:",
47
                    "promptValues": "{\"schema\":\"{{setVariable_0.data.instance}}\",\"question\":\"{{question}}\"}"
48
                },
49
                "outputAnchors": [
50
                    {
51
                        "id": "promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable",
52
                        "name": "promptTemplate",
53
                        "label": "PromptTemplate",
54
                        "type": "PromptTemplate | BaseStringPromptTemplate | BasePromptTemplate | Runnable"
55
                    }
56
                ],
57
                "outputs": {},
58
                "selected": false
59
            },
60
            "selected": false,
61
            "positionAbsolute": {
62
                "x": 384.84394025989127,
63
                "y": 61.21205260943492
64
            },
65
            "dragging": false
66
        },
67
        {
68
            "width": 300,
69
            "height": 507,
70
            "id": "llmChain_0",
71
            "position": {
72
                "x": 770.4559230968546,
73
                "y": -127.11351409346554
74
            },
75
            "type": "customNode",
76
            "data": {
77
                "id": "llmChain_0",
78
                "label": "LLM Chain",
79
                "version": 3,
80
                "name": "llmChain",
81
                "type": "LLMChain",
82
                "baseClasses": ["LLMChain", "BaseChain", "Runnable"],
83
                "category": "Chains",
84
                "description": "Chain to run queries against LLMs",
85
                "inputParams": [
86
                    {
87
                        "label": "Chain Name",
88
                        "name": "chainName",
89
                        "type": "string",
90
                        "placeholder": "Name Your Chain",
91
                        "optional": true,
92
                        "id": "llmChain_0-input-chainName-string"
93
                    }
94
                ],
95
                "inputAnchors": [
96
                    {
97
                        "label": "Language Model",
98
                        "name": "model",
99
                        "type": "BaseLanguageModel",
100
                        "id": "llmChain_0-input-model-BaseLanguageModel"
101
                    },
102
                    {
103
                        "label": "Prompt",
104
                        "name": "prompt",
105
                        "type": "BasePromptTemplate",
106
                        "id": "llmChain_0-input-prompt-BasePromptTemplate"
107
                    },
108
                    {
109
                        "label": "Output Parser",
110
                        "name": "outputParser",
111
                        "type": "BaseLLMOutputParser",
112
                        "optional": true,
113
                        "id": "llmChain_0-input-outputParser-BaseLLMOutputParser"
114
                    },
115
                    {
116
                        "label": "Input Moderation",
117
                        "description": "Detect text that could generate harmful output and prevent it from being sent to the language model",
118
                        "name": "inputModeration",
119
                        "type": "Moderation",
120
                        "optional": true,
121
                        "list": true,
122
                        "id": "llmChain_0-input-inputModeration-Moderation"
123
                    }
124
                ],
125
                "inputs": {
126
                    "model": "{{chatOpenAI_0.data.instance}}",
127
                    "prompt": "{{promptTemplate_0.data.instance}}",
128
                    "outputParser": "",
129
                    "inputModeration": "",
130
                    "chainName": "SQL Query Chain"
131
                },
132
                "outputAnchors": [
133
                    {
134
                        "name": "output",
135
                        "label": "Output",
136
                        "type": "options",
137
                        "options": [
138
                            {
139
                                "id": "llmChain_0-output-llmChain-LLMChain|BaseChain|Runnable",
140
                                "name": "llmChain",
141
                                "label": "LLM Chain",
142
                                "type": "LLMChain | BaseChain | Runnable"
143
                            },
144
                            {
145
                                "id": "llmChain_0-output-outputPrediction-string|json",
146
                                "name": "outputPrediction",
147
                                "label": "Output Prediction",
148
                                "type": "string | json"
149
                            }
150
                        ],
151
                        "default": "llmChain"
152
                    }
153
                ],
154
                "outputs": {
155
                    "output": "outputPrediction"
156
                },
157
                "selected": false
158
            },
159
            "selected": false,
160
            "positionAbsolute": {
161
                "x": 770.4559230968546,
162
                "y": -127.11351409346554
163
            },
164
            "dragging": false
165
        },
166
        {
167
            "width": 300,
168
            "height": 574,
169
            "id": "chatOpenAI_0",
170
            "position": {
171
                "x": 372.72389181000057,
172
                "y": -561.0744498265477
173
            },
174
            "type": "customNode",
175
            "data": {
176
                "id": "chatOpenAI_0",
177
                "label": "ChatOpenAI",
178
                "version": 6.0,
179
                "name": "chatOpenAI",
180
                "type": "ChatOpenAI",
181
                "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "Runnable"],
182
                "category": "Chat Models",
183
                "description": "Wrapper around OpenAI large language models that use the Chat endpoint",
184
                "inputParams": [
185
                    {
186
                        "label": "Connect Credential",
187
                        "name": "credential",
188
                        "type": "credential",
189
                        "credentialNames": ["openAIApi"],
190
                        "id": "chatOpenAI_0-input-credential-credential"
191
                    },
192
                    {
193
                        "label": "Model Name",
194
                        "name": "modelName",
195
                        "type": "asyncOptions",
196
                        "loadMethod": "listModels",
197
                        "default": "gpt-3.5-turbo",
198
                        "id": "chatOpenAI_0-input-modelName-options"
199
                    },
200
                    {
201
                        "label": "Temperature",
202
                        "name": "temperature",
203
                        "type": "number",
204
                        "step": 0.1,
205
                        "default": 0.9,
206
                        "optional": true,
207
                        "id": "chatOpenAI_0-input-temperature-number"
208
                    },
209
                    {
210
                        "label": "Max Tokens",
211
                        "name": "maxTokens",
212
                        "type": "number",
213
                        "step": 1,
214
                        "optional": true,
215
                        "additionalParams": true,
216
                        "id": "chatOpenAI_0-input-maxTokens-number"
217
                    },
218
                    {
219
                        "label": "Top Probability",
220
                        "name": "topP",
221
                        "type": "number",
222
                        "step": 0.1,
223
                        "optional": true,
224
                        "additionalParams": true,
225
                        "id": "chatOpenAI_0-input-topP-number"
226
                    },
227
                    {
228
                        "label": "Frequency Penalty",
229
                        "name": "frequencyPenalty",
230
                        "type": "number",
231
                        "step": 0.1,
232
                        "optional": true,
233
                        "additionalParams": true,
234
                        "id": "chatOpenAI_0-input-frequencyPenalty-number"
235
                    },
236
                    {
237
                        "label": "Presence Penalty",
238
                        "name": "presencePenalty",
239
                        "type": "number",
240
                        "step": 0.1,
241
                        "optional": true,
242
                        "additionalParams": true,
243
                        "id": "chatOpenAI_0-input-presencePenalty-number"
244
                    },
245
                    {
246
                        "label": "Timeout",
247
                        "name": "timeout",
248
                        "type": "number",
249
                        "step": 1,
250
                        "optional": true,
251
                        "additionalParams": true,
252
                        "id": "chatOpenAI_0-input-timeout-number"
253
                    },
254
                    {
255
                        "label": "BasePath",
256
                        "name": "basepath",
257
                        "type": "string",
258
                        "optional": true,
259
                        "additionalParams": true,
260
                        "id": "chatOpenAI_0-input-basepath-string"
261
                    },
262
                    {
263
                        "label": "BaseOptions",
264
                        "name": "baseOptions",
265
                        "type": "json",
266
                        "optional": true,
267
                        "additionalParams": true,
268
                        "id": "chatOpenAI_0-input-baseOptions-json"
269
                    },
270
                    {
271
                        "label": "Allow Image Uploads",
272
                        "name": "allowImageUploads",
273
                        "type": "boolean",
274
                        "description": "Automatically uses gpt-4-vision-preview when image is being uploaded from chat. Only works with LLMChain, Conversation Chain, ReAct Agent, and Conversational Agent",
275
                        "default": false,
276
                        "optional": true,
277
                        "id": "chatOpenAI_0-input-allowImageUploads-boolean"
278
                    },
279
                    {
280
                        "label": "Image Resolution",
281
                        "description": "This parameter controls the resolution in which the model views the image.",
282
                        "name": "imageResolution",
283
                        "type": "options",
284
                        "options": [
285
                            {
286
                                "label": "Low",
287
                                "name": "low"
288
                            },
289
                            {
290
                                "label": "High",
291
                                "name": "high"
292
                            },
293
                            {
294
                                "label": "Auto",
295
                                "name": "auto"
296
                            }
297
                        ],
298
                        "default": "low",
299
                        "optional": false,
300
                        "additionalParams": true,
301
                        "id": "chatOpenAI_0-input-imageResolution-options"
302
                    }
303
                ],
304
                "inputAnchors": [
305
                    {
306
                        "label": "Cache",
307
                        "name": "cache",
308
                        "type": "BaseCache",
309
                        "optional": true,
310
                        "id": "chatOpenAI_0-input-cache-BaseCache"
311
                    }
312
                ],
313
                "inputs": {
314
                    "cache": "",
315
                    "modelName": "gpt-3.5-turbo-16k",
316
                    "temperature": "0",
317
                    "maxTokens": "",
318
                    "topP": "",
319
                    "frequencyPenalty": "",
320
                    "presencePenalty": "",
321
                    "timeout": "",
322
                    "basepath": "",
323
                    "baseOptions": "",
324
                    "allowImageUploads": true,
325
                    "imageResolution": "low"
326
                },
327
                "outputAnchors": [
328
                    {
329
                        "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
330
                        "name": "chatOpenAI",
331
                        "label": "ChatOpenAI",
332
                        "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | Runnable"
333
                    }
334
                ],
335
                "outputs": {},
336
                "selected": false
337
            },
338
            "selected": false,
339
            "positionAbsolute": {
340
                "x": 372.72389181000057,
341
                "y": -561.0744498265477
342
            },
343
            "dragging": false
344
        },
345
        {
346
            "width": 300,
347
            "height": 574,
348
            "id": "chatOpenAI_1",
349
            "position": {
350
                "x": 2636.1598769864936,
351
                "y": -653.0025971757484
352
            },
353
            "type": "customNode",
354
            "data": {
355
                "id": "chatOpenAI_1",
356
                "label": "ChatOpenAI",
357
                "version": 6.0,
358
                "name": "chatOpenAI",
359
                "type": "ChatOpenAI",
360
                "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "Runnable"],
361
                "category": "Chat Models",
362
                "description": "Wrapper around OpenAI large language models that use the Chat endpoint",
363
                "inputParams": [
364
                    {
365
                        "label": "Connect Credential",
366
                        "name": "credential",
367
                        "type": "credential",
368
                        "credentialNames": ["openAIApi"],
369
                        "id": "chatOpenAI_1-input-credential-credential"
370
                    },
371
                    {
372
                        "label": "Model Name",
373
                        "name": "modelName",
374
                        "type": "asyncOptions",
375
                        "loadMethod": "listModels",
376
                        "default": "gpt-3.5-turbo",
377
                        "id": "chatOpenAI_1-input-modelName-options"
378
                    },
379
                    {
380
                        "label": "Temperature",
381
                        "name": "temperature",
382
                        "type": "number",
383
                        "step": 0.1,
384
                        "default": 0.9,
385
                        "optional": true,
386
                        "id": "chatOpenAI_1-input-temperature-number"
387
                    },
388
                    {
389
                        "label": "Max Tokens",
390
                        "name": "maxTokens",
391
                        "type": "number",
392
                        "step": 1,
393
                        "optional": true,
394
                        "additionalParams": true,
395
                        "id": "chatOpenAI_1-input-maxTokens-number"
396
                    },
397
                    {
398
                        "label": "Top Probability",
399
                        "name": "topP",
400
                        "type": "number",
401
                        "step": 0.1,
402
                        "optional": true,
403
                        "additionalParams": true,
404
                        "id": "chatOpenAI_1-input-topP-number"
405
                    },
406
                    {
407
                        "label": "Frequency Penalty",
408
                        "name": "frequencyPenalty",
409
                        "type": "number",
410
                        "step": 0.1,
411
                        "optional": true,
412
                        "additionalParams": true,
413
                        "id": "chatOpenAI_1-input-frequencyPenalty-number"
414
                    },
415
                    {
416
                        "label": "Presence Penalty",
417
                        "name": "presencePenalty",
418
                        "type": "number",
419
                        "step": 0.1,
420
                        "optional": true,
421
                        "additionalParams": true,
422
                        "id": "chatOpenAI_1-input-presencePenalty-number"
423
                    },
424
                    {
425
                        "label": "Timeout",
426
                        "name": "timeout",
427
                        "type": "number",
428
                        "step": 1,
429
                        "optional": true,
430
                        "additionalParams": true,
431
                        "id": "chatOpenAI_1-input-timeout-number"
432
                    },
433
                    {
434
                        "label": "BasePath",
435
                        "name": "basepath",
436
                        "type": "string",
437
                        "optional": true,
438
                        "additionalParams": true,
439
                        "id": "chatOpenAI_1-input-basepath-string"
440
                    },
441
                    {
442
                        "label": "BaseOptions",
443
                        "name": "baseOptions",
444
                        "type": "json",
445
                        "optional": true,
446
                        "additionalParams": true,
447
                        "id": "chatOpenAI_1-input-baseOptions-json"
448
                    },
449
                    {
450
                        "label": "Allow Image Uploads",
451
                        "name": "allowImageUploads",
452
                        "type": "boolean",
453
                        "description": "Automatically uses gpt-4-vision-preview when image is being uploaded from chat. Only works with LLMChain, Conversation Chain, ReAct Agent, and Conversational Agent",
454
                        "default": false,
455
                        "optional": true,
456
                        "id": "chatOpenAI_1-input-allowImageUploads-boolean"
457
                    },
458
                    {
459
                        "label": "Image Resolution",
460
                        "description": "This parameter controls the resolution in which the model views the image.",
461
                        "name": "imageResolution",
462
                        "type": "options",
463
                        "options": [
464
                            {
465
                                "label": "Low",
466
                                "name": "low"
467
                            },
468
                            {
469
                                "label": "High",
470
                                "name": "high"
471
                            },
472
                            {
473
                                "label": "Auto",
474
                                "name": "auto"
475
                            }
476
                        ],
477
                        "default": "low",
478
                        "optional": false,
479
                        "additionalParams": true,
480
                        "id": "chatOpenAI_1-input-imageResolution-options"
481
                    }
482
                ],
483
                "inputAnchors": [
484
                    {
485
                        "label": "Cache",
486
                        "name": "cache",
487
                        "type": "BaseCache",
488
                        "optional": true,
489
                        "id": "chatOpenAI_1-input-cache-BaseCache"
490
                    }
491
                ],
492
                "inputs": {
493
                    "cache": "",
494
                    "modelName": "gpt-3.5-turbo-16k",
495
                    "temperature": "0",
496
                    "maxTokens": "",
497
                    "topP": "",
498
                    "frequencyPenalty": "",
499
                    "presencePenalty": "",
500
                    "timeout": "",
501
                    "basepath": "",
502
                    "baseOptions": "",
503
                    "allowImageUploads": true,
504
                    "imageResolution": "low"
505
                },
506
                "outputAnchors": [
507
                    {
508
                        "id": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
509
                        "name": "chatOpenAI",
510
                        "label": "ChatOpenAI",
511
                        "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | Runnable"
512
                    }
513
                ],
514
                "outputs": {},
515
                "selected": false
516
            },
517
            "selected": false,
518
            "positionAbsolute": {
519
                "x": 2636.1598769864936,
520
                "y": -653.0025971757484
521
            },
522
            "dragging": false
523
        },
524
        {
525
            "width": 300,
526
            "height": 507,
527
            "id": "llmChain_1",
528
            "position": {
529
                "x": 3089.9937691022837,
530
                "y": -109.24001734925716
531
            },
532
            "type": "customNode",
533
            "data": {
534
                "id": "llmChain_1",
535
                "label": "LLM Chain",
536
                "version": 3,
537
                "name": "llmChain",
538
                "type": "LLMChain",
539
                "baseClasses": ["LLMChain", "BaseChain", "Runnable"],
540
                "category": "Chains",
541
                "description": "Chain to run queries against LLMs",
542
                "inputParams": [
543
                    {
544
                        "label": "Chain Name",
545
                        "name": "chainName",
546
                        "type": "string",
547
                        "placeholder": "Name Your Chain",
548
                        "optional": true,
549
                        "id": "llmChain_1-input-chainName-string"
550
                    }
551
                ],
552
                "inputAnchors": [
553
                    {
554
                        "label": "Language Model",
555
                        "name": "model",
556
                        "type": "BaseLanguageModel",
557
                        "id": "llmChain_1-input-model-BaseLanguageModel"
558
                    },
559
                    {
560
                        "label": "Prompt",
561
                        "name": "prompt",
562
                        "type": "BasePromptTemplate",
563
                        "id": "llmChain_1-input-prompt-BasePromptTemplate"
564
                    },
565
                    {
566
                        "label": "Output Parser",
567
                        "name": "outputParser",
568
                        "type": "BaseLLMOutputParser",
569
                        "optional": true,
570
                        "id": "llmChain_1-input-outputParser-BaseLLMOutputParser"
571
                    },
572
                    {
573
                        "label": "Input Moderation",
574
                        "description": "Detect text that could generate harmful output and prevent it from being sent to the language model",
575
                        "name": "inputModeration",
576
                        "type": "Moderation",
577
                        "optional": true,
578
                        "list": true,
579
                        "id": "llmChain_1-input-inputModeration-Moderation"
580
                    }
581
                ],
582
                "inputs": {
583
                    "model": "{{chatOpenAI_1.data.instance}}",
584
                    "prompt": "{{promptTemplate_1.data.instance}}",
585
                    "outputParser": "",
586
                    "inputModeration": "",
587
                    "chainName": "Final Chain"
588
                },
589
                "outputAnchors": [
590
                    {
591
                        "name": "output",
592
                        "label": "Output",
593
                        "type": "options",
594
                        "options": [
595
                            {
596
                                "id": "llmChain_1-output-llmChain-LLMChain|BaseChain|Runnable",
597
                                "name": "llmChain",
598
                                "label": "LLM Chain",
599
                                "type": "LLMChain | BaseChain | Runnable"
600
                            },
601
                            {
602
                                "id": "llmChain_1-output-outputPrediction-string|json",
603
                                "name": "outputPrediction",
604
                                "label": "Output Prediction",
605
                                "type": "string | json"
606
                            }
607
                        ],
608
                        "default": "llmChain"
609
                    }
610
                ],
611
                "outputs": {
612
                    "output": "llmChain"
613
                },
614
                "selected": false
615
            },
616
            "selected": false,
617
            "positionAbsolute": {
618
                "x": 3089.9937691022837,
619
                "y": -109.24001734925716
620
            },
621
            "dragging": false
622
        },
623
        {
624
            "width": 300,
625
            "height": 669,
626
            "id": "customFunction_2",
627
            "position": {
628
                "x": -395.18079694059173,
629
                "y": -222.8935573325382
630
            },
631
            "type": "customNode",
632
            "data": {
633
                "id": "customFunction_2",
634
                "label": "Custom JS Function",
635
                "version": 1,
636
                "name": "customFunction",
637
                "type": "CustomFunction",
638
                "baseClasses": ["CustomFunction", "Utilities"],
639
                "category": "Utilities",
640
                "description": "Execute custom javascript function",
641
                "inputParams": [
642
                    {
643
                        "label": "Input Variables",
644
                        "name": "functionInputVariables",
645
                        "description": "Input variables can be used in the function with prefix $. For example: $var",
646
                        "type": "json",
647
                        "optional": true,
648
                        "acceptVariable": true,
649
                        "list": true,
650
                        "id": "customFunction_2-input-functionInputVariables-json"
651
                    },
652
                    {
653
                        "label": "Function Name",
654
                        "name": "functionName",
655
                        "type": "string",
656
                        "placeholder": "My Function",
657
                        "id": "customFunction_2-input-functionName-string"
658
                    },
659
                    {
660
                        "label": "Javascript Function",
661
                        "name": "javascriptFunction",
662
                        "type": "code",
663
                        "id": "customFunction_2-input-javascriptFunction-code"
664
                    }
665
                ],
666
                "inputAnchors": [],
667
                "inputs": {
668
                    "functionInputVariables": "",
669
                    "functionName": "Get SQL Schema Prompt",
670
                    "javascriptFunction": "const HOST = 'singlestore-host.com';\nconst USER = 'admin';\nconst PASSWORD = 'mypassword';\nconst DATABASE = 'mydb';\nconst TABLE = 'samples';\nconst mysql = require('mysql2/promise');\n\nlet sqlSchemaPrompt;\n\n/**\n * Ideal prompt contains schema info and examples\n * Follows best practices as specified form https://arxiv.org/abs/2204.00498\n * =========================================\n * CREATE TABLE samples (firstName varchar NOT NULL, lastName varchar)\n * SELECT * FROM samples LIMIT 3\n * firstName lastName\n * Stephen Tyler\n * Jack McGinnis\n * Steven Repici\n * =========================================\n*/\nfunction getSQLPrompt() {\n  return new Promise(async (resolve, reject) => {\n    try {\n      const singleStoreConnection = mysql.createPool({\n        host: HOST,\n        user: USER,\n        password: PASSWORD,\n        database: DATABASE,\n      });\n  \n      // Get schema info\n      const [schemaInfo] = await singleStoreConnection.execute(\n        `SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = \"${TABLE}\"`\n      );\n  \n      const createColumns = [];\n      const columnNames = [];\n  \n      for (const schemaData of schemaInfo) {\n        columnNames.push(`${schemaData['COLUMN_NAME']}`);\n        createColumns.push(`${schemaData['COLUMN_NAME']} ${schemaData['COLUMN_TYPE']} ${schemaData['IS_NULLABLE'] === 'NO' ? 'NOT NULL' : ''}`);\n      }\n  \n      const sqlCreateTableQuery = `CREATE TABLE samples (${createColumns.join(', ')})`;\n      const sqlSelectTableQuery = `SELECT * FROM samples LIMIT 3`;\n  \n      // Get first 3 rows\n      const [rows] = await singleStoreConnection.execute(\n          sqlSelectTableQuery,\n      );\n      \n      const allValues = [];\n      for (const row of rows) {\n          const rowValues = [];\n          for (const colName in row) {\n              rowValues.push(row[colName]);\n          }\n          allValues.push(rowValues.join(' '));\n      }\n  \n      sqlSchemaPrompt = sqlCreateTableQuery + '\\n' + sqlSelectTableQuery + '\\n' + columnNames.join(' ') + '\\n' + allValues.join('\\n');\n      \n      resolve();\n    } catch (e) {\n      console.error(e);\n      return reject(e);\n    }\n  });\n}\n\nasync function main() {\n    await getSQLPrompt();\n}\n\nawait main();\n\nreturn sqlSchemaPrompt;"
671
                },
672
                "outputAnchors": [
673
                    {
674
                        "name": "output",
675
                        "label": "Output",
676
                        "type": "options",
677
                        "options": [
678
                            {
679
                                "id": "customFunction_2-output-output-string|number|boolean|json|array",
680
                                "name": "output",
681
                                "label": "Output",
682
                                "type": "string | number | boolean | json | array"
683
                            }
684
                        ],
685
                        "default": "output"
686
                    }
687
                ],
688
                "outputs": {
689
                    "output": "output"
690
                },
691
                "selected": false
692
            },
693
            "selected": false,
694
            "positionAbsolute": {
695
                "x": -395.18079694059173,
696
                "y": -222.8935573325382
697
            },
698
            "dragging": false
699
        },
700
        {
701
            "width": 300,
702
            "height": 669,
703
            "id": "customFunction_1",
704
            "position": {
705
                "x": 1887.4670208331604,
706
                "y": -275.95340782935716
707
            },
708
            "type": "customNode",
709
            "data": {
710
                "id": "customFunction_1",
711
                "label": "Custom JS Function",
712
                "version": 1,
713
                "name": "customFunction",
714
                "type": "CustomFunction",
715
                "baseClasses": ["CustomFunction", "Utilities"],
716
                "category": "Utilities",
717
                "description": "Execute custom javascript function",
718
                "inputParams": [
719
                    {
720
                        "label": "Input Variables",
721
                        "name": "functionInputVariables",
722
                        "description": "Input variables can be used in the function with prefix $. For example: $var",
723
                        "type": "json",
724
                        "optional": true,
725
                        "acceptVariable": true,
726
                        "list": true,
727
                        "id": "customFunction_1-input-functionInputVariables-json"
728
                    },
729
                    {
730
                        "label": "Function Name",
731
                        "name": "functionName",
732
                        "type": "string",
733
                        "placeholder": "My Function",
734
                        "id": "customFunction_1-input-functionName-string"
735
                    },
736
                    {
737
                        "label": "Javascript Function",
738
                        "name": "javascriptFunction",
739
                        "type": "code",
740
                        "id": "customFunction_1-input-javascriptFunction-code"
741
                    }
742
                ],
743
                "inputAnchors": [],
744
                "inputs": {
745
                    "functionInputVariables": "{\"sqlQuery\":\"{{setVariable_1.data.instance}}\"}",
746
                    "functionName": "Run SQL Query",
747
                    "javascriptFunction": "const HOST = 'singlestore-host.com';\nconst USER = 'admin';\nconst PASSWORD = 'mypassword';\nconst DATABASE = 'mydb';\nconst TABLE = 'samples';\nconst mysql = require('mysql2/promise');\n\nlet result;\n\nfunction getSQLResult() {\n  return new Promise(async (resolve, reject) => {\n    try {\n      const singleStoreConnection = mysql.createPool({\n        host: HOST,\n        user: USER,\n        password: PASSWORD,\n        database: DATABASE,\n      });\n     \n      const [rows] = await singleStoreConnection.execute(\n        $sqlQuery\n      );\n  \n      result = JSON.stringify(rows)\n      \n      resolve();\n    } catch (e) {\n      console.error(e);\n      return reject(e);\n    }\n  });\n}\n\nasync function main() {\n    await getSQLResult();\n}\n\nawait main();\n\nreturn result;"
748
                },
749
                "outputAnchors": [
750
                    {
751
                        "name": "output",
752
                        "label": "Output",
753
                        "type": "options",
754
                        "options": [
755
                            {
756
                                "id": "customFunction_1-output-output-string|number|boolean|json|array",
757
                                "name": "output",
758
                                "label": "Output",
759
                                "type": "string | number | boolean | json | array"
760
                            }
761
                        ],
762
                        "default": "output"
763
                    }
764
                ],
765
                "outputs": {
766
                    "output": "output"
767
                },
768
                "selected": false
769
            },
770
            "selected": false,
771
            "positionAbsolute": {
772
                "x": 1887.4670208331604,
773
                "y": -275.95340782935716
774
            },
775
            "dragging": false
776
        },
777
        {
778
            "width": 300,
779
            "height": 511,
780
            "id": "promptTemplate_1",
781
            "position": {
782
                "x": 2638.3935631956588,
783
                "y": -18.55855423639423
784
            },
785
            "type": "customNode",
786
            "data": {
787
                "id": "promptTemplate_1",
788
                "label": "Prompt Template",
789
                "version": 1,
790
                "name": "promptTemplate",
791
                "type": "PromptTemplate",
792
                "baseClasses": ["PromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate", "Runnable"],
793
                "category": "Prompts",
794
                "description": "Schema to represent a basic prompt for an LLM",
795
                "inputParams": [
796
                    {
797
                        "label": "Template",
798
                        "name": "template",
799
                        "type": "string",
800
                        "rows": 4,
801
                        "placeholder": "What is a good name for a company that makes {product}?",
802
                        "id": "promptTemplate_1-input-template-string"
803
                    },
804
                    {
805
                        "label": "Format Prompt Values",
806
                        "name": "promptValues",
807
                        "type": "json",
808
                        "optional": true,
809
                        "acceptVariable": true,
810
                        "list": true,
811
                        "id": "promptTemplate_1-input-promptValues-json"
812
                    }
813
                ],
814
                "inputAnchors": [],
815
                "inputs": {
816
                    "template": "Based on the table schema below, question, SQL query, and SQL response, write a natural language response, be details as possible:\n------------\nSCHEMA: {schema}\n------------\nQUESTION: {question}\n------------\nSQL QUERY: {sqlQuery}\n------------\nSQL RESPONSE: {sqlResponse}\n------------\nNATURAL LANGUAGE RESPONSE:",
817
                    "promptValues": "{\"schema\":\"{{getVariable_0.data.instance}}\",\"question\":\"{{question}}\",\"sqlResponse\":\"{{customFunction_1.data.instance}}\",\"sqlQuery\":\"{{getVariable_1.data.instance}}\"}"
818
                },
819
                "outputAnchors": [
820
                    {
821
                        "id": "promptTemplate_1-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable",
822
                        "name": "promptTemplate",
823
                        "label": "PromptTemplate",
824
                        "type": "PromptTemplate | BaseStringPromptTemplate | BasePromptTemplate | Runnable"
825
                    }
826
                ],
827
                "outputs": {},
828
                "selected": false
829
            },
830
            "selected": false,
831
            "dragging": false,
832
            "positionAbsolute": {
833
                "x": 2638.3935631956588,
834
                "y": -18.55855423639423
835
            }
836
        },
837
        {
838
            "width": 300,
839
            "height": 355,
840
            "id": "setVariable_0",
841
            "position": {
842
                "x": 18.689175061831122,
843
                "y": -62.81166351070223
844
            },
845
            "type": "customNode",
846
            "data": {
847
                "id": "setVariable_0",
848
                "label": "Set Variable",
849
                "version": 1,
850
                "name": "setVariable",
851
                "type": "SetVariable",
852
                "baseClasses": ["SetVariable", "Utilities"],
853
                "category": "Utilities",
854
                "description": "Set variable which can be retrieved at a later stage. Variable is only available during runtime.",
855
                "inputParams": [
856
                    {
857
                        "label": "Variable Name",
858
                        "name": "variableName",
859
                        "type": "string",
860
                        "placeholder": "var1",
861
                        "id": "setVariable_0-input-variableName-string"
862
                    }
863
                ],
864
                "inputAnchors": [
865
                    {
866
                        "label": "Input",
867
                        "name": "input",
868
                        "type": "string | number | boolean | json | array",
869
                        "optional": true,
870
                        "list": true,
871
                        "id": "setVariable_0-input-input-string | number | boolean | json | array"
872
                    }
873
                ],
874
                "inputs": {
875
                    "input": ["{{customFunction_2.data.instance}}"],
876
                    "variableName": "schemaPrompt"
877
                },
878
                "outputAnchors": [
879
                    {
880
                        "name": "output",
881
                        "label": "Output",
882
                        "type": "options",
883
                        "options": [
884
                            {
885
                                "id": "setVariable_0-output-output-string|number|boolean|json|array",
886
                                "name": "output",
887
                                "label": "Output",
888
                                "type": "string | number | boolean | json | array"
889
                            }
890
                        ],
891
                        "default": "output"
892
                    }
893
                ],
894
                "outputs": {
895
                    "output": "output"
896
                },
897
                "selected": false
898
            },
899
            "selected": false,
900
            "positionAbsolute": {
901
                "x": 18.689175061831122,
902
                "y": -62.81166351070223
903
            },
904
            "dragging": false
905
        },
906
        {
907
            "width": 300,
908
            "height": 304,
909
            "id": "getVariable_0",
910
            "position": {
911
                "x": 2248.4540716891547,
912
                "y": -47.21232652005119
913
            },
914
            "type": "customNode",
915
            "data": {
916
                "id": "getVariable_0",
917
                "label": "Get Variable",
918
                "version": 1,
919
                "name": "getVariable",
920
                "type": "GetVariable",
921
                "baseClasses": ["GetVariable", "Utilities"],
922
                "category": "Utilities",
923
                "description": "Get variable that was saved using Set Variable node",
924
                "inputParams": [
925
                    {
926
                        "label": "Variable Name",
927
                        "name": "variableName",
928
                        "type": "string",
929
                        "placeholder": "var1",
930
                        "id": "getVariable_0-input-variableName-string"
931
                    }
932
                ],
933
                "inputAnchors": [],
934
                "inputs": {
935
                    "variableName": "schemaPrompt"
936
                },
937
                "outputAnchors": [
938
                    {
939
                        "name": "output",
940
                        "label": "Output",
941
                        "type": "options",
942
                        "options": [
943
                            {
944
                                "id": "getVariable_0-output-output-string|number|boolean|json|array",
945
                                "name": "output",
946
                                "label": "Output",
947
                                "type": "string | number | boolean | json | array"
948
                            }
949
                        ],
950
                        "default": "output"
951
                    }
952
                ],
953
                "outputs": {
954
                    "output": "output"
955
                },
956
                "selected": false
957
            },
958
            "positionAbsolute": {
959
                "x": 2248.4540716891547,
960
                "y": -47.21232652005119
961
            },
962
            "selected": false,
963
            "dragging": false
964
        },
965
        {
966
            "width": 300,
967
            "height": 304,
968
            "id": "getVariable_1",
969
            "position": {
970
                "x": 2256.0258940322105,
971
                "y": 437.4363694364632
972
            },
973
            "type": "customNode",
974
            "data": {
975
                "id": "getVariable_1",
976
                "label": "Get Variable",
977
                "version": 1,
978
                "name": "getVariable",
979
                "type": "GetVariable",
980
                "baseClasses": ["GetVariable", "Utilities"],
981
                "category": "Utilities",
982
                "description": "Get variable that was saved using Set Variable node",
983
                "inputParams": [
984
                    {
985
                        "label": "Variable Name",
986
                        "name": "variableName",
987
                        "type": "string",
988
                        "placeholder": "var1",
989
                        "id": "getVariable_1-input-variableName-string"
990
                    }
991
                ],
992
                "inputAnchors": [],
993
                "inputs": {
994
                    "variableName": "sqlQuery"
995
                },
996
                "outputAnchors": [
997
                    {
998
                        "name": "output",
999
                        "label": "Output",
1000
                        "type": "options",
1001
                        "options": [
1002
                            {
1003
                                "id": "getVariable_1-output-output-string|number|boolean|json|array",
1004
                                "name": "output",
1005
                                "label": "Output",
1006
                                "type": "string | number | boolean | json | array"
1007
                            }
1008
                        ],
1009
                        "default": "output"
1010
                    }
1011
                ],
1012
                "outputs": {
1013
                    "output": "output"
1014
                },
1015
                "selected": false
1016
            },
1017
            "positionAbsolute": {
1018
                "x": 2256.0258940322105,
1019
                "y": 437.4363694364632
1020
            },
1021
            "selected": false,
1022
            "dragging": false
1023
        },
1024
        {
1025
            "width": 300,
1026
            "height": 355,
1027
            "id": "setVariable_1",
1028
            "position": {
1029
                "x": 1516.338224315744,
1030
                "y": -133.6986023683283
1031
            },
1032
            "type": "customNode",
1033
            "data": {
1034
                "id": "setVariable_1",
1035
                "label": "Set Variable",
1036
                "version": 1,
1037
                "name": "setVariable",
1038
                "type": "SetVariable",
1039
                "baseClasses": ["SetVariable", "Utilities"],
1040
                "category": "Utilities",
1041
                "description": "Set variable which can be retrieved at a later stage. Variable is only available during runtime.",
1042
                "inputParams": [
1043
                    {
1044
                        "label": "Variable Name",
1045
                        "name": "variableName",
1046
                        "type": "string",
1047
                        "placeholder": "var1",
1048
                        "id": "setVariable_1-input-variableName-string"
1049
                    }
1050
                ],
1051
                "inputAnchors": [
1052
                    {
1053
                        "label": "Input",
1054
                        "name": "input",
1055
                        "type": "string | number | boolean | json | array",
1056
                        "optional": true,
1057
                        "list": true,
1058
                        "id": "setVariable_1-input-input-string | number | boolean | json | array"
1059
                    }
1060
                ],
1061
                "inputs": {
1062
                    "input": ["{{ifElseFunction_0.data.instance}}"],
1063
                    "variableName": "sqlQuery"
1064
                },
1065
                "outputAnchors": [
1066
                    {
1067
                        "name": "output",
1068
                        "label": "Output",
1069
                        "type": "options",
1070
                        "options": [
1071
                            {
1072
                                "id": "setVariable_1-output-output-string|number|boolean|json|array",
1073
                                "name": "output",
1074
                                "label": "Output",
1075
                                "type": "string | number | boolean | json | array"
1076
                            }
1077
                        ],
1078
                        "default": "output"
1079
                    }
1080
                ],
1081
                "outputs": {
1082
                    "output": "output"
1083
                },
1084
                "selected": false
1085
            },
1086
            "selected": false,
1087
            "positionAbsolute": {
1088
                "x": 1516.338224315744,
1089
                "y": -133.6986023683283
1090
            },
1091
            "dragging": false
1092
        },
1093
        {
1094
            "width": 300,
1095
            "height": 755,
1096
            "id": "ifElseFunction_0",
1097
            "position": {
1098
                "x": 1147.8020838770517,
1099
                "y": -237.39478763322148
1100
            },
1101
            "type": "customNode",
1102
            "data": {
1103
                "id": "ifElseFunction_0",
1104
                "label": "IfElse Function",
1105
                "version": 1,
1106
                "name": "ifElseFunction",
1107
                "type": "IfElseFunction",
1108
                "baseClasses": ["IfElseFunction", "Utilities"],
1109
                "category": "Utilities",
1110
                "description": "Split flows based on If Else javascript functions",
1111
                "inputParams": [
1112
                    {
1113
                        "label": "Input Variables",
1114
                        "name": "functionInputVariables",
1115
                        "description": "Input variables can be used in the function with prefix $. For example: $var",
1116
                        "type": "json",
1117
                        "optional": true,
1118
                        "acceptVariable": true,
1119
                        "list": true,
1120
                        "id": "ifElseFunction_0-input-functionInputVariables-json"
1121
                    },
1122
                    {
1123
                        "label": "IfElse Name",
1124
                        "name": "functionName",
1125
                        "type": "string",
1126
                        "optional": true,
1127
                        "placeholder": "If Condition Match",
1128
                        "id": "ifElseFunction_0-input-functionName-string"
1129
                    },
1130
                    {
1131
                        "label": "If Function",
1132
                        "name": "ifFunction",
1133
                        "description": "Function must return a value",
1134
                        "type": "code",
1135
                        "rows": 2,
1136
                        "default": "if (\"hello\" == \"hello\") {\n    return true;\n}",
1137
                        "id": "ifElseFunction_0-input-ifFunction-code"
1138
                    },
1139
                    {
1140
                        "label": "Else Function",
1141
                        "name": "elseFunction",
1142
                        "description": "Function must return a value",
1143
                        "type": "code",
1144
                        "rows": 2,
1145
                        "default": "return false;",
1146
                        "id": "ifElseFunction_0-input-elseFunction-code"
1147
                    }
1148
                ],
1149
                "inputAnchors": [],
1150
                "inputs": {
1151
                    "functionInputVariables": "{\"sqlQuery\":\"{{llmChain_0.data.instance}}\"}",
1152
                    "functionName": "IF SQL Query contains SELECT and WHERE",
1153
                    "ifFunction": "const sqlQuery = $sqlQuery.trim();\n\nif (sqlQuery.includes(\"SELECT\") && sqlQuery.includes(\"WHERE\")) {\n    return sqlQuery;\n}",
1154
                    "elseFunction": "return $sqlQuery;"
1155
                },
1156
                "outputAnchors": [
1157
                    {
1158
                        "name": "output",
1159
                        "label": "Output",
1160
                        "type": "options",
1161
                        "options": [
1162
                            {
1163
                                "id": "ifElseFunction_0-output-returnTrue-string|number|boolean|json|array",
1164
                                "name": "returnTrue",
1165
                                "label": "True",
1166
                                "type": "string | number | boolean | json | array"
1167
                            },
1168
                            {
1169
                                "id": "ifElseFunction_0-output-returnFalse-string|number|boolean|json|array",
1170
                                "name": "returnFalse",
1171
                                "label": "False",
1172
                                "type": "string | number | boolean | json | array"
1173
                            }
1174
                        ],
1175
                        "default": "returnTrue"
1176
                    }
1177
                ],
1178
                "outputs": {
1179
                    "output": "returnTrue"
1180
                },
1181
                "selected": false
1182
            },
1183
            "selected": false,
1184
            "positionAbsolute": {
1185
                "x": 1147.8020838770517,
1186
                "y": -237.39478763322148
1187
            },
1188
            "dragging": false
1189
        },
1190
        {
1191
            "width": 300,
1192
            "height": 511,
1193
            "id": "promptTemplate_2",
1194
            "position": {
1195
                "x": 1530.0647779039386,
1196
                "y": 944.9904482583751
1197
            },
1198
            "type": "customNode",
1199
            "data": {
1200
                "id": "promptTemplate_2",
1201
                "label": "Prompt Template",
1202
                "version": 1,
1203
                "name": "promptTemplate",
1204
                "type": "PromptTemplate",
1205
                "baseClasses": ["PromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate", "Runnable"],
1206
                "category": "Prompts",
1207
                "description": "Schema to represent a basic prompt for an LLM",
1208
                "inputParams": [
1209
                    {
1210
                        "label": "Template",
1211
                        "name": "template",
1212
                        "type": "string",
1213
                        "rows": 4,
1214
                        "placeholder": "What is a good name for a company that makes {product}?",
1215
                        "id": "promptTemplate_2-input-template-string"
1216
                    },
1217
                    {
1218
                        "label": "Format Prompt Values",
1219
                        "name": "promptValues",
1220
                        "type": "json",
1221
                        "optional": true,
1222
                        "acceptVariable": true,
1223
                        "list": true,
1224
                        "id": "promptTemplate_2-input-promptValues-json"
1225
                    }
1226
                ],
1227
                "inputAnchors": [],
1228
                "inputs": {
1229
                    "template": "Politely say \"I'm not able to answer query\"",
1230
                    "promptValues": "{\"schema\":\"{{setVariable_0.data.instance}}\",\"question\":\"{{question}}\"}"
1231
                },
1232
                "outputAnchors": [
1233
                    {
1234
                        "id": "promptTemplate_2-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable",
1235
                        "name": "promptTemplate",
1236
                        "label": "PromptTemplate",
1237
                        "type": "PromptTemplate | BaseStringPromptTemplate | BasePromptTemplate | Runnable"
1238
                    }
1239
                ],
1240
                "outputs": {},
1241
                "selected": false
1242
            },
1243
            "selected": false,
1244
            "positionAbsolute": {
1245
                "x": 1530.0647779039386,
1246
                "y": 944.9904482583751
1247
            },
1248
            "dragging": false
1249
        },
1250
        {
1251
            "width": 300,
1252
            "height": 574,
1253
            "id": "chatOpenAI_2",
1254
            "position": {
1255
                "x": 1537.0307928738125,
1256
                "y": 330.7727229610632
1257
            },
1258
            "type": "customNode",
1259
            "data": {
1260
                "id": "chatOpenAI_2",
1261
                "label": "ChatOpenAI",
1262
                "version": 6.0,
1263
                "name": "chatOpenAI",
1264
                "type": "ChatOpenAI",
1265
                "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "Runnable"],
1266
                "category": "Chat Models",
1267
                "description": "Wrapper around OpenAI large language models that use the Chat endpoint",
1268
                "inputParams": [
1269
                    {
1270
                        "label": "Connect Credential",
1271
                        "name": "credential",
1272
                        "type": "credential",
1273
                        "credentialNames": ["openAIApi"],
1274
                        "id": "chatOpenAI_2-input-credential-credential"
1275
                    },
1276
                    {
1277
                        "label": "Model Name",
1278
                        "name": "modelName",
1279
                        "type": "asyncOptions",
1280
                        "loadMethod": "listModels",
1281
                        "default": "gpt-3.5-turbo",
1282
                        "id": "chatOpenAI_2-input-modelName-options"
1283
                    },
1284
                    {
1285
                        "label": "Temperature",
1286
                        "name": "temperature",
1287
                        "type": "number",
1288
                        "step": 0.1,
1289
                        "default": 0.9,
1290
                        "optional": true,
1291
                        "id": "chatOpenAI_2-input-temperature-number"
1292
                    },
1293
                    {
1294
                        "label": "Max Tokens",
1295
                        "name": "maxTokens",
1296
                        "type": "number",
1297
                        "step": 1,
1298
                        "optional": true,
1299
                        "additionalParams": true,
1300
                        "id": "chatOpenAI_2-input-maxTokens-number"
1301
                    },
1302
                    {
1303
                        "label": "Top Probability",
1304
                        "name": "topP",
1305
                        "type": "number",
1306
                        "step": 0.1,
1307
                        "optional": true,
1308
                        "additionalParams": true,
1309
                        "id": "chatOpenAI_2-input-topP-number"
1310
                    },
1311
                    {
1312
                        "label": "Frequency Penalty",
1313
                        "name": "frequencyPenalty",
1314
                        "type": "number",
1315
                        "step": 0.1,
1316
                        "optional": true,
1317
                        "additionalParams": true,
1318
                        "id": "chatOpenAI_2-input-frequencyPenalty-number"
1319
                    },
1320
                    {
1321
                        "label": "Presence Penalty",
1322
                        "name": "presencePenalty",
1323
                        "type": "number",
1324
                        "step": 0.1,
1325
                        "optional": true,
1326
                        "additionalParams": true,
1327
                        "id": "chatOpenAI_2-input-presencePenalty-number"
1328
                    },
1329
                    {
1330
                        "label": "Timeout",
1331
                        "name": "timeout",
1332
                        "type": "number",
1333
                        "step": 1,
1334
                        "optional": true,
1335
                        "additionalParams": true,
1336
                        "id": "chatOpenAI_2-input-timeout-number"
1337
                    },
1338
                    {
1339
                        "label": "BasePath",
1340
                        "name": "basepath",
1341
                        "type": "string",
1342
                        "optional": true,
1343
                        "additionalParams": true,
1344
                        "id": "chatOpenAI_2-input-basepath-string"
1345
                    },
1346
                    {
1347
                        "label": "BaseOptions",
1348
                        "name": "baseOptions",
1349
                        "type": "json",
1350
                        "optional": true,
1351
                        "additionalParams": true,
1352
                        "id": "chatOpenAI_2-input-baseOptions-json"
1353
                    },
1354
                    {
1355
                        "label": "Allow Image Uploads",
1356
                        "name": "allowImageUploads",
1357
                        "type": "boolean",
1358
                        "description": "Automatically uses gpt-4-vision-preview when image is being uploaded from chat. Only works with LLMChain, Conversation Chain, ReAct Agent, and Conversational Agent",
1359
                        "default": false,
1360
                        "optional": true,
1361
                        "id": "chatOpenAI_2-input-allowImageUploads-boolean"
1362
                    },
1363
                    {
1364
                        "label": "Image Resolution",
1365
                        "description": "This parameter controls the resolution in which the model views the image.",
1366
                        "name": "imageResolution",
1367
                        "type": "options",
1368
                        "options": [
1369
                            {
1370
                                "label": "Low",
1371
                                "name": "low"
1372
                            },
1373
                            {
1374
                                "label": "High",
1375
                                "name": "high"
1376
                            },
1377
                            {
1378
                                "label": "Auto",
1379
                                "name": "auto"
1380
                            }
1381
                        ],
1382
                        "default": "low",
1383
                        "optional": false,
1384
                        "additionalParams": true,
1385
                        "id": "chatOpenAI_2-input-imageResolution-options"
1386
                    }
1387
                ],
1388
                "inputAnchors": [
1389
                    {
1390
                        "label": "Cache",
1391
                        "name": "cache",
1392
                        "type": "BaseCache",
1393
                        "optional": true,
1394
                        "id": "chatOpenAI_2-input-cache-BaseCache"
1395
                    }
1396
                ],
1397
                "inputs": {
1398
                    "cache": "",
1399
                    "modelName": "gpt-3.5-turbo-16k",
1400
                    "temperature": "0.7",
1401
                    "maxTokens": "",
1402
                    "topP": "",
1403
                    "frequencyPenalty": "",
1404
                    "presencePenalty": "",
1405
                    "timeout": "",
1406
                    "basepath": "",
1407
                    "baseOptions": "",
1408
                    "allowImageUploads": true,
1409
                    "imageResolution": "low"
1410
                },
1411
                "outputAnchors": [
1412
                    {
1413
                        "id": "chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
1414
                        "name": "chatOpenAI",
1415
                        "label": "ChatOpenAI",
1416
                        "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | Runnable"
1417
                    }
1418
                ],
1419
                "outputs": {},
1420
                "selected": false
1421
            },
1422
            "selected": false,
1423
            "positionAbsolute": {
1424
                "x": 1537.0307928738125,
1425
                "y": 330.7727229610632
1426
            },
1427
            "dragging": false
1428
        },
1429
        {
1430
            "width": 300,
1431
            "height": 507,
1432
            "id": "llmChain_2",
1433
            "position": {
1434
                "x": 2077.2866807477812,
1435
                "y": 958.6594167386253
1436
            },
1437
            "type": "customNode",
1438
            "data": {
1439
                "id": "llmChain_2",
1440
                "label": "LLM Chain",
1441
                "version": 3,
1442
                "name": "llmChain",
1443
                "type": "LLMChain",
1444
                "baseClasses": ["LLMChain", "BaseChain", "Runnable"],
1445
                "category": "Chains",
1446
                "description": "Chain to run queries against LLMs",
1447
                "inputParams": [
1448
                    {
1449
                        "label": "Chain Name",
1450
                        "name": "chainName",
1451
                        "type": "string",
1452
                        "placeholder": "Name Your Chain",
1453
                        "optional": true,
1454
                        "id": "llmChain_2-input-chainName-string"
1455
                    }
1456
                ],
1457
                "inputAnchors": [
1458
                    {
1459
                        "label": "Language Model",
1460
                        "name": "model",
1461
                        "type": "BaseLanguageModel",
1462
                        "id": "llmChain_2-input-model-BaseLanguageModel"
1463
                    },
1464
                    {
1465
                        "label": "Prompt",
1466
                        "name": "prompt",
1467
                        "type": "BasePromptTemplate",
1468
                        "id": "llmChain_2-input-prompt-BasePromptTemplate"
1469
                    },
1470
                    {
1471
                        "label": "Output Parser",
1472
                        "name": "outputParser",
1473
                        "type": "BaseLLMOutputParser",
1474
                        "optional": true,
1475
                        "id": "llmChain_2-input-outputParser-BaseLLMOutputParser"
1476
                    },
1477
                    {
1478
                        "label": "Input Moderation",
1479
                        "description": "Detect text that could generate harmful output and prevent it from being sent to the language model",
1480
                        "name": "inputModeration",
1481
                        "type": "Moderation",
1482
                        "optional": true,
1483
                        "list": true,
1484
                        "id": "llmChain_2-input-inputModeration-Moderation"
1485
                    }
1486
                ],
1487
                "inputs": {
1488
                    "model": "{{chatOpenAI_2.data.instance}}",
1489
                    "prompt": "{{promptTemplate_2.data.instance}}",
1490
                    "outputParser": "",
1491
                    "inputModeration": "",
1492
                    "chainName": "Fallback Chain"
1493
                },
1494
                "outputAnchors": [
1495
                    {
1496
                        "name": "output",
1497
                        "label": "Output",
1498
                        "type": "options",
1499
                        "options": [
1500
                            {
1501
                                "id": "llmChain_2-output-llmChain-LLMChain|BaseChain|Runnable",
1502
                                "name": "llmChain",
1503
                                "label": "LLM Chain",
1504
                                "type": "LLMChain | BaseChain | Runnable"
1505
                            },
1506
                            {
1507
                                "id": "llmChain_2-output-outputPrediction-string|json",
1508
                                "name": "outputPrediction",
1509
                                "label": "Output Prediction",
1510
                                "type": "string | json"
1511
                            }
1512
                        ],
1513
                        "default": "llmChain"
1514
                    }
1515
                ],
1516
                "outputs": {
1517
                    "output": "llmChain"
1518
                },
1519
                "selected": false
1520
            },
1521
            "selected": false,
1522
            "positionAbsolute": {
1523
                "x": 2077.2866807477812,
1524
                "y": 958.6594167386253
1525
            },
1526
            "dragging": false
1527
        }
1528
    ],
1529
    "edges": [
1530
        {
1531
            "source": "promptTemplate_0",
1532
            "sourceHandle": "promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable",
1533
            "target": "llmChain_0",
1534
            "targetHandle": "llmChain_0-input-prompt-BasePromptTemplate",
1535
            "type": "buttonedge",
1536
            "id": "promptTemplate_0-promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable-llmChain_0-llmChain_0-input-prompt-BasePromptTemplate",
1537
            "data": {
1538
                "label": ""
1539
            }
1540
        },
1541
        {
1542
            "source": "chatOpenAI_0",
1543
            "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
1544
            "target": "llmChain_0",
1545
            "targetHandle": "llmChain_0-input-model-BaseLanguageModel",
1546
            "type": "buttonedge",
1547
            "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable-llmChain_0-llmChain_0-input-model-BaseLanguageModel",
1548
            "data": {
1549
                "label": ""
1550
            }
1551
        },
1552
        {
1553
            "source": "chatOpenAI_1",
1554
            "sourceHandle": "chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
1555
            "target": "llmChain_1",
1556
            "targetHandle": "llmChain_1-input-model-BaseLanguageModel",
1557
            "type": "buttonedge",
1558
            "id": "chatOpenAI_1-chatOpenAI_1-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable-llmChain_1-llmChain_1-input-model-BaseLanguageModel",
1559
            "data": {
1560
                "label": ""
1561
            }
1562
        },
1563
        {
1564
            "source": "customFunction_1",
1565
            "sourceHandle": "customFunction_1-output-output-string|number|boolean|json|array",
1566
            "target": "promptTemplate_1",
1567
            "targetHandle": "promptTemplate_1-input-promptValues-json",
1568
            "type": "buttonedge",
1569
            "id": "customFunction_1-customFunction_1-output-output-string|number|boolean|json|array-promptTemplate_1-promptTemplate_1-input-promptValues-json",
1570
            "data": {
1571
                "label": ""
1572
            }
1573
        },
1574
        {
1575
            "source": "promptTemplate_1",
1576
            "sourceHandle": "promptTemplate_1-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable",
1577
            "target": "llmChain_1",
1578
            "targetHandle": "llmChain_1-input-prompt-BasePromptTemplate",
1579
            "type": "buttonedge",
1580
            "id": "promptTemplate_1-promptTemplate_1-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable-llmChain_1-llmChain_1-input-prompt-BasePromptTemplate",
1581
            "data": {
1582
                "label": ""
1583
            }
1584
        },
1585
        {
1586
            "source": "customFunction_2",
1587
            "sourceHandle": "customFunction_2-output-output-string|number|boolean|json|array",
1588
            "target": "setVariable_0",
1589
            "targetHandle": "setVariable_0-input-input-string | number | boolean | json | array",
1590
            "type": "buttonedge",
1591
            "id": "customFunction_2-customFunction_2-output-output-string|number|boolean|json|array-setVariable_0-setVariable_0-input-input-string | number | boolean | json | array",
1592
            "data": {
1593
                "label": ""
1594
            }
1595
        },
1596
        {
1597
            "source": "setVariable_0",
1598
            "sourceHandle": "setVariable_0-output-output-string|number|boolean|json|array",
1599
            "target": "promptTemplate_0",
1600
            "targetHandle": "promptTemplate_0-input-promptValues-json",
1601
            "type": "buttonedge",
1602
            "id": "setVariable_0-setVariable_0-output-output-string|number|boolean|json|array-promptTemplate_0-promptTemplate_0-input-promptValues-json",
1603
            "data": {
1604
                "label": ""
1605
            }
1606
        },
1607
        {
1608
            "source": "getVariable_0",
1609
            "sourceHandle": "getVariable_0-output-output-string|number|boolean|json|array",
1610
            "target": "promptTemplate_1",
1611
            "targetHandle": "promptTemplate_1-input-promptValues-json",
1612
            "type": "buttonedge",
1613
            "id": "getVariable_0-getVariable_0-output-output-string|number|boolean|json|array-promptTemplate_1-promptTemplate_1-input-promptValues-json",
1614
            "data": {
1615
                "label": ""
1616
            }
1617
        },
1618
        {
1619
            "source": "getVariable_1",
1620
            "sourceHandle": "getVariable_1-output-output-string|number|boolean|json|array",
1621
            "target": "promptTemplate_1",
1622
            "targetHandle": "promptTemplate_1-input-promptValues-json",
1623
            "type": "buttonedge",
1624
            "id": "getVariable_1-getVariable_1-output-output-string|number|boolean|json|array-promptTemplate_1-promptTemplate_1-input-promptValues-json",
1625
            "data": {
1626
                "label": ""
1627
            }
1628
        },
1629
        {
1630
            "source": "setVariable_1",
1631
            "sourceHandle": "setVariable_1-output-output-string|number|boolean|json|array",
1632
            "target": "customFunction_1",
1633
            "targetHandle": "customFunction_1-input-functionInputVariables-json",
1634
            "type": "buttonedge",
1635
            "id": "setVariable_1-setVariable_1-output-output-string|number|boolean|json|array-customFunction_1-customFunction_1-input-functionInputVariables-json",
1636
            "data": {
1637
                "label": ""
1638
            }
1639
        },
1640
        {
1641
            "source": "llmChain_0",
1642
            "sourceHandle": "llmChain_0-output-outputPrediction-string|json",
1643
            "target": "ifElseFunction_0",
1644
            "targetHandle": "ifElseFunction_0-input-functionInputVariables-json",
1645
            "type": "buttonedge",
1646
            "id": "llmChain_0-llmChain_0-output-outputPrediction-string|json-ifElseFunction_0-ifElseFunction_0-input-functionInputVariables-json"
1647
        },
1648
        {
1649
            "source": "ifElseFunction_0",
1650
            "sourceHandle": "ifElseFunction_0-output-returnTrue-string|number|boolean|json|array",
1651
            "target": "setVariable_1",
1652
            "targetHandle": "setVariable_1-input-input-string | number | boolean | json | array",
1653
            "type": "buttonedge",
1654
            "id": "ifElseFunction_0-ifElseFunction_0-output-returnTrue-string|number|boolean|json|array-setVariable_1-setVariable_1-input-input-string | number | boolean | json | array"
1655
        },
1656
        {
1657
            "source": "ifElseFunction_0",
1658
            "sourceHandle": "ifElseFunction_0-output-returnFalse-string|number|boolean|json|array",
1659
            "target": "promptTemplate_2",
1660
            "targetHandle": "promptTemplate_2-input-promptValues-json",
1661
            "type": "buttonedge",
1662
            "id": "ifElseFunction_0-ifElseFunction_0-output-returnFalse-string|number|boolean|json|array-promptTemplate_2-promptTemplate_2-input-promptValues-json"
1663
        },
1664
        {
1665
            "source": "chatOpenAI_2",
1666
            "sourceHandle": "chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
1667
            "target": "llmChain_2",
1668
            "targetHandle": "llmChain_2-input-model-BaseLanguageModel",
1669
            "type": "buttonedge",
1670
            "id": "chatOpenAI_2-chatOpenAI_2-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable-llmChain_2-llmChain_2-input-model-BaseLanguageModel"
1671
        },
1672
        {
1673
            "source": "promptTemplate_2",
1674
            "sourceHandle": "promptTemplate_2-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable",
1675
            "target": "llmChain_2",
1676
            "targetHandle": "llmChain_2-input-prompt-BasePromptTemplate",
1677
            "type": "buttonedge",
1678
            "id": "promptTemplate_2-promptTemplate_2-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable-llmChain_2-llmChain_2-input-prompt-BasePromptTemplate"
1679
        }
1680
    ]
1681
}
1682

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

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

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

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