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