Flowise
432 строки · 17.7 Кб
1{
2"description": "Detect text that could generate harmful output and prevent it from being sent to the language model",
3"badge": "NEW",
4"categories": "Moderation,ChatOpenAI,LLM Chain,Langchain",
5"framework": "Langchain",
6"nodes": [
7{
8"width": 300,
9"height": 356,
10"id": "inputModerationOpenAI_0",
11"position": {
12"x": 334.36040624369247,
13"y": 467.88081727992824
14},
15"type": "customNode",
16"data": {
17"id": "inputModerationOpenAI_0",
18"label": "OpenAI Moderation",
19"version": 1,
20"name": "inputModerationOpenAI",
21"type": "Moderation",
22"baseClasses": ["Moderation"],
23"category": "Moderation",
24"description": "Check whether content complies with OpenAI usage policies.",
25"inputParams": [
26{
27"label": "Error Message",
28"name": "moderationErrorMessage",
29"type": "string",
30"rows": 2,
31"default": "Cannot Process! Input violates OpenAI's content moderation policies.",
32"optional": true,
33"id": "inputModerationOpenAI_0-input-moderationErrorMessage-string"
34}
35],
36"inputAnchors": [],
37"inputs": {
38"moderationErrorMessage": "Cannot Process! Input violates OpenAI's content moderation policies."
39},
40"outputAnchors": [
41{
42"id": "inputModerationOpenAI_0-output-inputModerationOpenAI-Moderation|Moderation",
43"name": "inputModerationOpenAI",
44"label": "Moderation",
45"type": "Moderation"
46}
47],
48"outputs": {},
49"selected": false
50},
51"selected": false,
52"positionAbsolute": {
53"x": 334.36040624369247,
54"y": 467.88081727992824
55},
56"dragging": false
57},
58{
59"width": 300,
60"height": 507,
61"id": "llmChain_0",
62"position": {
63"x": 859.216454729136,
64"y": 154.86846618352752
65},
66"type": "customNode",
67"data": {
68"id": "llmChain_0",
69"label": "LLM Chain",
70"version": 3,
71"name": "llmChain",
72"type": "LLMChain",
73"baseClasses": ["LLMChain", "BaseChain", "Runnable"],
74"category": "Chains",
75"description": "Chain to run queries against LLMs",
76"inputParams": [
77{
78"label": "Chain Name",
79"name": "chainName",
80"type": "string",
81"placeholder": "Name Your Chain",
82"optional": true,
83"id": "llmChain_0-input-chainName-string"
84}
85],
86"inputAnchors": [
87{
88"label": "Language Model",
89"name": "model",
90"type": "BaseLanguageModel",
91"id": "llmChain_0-input-model-BaseLanguageModel"
92},
93{
94"label": "Prompt",
95"name": "prompt",
96"type": "BasePromptTemplate",
97"id": "llmChain_0-input-prompt-BasePromptTemplate"
98},
99{
100"label": "Output Parser",
101"name": "outputParser",
102"type": "BaseLLMOutputParser",
103"optional": true,
104"id": "llmChain_0-input-outputParser-BaseLLMOutputParser"
105},
106{
107"label": "Input Moderation",
108"description": "Detect text that could generate harmful output and prevent it from being sent to the language model",
109"name": "inputModeration",
110"type": "Moderation",
111"optional": true,
112"list": true,
113"id": "llmChain_0-input-inputModeration-Moderation"
114}
115],
116"inputs": {
117"model": "{{chatOpenAI_0.data.instance}}",
118"prompt": "{{promptTemplate_0.data.instance}}",
119"outputParser": "",
120"inputModeration": ["{{inputModerationOpenAI_0.data.instance}}"],
121"chainName": ""
122},
123"outputAnchors": [
124{
125"name": "output",
126"label": "Output",
127"type": "options",
128"options": [
129{
130"id": "llmChain_0-output-llmChain-LLMChain|BaseChain|Runnable",
131"name": "llmChain",
132"label": "LLM Chain",
133"type": "LLMChain | BaseChain | Runnable"
134},
135{
136"id": "llmChain_0-output-outputPrediction-string|json",
137"name": "outputPrediction",
138"label": "Output Prediction",
139"type": "string | json"
140}
141],
142"default": "llmChain"
143}
144],
145"outputs": {
146"output": "llmChain"
147},
148"selected": false
149},
150"selected": false,
151"positionAbsolute": {
152"x": 859.216454729136,
153"y": 154.86846618352752
154},
155"dragging": false
156},
157{
158"width": 300,
159"height": 574,
160"id": "chatOpenAI_0",
161"position": {
162"x": 424.69244822381864,
163"y": -271.138349609141
164},
165"type": "customNode",
166"data": {
167"id": "chatOpenAI_0",
168"label": "ChatOpenAI",
169"version": 6.0,
170"name": "chatOpenAI",
171"type": "ChatOpenAI",
172"baseClasses": ["ChatOpenAI", "BaseChatModel", "BaseLanguageModel", "Runnable"],
173"category": "Chat Models",
174"description": "Wrapper around OpenAI large language models that use the Chat endpoint",
175"inputParams": [
176{
177"label": "Connect Credential",
178"name": "credential",
179"type": "credential",
180"credentialNames": ["openAIApi"],
181"id": "chatOpenAI_0-input-credential-credential"
182},
183{
184"label": "Model Name",
185"name": "modelName",
186"type": "asyncOptions",
187"loadMethod": "listModels",
188"default": "gpt-3.5-turbo",
189"id": "chatOpenAI_0-input-modelName-options"
190},
191{
192"label": "Temperature",
193"name": "temperature",
194"type": "number",
195"step": 0.1,
196"default": 0.9,
197"optional": true,
198"id": "chatOpenAI_0-input-temperature-number"
199},
200{
201"label": "Max Tokens",
202"name": "maxTokens",
203"type": "number",
204"step": 1,
205"optional": true,
206"additionalParams": true,
207"id": "chatOpenAI_0-input-maxTokens-number"
208},
209{
210"label": "Top Probability",
211"name": "topP",
212"type": "number",
213"step": 0.1,
214"optional": true,
215"additionalParams": true,
216"id": "chatOpenAI_0-input-topP-number"
217},
218{
219"label": "Frequency Penalty",
220"name": "frequencyPenalty",
221"type": "number",
222"step": 0.1,
223"optional": true,
224"additionalParams": true,
225"id": "chatOpenAI_0-input-frequencyPenalty-number"
226},
227{
228"label": "Presence Penalty",
229"name": "presencePenalty",
230"type": "number",
231"step": 0.1,
232"optional": true,
233"additionalParams": true,
234"id": "chatOpenAI_0-input-presencePenalty-number"
235},
236{
237"label": "Timeout",
238"name": "timeout",
239"type": "number",
240"step": 1,
241"optional": true,
242"additionalParams": true,
243"id": "chatOpenAI_0-input-timeout-number"
244},
245{
246"label": "BasePath",
247"name": "basepath",
248"type": "string",
249"optional": true,
250"additionalParams": true,
251"id": "chatOpenAI_0-input-basepath-string"
252},
253{
254"label": "BaseOptions",
255"name": "baseOptions",
256"type": "json",
257"optional": true,
258"additionalParams": true,
259"id": "chatOpenAI_0-input-baseOptions-json"
260},
261{
262"label": "Allow Image Uploads",
263"name": "allowImageUploads",
264"type": "boolean",
265"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",
266"default": false,
267"optional": true,
268"id": "chatOpenAI_0-input-allowImageUploads-boolean"
269},
270{
271"label": "Image Resolution",
272"description": "This parameter controls the resolution in which the model views the image.",
273"name": "imageResolution",
274"type": "options",
275"options": [
276{
277"label": "Low",
278"name": "low"
279},
280{
281"label": "High",
282"name": "high"
283},
284{
285"label": "Auto",
286"name": "auto"
287}
288],
289"default": "low",
290"optional": false,
291"additionalParams": true,
292"id": "chatOpenAI_0-input-imageResolution-options"
293}
294],
295"inputAnchors": [
296{
297"label": "Cache",
298"name": "cache",
299"type": "BaseCache",
300"optional": true,
301"id": "chatOpenAI_0-input-cache-BaseCache"
302}
303],
304"inputs": {
305"cache": "",
306"modelName": "gpt-3.5-turbo",
307"temperature": 0.9,
308"maxTokens": "",
309"topP": "",
310"frequencyPenalty": "",
311"presencePenalty": "",
312"timeout": "",
313"basepath": "",
314"baseOptions": "",
315"allowImageUploads": true,
316"imageResolution": "low"
317},
318"outputAnchors": [
319{
320"id": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
321"name": "chatOpenAI",
322"label": "ChatOpenAI",
323"type": "ChatOpenAI | BaseChatModel | BaseLanguageModel | Runnable"
324}
325],
326"outputs": {},
327"selected": false
328},
329"selected": false,
330"positionAbsolute": {
331"x": 424.69244822381864,
332"y": -271.138349609141
333},
334"dragging": false
335},
336{
337"width": 300,
338"height": 475,
339"id": "promptTemplate_0",
340"position": {
341"x": -17.005933033720936,
342"y": -20.829788775850602
343},
344"type": "customNode",
345"data": {
346"id": "promptTemplate_0",
347"label": "Prompt Template",
348"version": 1,
349"name": "promptTemplate",
350"type": "PromptTemplate",
351"baseClasses": ["PromptTemplate", "BaseStringPromptTemplate", "BasePromptTemplate", "Runnable"],
352"category": "Prompts",
353"description": "Schema to represent a basic prompt for an LLM",
354"inputParams": [
355{
356"label": "Template",
357"name": "template",
358"type": "string",
359"rows": 4,
360"placeholder": "What is a good name for a company that makes {product}?",
361"id": "promptTemplate_0-input-template-string"
362},
363{
364"label": "Format Prompt Values",
365"name": "promptValues",
366"type": "json",
367"optional": true,
368"acceptVariable": true,
369"list": true,
370"id": "promptTemplate_0-input-promptValues-json"
371}
372],
373"inputAnchors": [],
374"inputs": {
375"template": "Answer user question:\n{text}",
376"promptValues": "{\"history\":\"{{chat_history}}\"}"
377},
378"outputAnchors": [
379{
380"id": "promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable",
381"name": "promptTemplate",
382"label": "PromptTemplate",
383"type": "PromptTemplate | BaseStringPromptTemplate | BasePromptTemplate | Runnable"
384}
385],
386"outputs": {},
387"selected": false
388},
389"selected": false,
390"positionAbsolute": {
391"x": -17.005933033720936,
392"y": -20.829788775850602
393},
394"dragging": false
395}
396],
397"edges": [
398{
399"source": "inputModerationOpenAI_0",
400"sourceHandle": "inputModerationOpenAI_0-output-inputModerationOpenAI-Moderation|Moderation",
401"target": "llmChain_0",
402"targetHandle": "llmChain_0-input-inputModeration-Moderation",
403"type": "buttonedge",
404"id": "inputModerationOpenAI_0-inputModerationOpenAI_0-output-inputModerationOpenAI-Moderation|Moderation-llmChain_0-llmChain_0-input-inputModeration-Moderation",
405"data": {
406"label": ""
407}
408},
409{
410"source": "chatOpenAI_0",
411"sourceHandle": "chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable",
412"target": "llmChain_0",
413"targetHandle": "llmChain_0-input-model-BaseLanguageModel",
414"type": "buttonedge",
415"id": "chatOpenAI_0-chatOpenAI_0-output-chatOpenAI-ChatOpenAI|BaseChatModel|BaseLanguageModel|Runnable-llmChain_0-llmChain_0-input-model-BaseLanguageModel",
416"data": {
417"label": ""
418}
419},
420{
421"source": "promptTemplate_0",
422"sourceHandle": "promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable",
423"target": "llmChain_0",
424"targetHandle": "llmChain_0-input-prompt-BasePromptTemplate",
425"type": "buttonedge",
426"id": "promptTemplate_0-promptTemplate_0-output-promptTemplate-PromptTemplate|BaseStringPromptTemplate|BasePromptTemplate|Runnable-llmChain_0-llmChain_0-input-prompt-BasePromptTemplate",
427"data": {
428"label": ""
429}
430}
431]
432}
433