Flowise

Форк
0
/
Advanced Structured Output Parser.json 
441 строка · 19.9 Кб
1
{
2
    "description": "Return response as a JSON structure as specified by a Zod schema",
3
    "badge": "NEW",
4
    "nodes": [
5
        {
6
            "width": 300,
7
            "height": 508,
8
            "id": "llmChain_0",
9
            "position": {
10
                "x": 1229.1699649849293,
11
                "y": 245.55173505632646
12
            },
13
            "type": "customNode",
14
            "data": {
15
                "id": "llmChain_0",
16
                "label": "LLM Chain",
17
                "version": 3,
18
                "name": "llmChain",
19
                "type": "LLMChain",
20
                "baseClasses": ["LLMChain", "BaseChain", "Runnable"],
21
                "category": "Chains",
22
                "description": "Chain to run queries against LLMs",
23
                "inputParams": [
24
                    {
25
                        "label": "Chain Name",
26
                        "name": "chainName",
27
                        "type": "string",
28
                        "placeholder": "Name Your Chain",
29
                        "optional": true,
30
                        "id": "llmChain_0-input-chainName-string"
31
                    }
32
                ],
33
                "inputAnchors": [
34
                    {
35
                        "label": "Language Model",
36
                        "name": "model",
37
                        "type": "BaseLanguageModel",
38
                        "id": "llmChain_0-input-model-BaseLanguageModel"
39
                    },
40
                    {
41
                        "label": "Prompt",
42
                        "name": "prompt",
43
                        "type": "BasePromptTemplate",
44
                        "id": "llmChain_0-input-prompt-BasePromptTemplate"
45
                    },
46
                    {
47
                        "label": "Output Parser",
48
                        "name": "outputParser",
49
                        "type": "BaseLLMOutputParser",
50
                        "optional": true,
51
                        "id": "llmChain_0-input-outputParser-BaseLLMOutputParser"
52
                    },
53
                    {
54
                        "label": "Input Moderation",
55
                        "description": "Detect text that could generate harmful output and prevent it from being sent to the language model",
56
                        "name": "inputModeration",
57
                        "type": "Moderation",
58
                        "optional": true,
59
                        "list": true,
60
                        "id": "llmChain_0-input-inputModeration-Moderation"
61
                    }
62
                ],
63
                "inputs": {
64
                    "model": "{{chatOpenAI_0.data.instance}}",
65
                    "prompt": "{{chatPromptTemplate_0.data.instance}}",
66
                    "outputParser": "{{advancedStructuredOutputParser_0.data.instance}}",
67
                    "chainName": "",
68
                    "inputModeration": ""
69
                },
70
                "outputAnchors": [
71
                    {
72
                        "name": "output",
73
                        "label": "Output",
74
                        "type": "options",
75
                        "options": [
76
                            {
77
                                "id": "llmChain_0-output-llmChain-LLMChain|BaseChain|Runnable",
78
                                "name": "llmChain",
79
                                "label": "LLM Chain",
80
                                "type": "LLMChain | BaseChain | Runnable"
81
                            },
82
                            {
83
                                "id": "llmChain_0-output-outputPrediction-string|json",
84
                                "name": "outputPrediction",
85
                                "label": "Output Prediction",
86
                                "type": "string | json"
87
                            }
88
                        ],
89
                        "default": "llmChain"
90
                    }
91
                ],
92
                "outputs": {
93
                    "output": "llmChain"
94
                },
95
                "selected": false
96
            },
97
            "positionAbsolute": {
98
                "x": 1229.1699649849293,
99
                "y": 245.55173505632646
100
            },
101
            "selected": false
102
        },
103
        {
104
            "width": 300,
105
            "height": 690,
106
            "id": "chatPromptTemplate_0",
107
            "position": {
108
                "x": 493.26582927222483,
109
                "y": -156.20470841335592
110
            },
111
            "type": "customNode",
112
            "data": {
113
                "id": "chatPromptTemplate_0",
114
                "label": "Chat Prompt Template",
115
                "version": 1,
116
                "name": "chatPromptTemplate",
117
                "type": "ChatPromptTemplate",
118
                "baseClasses": ["ChatPromptTemplate", "BaseChatPromptTemplate", "BasePromptTemplate", "Runnable"],
119
                "category": "Prompts",
120
                "description": "Schema to represent a chat prompt",
121
                "inputParams": [
122
                    {
123
                        "label": "System Message",
124
                        "name": "systemMessagePrompt",
125
                        "type": "string",
126
                        "rows": 4,
127
                        "placeholder": "You are a helpful assistant that translates {input_language} to {output_language}.",
128
                        "id": "chatPromptTemplate_0-input-systemMessagePrompt-string"
129
                    },
130
                    {
131
                        "label": "Human Message",
132
                        "name": "humanMessagePrompt",
133
                        "type": "string",
134
                        "rows": 4,
135
                        "placeholder": "{text}",
136
                        "id": "chatPromptTemplate_0-input-humanMessagePrompt-string"
137
                    },
138
                    {
139
                        "label": "Format Prompt Values",
140
                        "name": "promptValues",
141
                        "type": "json",
142
                        "optional": true,
143
                        "acceptVariable": true,
144
                        "list": true,
145
                        "id": "chatPromptTemplate_0-input-promptValues-json"
146
                    }
147
                ],
148
                "inputAnchors": [],
149
                "inputs": {
150
                    "systemMessagePrompt": "This AI is designed to only output information in JSON format without exception. This AI can only output JSON and will never output any other text.\n\nWhen asked to correct itself, this AI will only output the corrected JSON and never any other text.",
151
                    "humanMessagePrompt": "{text}",
152
                    "promptValues": ""
153
                },
154
                "outputAnchors": [
155
                    {
156
                        "id": "chatPromptTemplate_0-output-chatPromptTemplate-ChatPromptTemplate|BaseChatPromptTemplate|BasePromptTemplate|Runnable",
157
                        "name": "chatPromptTemplate",
158
                        "label": "ChatPromptTemplate",
159
                        "type": "ChatPromptTemplate | BaseChatPromptTemplate | BasePromptTemplate | Runnable"
160
                    }
161
                ],
162
                "outputs": {},
163
                "selected": false
164
            },
165
            "selected": false,
166
            "positionAbsolute": {
167
                "x": 493.26582927222483,
168
                "y": -156.20470841335592
169
            },
170
            "dragging": false
171
        },
172
        {
173
            "width": 300,
174
            "height": 576,
175
            "id": "chatOpenAI_0",
176
            "position": {
177
                "x": 860.555928011636,
178
                "y": -355.71028569475095
179
            },
180
            "type": "customNode",
181
            "data": {
182
                "id": "chatOpenAI_0",
183
                "label": "ChatOpenAI",
184
                "version": 6.0,
185
                "name": "chatOpenAI",
186
                "type": "ChatOpenAI",
187
                "baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "Runnable"],
188
                "category": "Chat Models",
189
                "description": "Wrapper around OpenAI large language models that use the Chat endpoint",
190
                "inputParams": [
191
                    {
192
                        "label": "Connect Credential",
193
                        "name": "credential",
194
                        "type": "credential",
195
                        "credentialNames": ["openAIApi"],
196
                        "id": "chatOpenAI_0-input-credential-credential"
197
                    },
198
                    {
199
                        "label": "Model Name",
200
                        "name": "modelName",
201
                        "type": "asyncOptions",
202
                        "loadMethod": "listModels",
203
                        "default": "gpt-3.5-turbo",
204
                        "id": "chatOpenAI_0-input-modelName-options"
205
                    },
206
                    {
207
                        "label": "Temperature",
208
                        "name": "temperature",
209
                        "type": "number",
210
                        "step": 0.1,
211
                        "default": 0.9,
212
                        "optional": true,
213
                        "id": "chatOpenAI_0-input-temperature-number"
214
                    },
215
                    {
216
                        "label": "Max Tokens",
217
                        "name": "maxTokens",
218
                        "type": "number",
219
                        "step": 1,
220
                        "optional": true,
221
                        "additionalParams": true,
222
                        "id": "chatOpenAI_0-input-maxTokens-number"
223
                    },
224
                    {
225
                        "label": "Top Probability",
226
                        "name": "topP",
227
                        "type": "number",
228
                        "step": 0.1,
229
                        "optional": true,
230
                        "additionalParams": true,
231
                        "id": "chatOpenAI_0-input-topP-number"
232
                    },
233
                    {
234
                        "label": "Frequency Penalty",
235
                        "name": "frequencyPenalty",
236
                        "type": "number",
237
                        "step": 0.1,
238
                        "optional": true,
239
                        "additionalParams": true,
240
                        "id": "chatOpenAI_0-input-frequencyPenalty-number"
241
                    },
242
                    {
243
                        "label": "Presence Penalty",
244
                        "name": "presencePenalty",
245
                        "type": "number",
246
                        "step": 0.1,
247
                        "optional": true,
248
                        "additionalParams": true,
249
                        "id": "chatOpenAI_0-input-presencePenalty-number"
250
                    },
251
                    {
252
                        "label": "Timeout",
253
                        "name": "timeout",
254
                        "type": "number",
255
                        "step": 1,
256
                        "optional": true,
257
                        "additionalParams": true,
258
                        "id": "chatOpenAI_0-input-timeout-number"
259
                    },
260
                    {
261
                        "label": "BasePath",
262
                        "name": "basepath",
263
                        "type": "string",
264
                        "optional": true,
265
                        "additionalParams": true,
266
                        "id": "chatOpenAI_0-input-basepath-string"
267
                    },
268
                    {
269
                        "label": "BaseOptions",
270
                        "name": "baseOptions",
271
                        "type": "json",
272
                        "optional": true,
273
                        "additionalParams": true,
274
                        "id": "chatOpenAI_0-input-baseOptions-json"
275
                    },
276
                    {
277
                        "label": "Allow Image Uploads",
278
                        "name": "allowImageUploads",
279
                        "type": "boolean",
280
                        "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",
281
                        "default": false,
282
                        "optional": true,
283
                        "id": "chatOpenAI_0-input-allowImageUploads-boolean"
284
                    },
285
                    {
286
                        "label": "Image Resolution",
287
                        "description": "This parameter controls the resolution in which the model views the image.",
288
                        "name": "imageResolution",
289
                        "type": "options",
290
                        "options": [
291
                            {
292
                                "label": "Low",
293
                                "name": "low"
294
                            },
295
                            {
296
                                "label": "High",
297
                                "name": "high"
298
                            },
299
                            {
300
                                "label": "Auto",
301
                                "name": "auto"
302
                            }
303
                        ],
304
                        "default": "low",
305
                        "optional": false,
306
                        "additionalParams": true,
307
                        "id": "chatOpenAI_0-input-imageResolution-options"
308
                    }
309
                ],
310
                "inputAnchors": [
311
                    {
312
                        "label": "Cache",
313
                        "name": "cache",
314
                        "type": "BaseCache",
315
                        "optional": true,
316
                        "id": "chatOpenAI_0-input-cache-BaseCache"
317
                    }
318
                ],
319
                "inputs": {
320
                    "cache": "",
321
                    "modelName": "",
322
                    "temperature": "0",
323
                    "maxTokens": "",
324
                    "topP": "",
325
                    "frequencyPenalty": "",
326
                    "presencePenalty": "",
327
                    "timeout": "",
328
                    "basepath": "",
329
                    "baseOptions": "",
330
                    "allowImageUploads": true,
331
                    "imageResolution": "low"
332
                },
333
                "outputAnchors": [
334
                    {
335
                        "id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
336
                        "name": "chatOpenAI",
337
                        "label": "ChatOpenAI",
338
                        "type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | Runnable"
339
                    }
340
                ],
341
                "outputs": {},
342
                "selected": false
343
            },
344
            "selected": false,
345
            "positionAbsolute": {
346
                "x": 860.555928011636,
347
                "y": -355.71028569475095
348
            },
349
            "dragging": false
350
        },
351
        {
352
            "width": 300,
353
            "height": 454,
354
            "id": "advancedStructuredOutputParser_0",
355
            "position": {
356
                "x": 489.3637511211284,
357
                "y": 580.0628053662244
358
            },
359
            "type": "customNode",
360
            "data": {
361
                "id": "advancedStructuredOutputParser_0",
362
                "label": "Advanced Structured Output Parser",
363
                "version": 1,
364
                "name": "advancedStructuredOutputParser",
365
                "type": "AdvancedStructuredOutputParser",
366
                "baseClasses": ["AdvancedStructuredOutputParser", "BaseLLMOutputParser", "Runnable"],
367
                "category": "Output Parsers",
368
                "description": "Parse the output of an LLM call into a given structure by providing a Zod schema.",
369
                "inputParams": [
370
                    {
371
                        "label": "Autofix",
372
                        "name": "autofixParser",
373
                        "type": "boolean",
374
                        "optional": true,
375
                        "description": "In the event that the first call fails, will make another call to the model to fix any errors.",
376
                        "id": "advancedStructuredOutputParser_0-input-autofixParser-boolean"
377
                    },
378
                    {
379
                        "label": "Example JSON",
380
                        "name": "exampleJson",
381
                        "type": "string",
382
                        "description": "Zod schema for the output of the model",
383
                        "rows": 10,
384
                        "default": "z.object({\n    title: z.string(), // Title of the movie as a string\n    yearOfRelease: z.number().int(), // Release year as an integer number,\n    genres: z.enum([\n        \"Action\", \"Comedy\", \"Drama\", \"Fantasy\", \"Horror\",\n        \"Mystery\", \"Romance\", \"Science Fiction\", \"Thriller\", \"Documentary\"\n    ]).array().max(2), // Array of genres, max of 2 from the defined enum\n    shortDescription: z.string().max(500) // Short description, max 500 characters\n})",
385
                        "id": "advancedStructuredOutputParser_0-input-exampleJson-string"
386
                    }
387
                ],
388
                "inputAnchors": [],
389
                "inputs": {
390
                    "autofixParser": "",
391
                    "exampleJson": "z.object({\n    title: z.string(), // Title of the movie as a string\n    yearOfRelease: z.number().int(), // Release year as an integer number,\n    genres: z.enum([\n        \"Action\", \"Comedy\", \"Drama\", \"Fantasy\", \"Horror\",\n        \"Mystery\", \"Romance\", \"Science Fiction\", \"Thriller\", \"Documentary\"\n    ]).array().max(2), // Array of genres, max of 2 from the defined enum\n    shortDescription: z.string().max(500) // Short description, max 500 characters\n})"
392
                },
393
                "outputAnchors": [
394
                    {
395
                        "id": "advancedStructuredOutputParser_0-output-advancedStructuredOutputParser-AdvancedStructuredOutputParser|BaseLLMOutputParser|Runnable",
396
                        "name": "advancedStructuredOutputParser",
397
                        "label": "AdvancedStructuredOutputParser",
398
                        "type": "AdvancedStructuredOutputParser | BaseLLMOutputParser | Runnable"
399
                    }
400
                ],
401
                "outputs": {},
402
                "selected": false
403
            },
404
            "selected": false,
405
            "dragging": false,
406
            "positionAbsolute": {
407
                "x": 489.3637511211284,
408
                "y": 580.0628053662244
409
            }
410
        }
411
    ],
412
    "edges": [
413
        {
414
            "source": "chatPromptTemplate_0",
415
            "sourceHandle": "chatPromptTemplate_0-output-chatPromptTemplate-ChatPromptTemplate|BaseChatPromptTemplate|BasePromptTemplate|Runnable",
416
            "target": "llmChain_0",
417
            "targetHandle": "llmChain_0-input-prompt-BasePromptTemplate",
418
            "type": "buttonedge",
419
            "id": "chatPromptTemplate_0-chatPromptTemplate_0-output-chatPromptTemplate-ChatPromptTemplate|BaseChatPromptTemplate|BasePromptTemplate|Runnable-llmChain_0-llmChain_0-input-prompt-BasePromptTemplate",
420
            "data": {
421
                "label": ""
422
            }
423
        },
424
        {
425
            "source": "chatOpenAI_0",
426
            "sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
427
            "target": "llmChain_0",
428
            "targetHandle": "llmChain_0-input-model-BaseLanguageModel",
429
            "type": "buttonedge",
430
            "id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable-llmChain_0-llmChain_0-input-model-BaseLanguageModel"
431
        },
432
        {
433
            "source": "advancedStructuredOutputParser_0",
434
            "sourceHandle": "advancedStructuredOutputParser_0-output-advancedStructuredOutputParser-AdvancedStructuredOutputParser|BaseLLMOutputParser|Runnable",
435
            "target": "llmChain_0",
436
            "targetHandle": "llmChain_0-input-outputParser-BaseLLMOutputParser",
437
            "type": "buttonedge",
438
            "id": "advancedStructuredOutputParser_0-advancedStructuredOutputParser_0-output-advancedStructuredOutputParser-AdvancedStructuredOutputParser|BaseLLMOutputParser|Runnable-llmChain_0-llmChain_0-input-outputParser-BaseLLMOutputParser"
439
        }
440
    ]
441
}
442

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

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

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

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