Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
Langflow/Langflow · Upload Credit Card.json
[go: Go Back, main page]

Upload Credit Card.json

#46
by Anmol08 - opened
Files changed (1) hide show
  1. Credit Card.json +1285 -0
Credit Card.json ADDED
@@ -0,0 +1,1285 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "description": "Create, Chain, Communicate.",
3
+ "user_id": "4afce97c-d804-4f2d-81fe-cbea27ed3b1e",
4
+ "endpoint_name": null,
5
+ "id": "75efa5a2-f7ca-4e2c-93e0-c26cfe837b4d",
6
+ "tags": null,
7
+ "locked": false,
8
+ "gradient": null,
9
+ "folder_id": "b4b62e4a-4ab6-4d20-97bf-0707919d806d",
10
+ "is_component": false,
11
+ "data": {
12
+ "nodes": [
13
+ {
14
+ "id": "ChatInput-4qazp",
15
+ "type": "genericNode",
16
+ "position": {
17
+ "x": -458.72008812345877,
18
+ "y": 260.6441056480303
19
+ },
20
+ "data": {
21
+ "node": {
22
+ "template": {
23
+ "_type": "Component",
24
+ "files": {
25
+ "trace_as_metadata": true,
26
+ "file_path": "",
27
+ "fileTypes": [
28
+ "txt",
29
+ "md",
30
+ "mdx",
31
+ "csv",
32
+ "json",
33
+ "yaml",
34
+ "yml",
35
+ "xml",
36
+ "html",
37
+ "htm",
38
+ "pdf",
39
+ "docx",
40
+ "py",
41
+ "sh",
42
+ "sql",
43
+ "js",
44
+ "ts",
45
+ "tsx",
46
+ "jpg",
47
+ "jpeg",
48
+ "png",
49
+ "bmp",
50
+ "image"
51
+ ],
52
+ "list": true,
53
+ "list_add_label": "Add More",
54
+ "required": false,
55
+ "placeholder": "",
56
+ "show": true,
57
+ "name": "files",
58
+ "value": "",
59
+ "display_name": "Files",
60
+ "advanced": true,
61
+ "dynamic": false,
62
+ "info": "Files to be sent with the message.",
63
+ "title_case": false,
64
+ "type": "file",
65
+ "_input_type": "FileInput"
66
+ },
67
+ "background_color": {
68
+ "tool_mode": false,
69
+ "trace_as_input": true,
70
+ "trace_as_metadata": true,
71
+ "load_from_db": false,
72
+ "list": false,
73
+ "list_add_label": "Add More",
74
+ "required": false,
75
+ "placeholder": "",
76
+ "show": true,
77
+ "name": "background_color",
78
+ "value": "",
79
+ "display_name": "Background Color",
80
+ "advanced": true,
81
+ "input_types": [
82
+ "Message"
83
+ ],
84
+ "dynamic": false,
85
+ "info": "The background color of the icon.",
86
+ "title_case": false,
87
+ "type": "str",
88
+ "_input_type": "MessageTextInput"
89
+ },
90
+ "chat_icon": {
91
+ "tool_mode": false,
92
+ "trace_as_input": true,
93
+ "trace_as_metadata": true,
94
+ "load_from_db": false,
95
+ "list": false,
96
+ "list_add_label": "Add More",
97
+ "required": false,
98
+ "placeholder": "",
99
+ "show": true,
100
+ "name": "chat_icon",
101
+ "value": "",
102
+ "display_name": "Icon",
103
+ "advanced": true,
104
+ "input_types": [
105
+ "Message"
106
+ ],
107
+ "dynamic": false,
108
+ "info": "The icon of the message.",
109
+ "title_case": false,
110
+ "type": "str",
111
+ "_input_type": "MessageTextInput"
112
+ },
113
+ "code": {
114
+ "type": "code",
115
+ "required": true,
116
+ "placeholder": "",
117
+ "list": false,
118
+ "show": true,
119
+ "multiline": true,
120
+ "value": "from langflow.base.data.utils import IMG_FILE_TYPES, TEXT_FILE_TYPES\nfrom langflow.base.io.chat import ChatComponent\nfrom langflow.inputs import BoolInput\nfrom langflow.io import (\n DropdownInput,\n FileInput,\n MessageTextInput,\n MultilineInput,\n Output,\n)\nfrom langflow.schema.message import Message\nfrom langflow.utils.constants import (\n MESSAGE_SENDER_AI,\n MESSAGE_SENDER_NAME_USER,\n MESSAGE_SENDER_USER,\n)\n\n\nclass ChatInput(ChatComponent):\n display_name = \"Chat Input\"\n description = \"Get chat inputs from the Playground.\"\n icon = \"MessagesSquare\"\n name = \"ChatInput\"\n minimized = True\n\n inputs = [\n MultilineInput(\n name=\"input_value\",\n display_name=\"Text\",\n value=\"\",\n info=\"Message to be passed as input.\",\n input_types=[],\n ),\n BoolInput(\n name=\"should_store_message\",\n display_name=\"Store Messages\",\n info=\"Store the message in the history.\",\n value=True,\n advanced=True,\n ),\n DropdownInput(\n name=\"sender\",\n display_name=\"Sender Type\",\n options=[MESSAGE_SENDER_AI, MESSAGE_SENDER_USER],\n value=MESSAGE_SENDER_USER,\n info=\"Type of sender.\",\n advanced=True,\n ),\n MessageTextInput(\n name=\"sender_name\",\n display_name=\"Sender Name\",\n info=\"Name of the sender.\",\n value=MESSAGE_SENDER_NAME_USER,\n advanced=True,\n ),\n MessageTextInput(\n name=\"session_id\",\n display_name=\"Session ID\",\n info=\"The session ID of the chat. If empty, the current session ID parameter will be used.\",\n advanced=True,\n ),\n FileInput(\n name=\"files\",\n display_name=\"Files\",\n file_types=TEXT_FILE_TYPES + IMG_FILE_TYPES,\n info=\"Files to be sent with the message.\",\n advanced=True,\n is_list=True,\n ),\n MessageTextInput(\n name=\"background_color\",\n display_name=\"Background Color\",\n info=\"The background color of the icon.\",\n advanced=True,\n ),\n MessageTextInput(\n name=\"chat_icon\",\n display_name=\"Icon\",\n info=\"The icon of the message.\",\n advanced=True,\n ),\n MessageTextInput(\n name=\"text_color\",\n display_name=\"Text Color\",\n info=\"The text color of the name\",\n advanced=True,\n ),\n ]\n outputs = [\n Output(display_name=\"Message\", name=\"message\", method=\"message_response\"),\n ]\n\n async def message_response(self) -> Message:\n background_color = self.background_color\n text_color = self.text_color\n icon = self.chat_icon\n\n message = await Message.create(\n text=self.input_value,\n sender=self.sender,\n sender_name=self.sender_name,\n session_id=self.session_id,\n files=self.files,\n properties={\n \"background_color\": background_color,\n \"text_color\": text_color,\n \"icon\": icon,\n },\n )\n if self.session_id and isinstance(message, Message) and self.should_store_message:\n stored_message = await self.send_message(\n message,\n )\n self.message.value = stored_message\n message = stored_message\n\n self.status = message\n return message\n",
121
+ "fileTypes": [],
122
+ "file_path": "",
123
+ "password": false,
124
+ "name": "code",
125
+ "advanced": true,
126
+ "dynamic": true,
127
+ "info": "",
128
+ "load_from_db": false,
129
+ "title_case": false
130
+ },
131
+ "input_value": {
132
+ "tool_mode": false,
133
+ "trace_as_input": true,
134
+ "multiline": true,
135
+ "trace_as_metadata": true,
136
+ "load_from_db": false,
137
+ "list": false,
138
+ "list_add_label": "Add More",
139
+ "required": false,
140
+ "placeholder": "",
141
+ "show": true,
142
+ "name": "input_value",
143
+ "value": "Hi",
144
+ "display_name": "Text",
145
+ "advanced": false,
146
+ "input_types": [],
147
+ "dynamic": false,
148
+ "info": "Message to be passed as input.",
149
+ "title_case": false,
150
+ "type": "str",
151
+ "_input_type": "MultilineInput"
152
+ },
153
+ "sender": {
154
+ "tool_mode": false,
155
+ "trace_as_metadata": true,
156
+ "options": [
157
+ "Machine",
158
+ "User"
159
+ ],
160
+ "options_metadata": [],
161
+ "combobox": false,
162
+ "dialog_inputs": {},
163
+ "required": false,
164
+ "placeholder": "",
165
+ "show": true,
166
+ "name": "sender",
167
+ "value": "User",
168
+ "display_name": "Sender Type",
169
+ "advanced": true,
170
+ "dynamic": false,
171
+ "info": "Type of sender.",
172
+ "title_case": false,
173
+ "type": "str",
174
+ "_input_type": "DropdownInput"
175
+ },
176
+ "sender_name": {
177
+ "tool_mode": false,
178
+ "trace_as_input": true,
179
+ "trace_as_metadata": true,
180
+ "load_from_db": false,
181
+ "list": false,
182
+ "list_add_label": "Add More",
183
+ "required": false,
184
+ "placeholder": "",
185
+ "show": true,
186
+ "name": "sender_name",
187
+ "value": "User",
188
+ "display_name": "Sender Name",
189
+ "advanced": true,
190
+ "input_types": [
191
+ "Message"
192
+ ],
193
+ "dynamic": false,
194
+ "info": "Name of the sender.",
195
+ "title_case": false,
196
+ "type": "str",
197
+ "_input_type": "MessageTextInput"
198
+ },
199
+ "session_id": {
200
+ "tool_mode": false,
201
+ "trace_as_input": true,
202
+ "trace_as_metadata": true,
203
+ "load_from_db": false,
204
+ "list": false,
205
+ "list_add_label": "Add More",
206
+ "required": false,
207
+ "placeholder": "",
208
+ "show": true,
209
+ "name": "session_id",
210
+ "value": "",
211
+ "display_name": "Session ID",
212
+ "advanced": true,
213
+ "input_types": [
214
+ "Message"
215
+ ],
216
+ "dynamic": false,
217
+ "info": "The session ID of the chat. If empty, the current session ID parameter will be used.",
218
+ "title_case": false,
219
+ "type": "str",
220
+ "_input_type": "MessageTextInput"
221
+ },
222
+ "should_store_message": {
223
+ "tool_mode": false,
224
+ "trace_as_metadata": true,
225
+ "list": false,
226
+ "list_add_label": "Add More",
227
+ "required": false,
228
+ "placeholder": "",
229
+ "show": true,
230
+ "name": "should_store_message",
231
+ "value": true,
232
+ "display_name": "Store Messages",
233
+ "advanced": true,
234
+ "dynamic": false,
235
+ "info": "Store the message in the history.",
236
+ "title_case": false,
237
+ "type": "bool",
238
+ "_input_type": "BoolInput"
239
+ },
240
+ "text_color": {
241
+ "tool_mode": false,
242
+ "trace_as_input": true,
243
+ "trace_as_metadata": true,
244
+ "load_from_db": false,
245
+ "list": false,
246
+ "list_add_label": "Add More",
247
+ "required": false,
248
+ "placeholder": "",
249
+ "show": true,
250
+ "name": "text_color",
251
+ "value": "",
252
+ "display_name": "Text Color",
253
+ "advanced": true,
254
+ "input_types": [
255
+ "Message"
256
+ ],
257
+ "dynamic": false,
258
+ "info": "The text color of the name",
259
+ "title_case": false,
260
+ "type": "str",
261
+ "_input_type": "MessageTextInput"
262
+ }
263
+ },
264
+ "description": "Get chat inputs from the Playground.",
265
+ "icon": "MessagesSquare",
266
+ "base_classes": [
267
+ "Message"
268
+ ],
269
+ "display_name": "Chat Input",
270
+ "documentation": "",
271
+ "minimized": true,
272
+ "custom_fields": {},
273
+ "output_types": [],
274
+ "pinned": false,
275
+ "conditional_paths": [],
276
+ "frozen": false,
277
+ "outputs": [
278
+ {
279
+ "types": [
280
+ "Message"
281
+ ],
282
+ "selected": "Message",
283
+ "name": "message",
284
+ "hidden": null,
285
+ "display_name": "Message",
286
+ "method": "message_response",
287
+ "value": "__UNDEFINED__",
288
+ "cache": true,
289
+ "required_inputs": null,
290
+ "allows_loop": false,
291
+ "tool_mode": true
292
+ }
293
+ ],
294
+ "field_order": [
295
+ "input_value",
296
+ "should_store_message",
297
+ "sender",
298
+ "sender_name",
299
+ "session_id",
300
+ "files",
301
+ "background_color",
302
+ "chat_icon",
303
+ "text_color"
304
+ ],
305
+ "beta": false,
306
+ "legacy": false,
307
+ "edited": false,
308
+ "metadata": {},
309
+ "tool_mode": false,
310
+ "lf_version": "1.2.0"
311
+ },
312
+ "type": "ChatInput",
313
+ "id": "ChatInput-4qazp",
314
+ "description": "Get chat inputs from the Playground.",
315
+ "display_name": "Chat Input"
316
+ },
317
+ "selected": false,
318
+ "width": 320,
319
+ "height": 233,
320
+ "positionAbsolute": {
321
+ "x": -414.89559046244426,
322
+ "y": 59.974037410753624
323
+ },
324
+ "dragging": false,
325
+ "measured": {
326
+ "width": 320,
327
+ "height": 233
328
+ }
329
+ },
330
+ {
331
+ "id": "Prompt-9gd62",
332
+ "type": "genericNode",
333
+ "position": {
334
+ "x": -49.132099799632684,
335
+ "y": 664.0510324431276
336
+ },
337
+ "data": {
338
+ "node": {
339
+ "template": {
340
+ "_type": "Component",
341
+ "code": {
342
+ "type": "code",
343
+ "required": true,
344
+ "placeholder": "",
345
+ "list": false,
346
+ "show": true,
347
+ "multiline": true,
348
+ "value": "from langflow.base.prompts.api_utils import process_prompt_template\nfrom langflow.custom import Component\nfrom langflow.inputs.inputs import DefaultPromptField\nfrom langflow.io import MessageTextInput, Output, PromptInput\nfrom langflow.schema.message import Message\nfrom langflow.template.utils import update_template_values\n\n\nclass PromptComponent(Component):\n display_name: str = \"Prompt\"\n description: str = \"Create a prompt template with dynamic variables.\"\n icon = \"prompts\"\n trace_type = \"prompt\"\n name = \"Prompt\"\n\n inputs = [\n PromptInput(name=\"template\", display_name=\"Template\"),\n MessageTextInput(\n name=\"tool_placeholder\",\n display_name=\"Tool Placeholder\",\n tool_mode=True,\n advanced=True,\n info=\"A placeholder input for tool mode.\",\n ),\n ]\n\n outputs = [\n Output(display_name=\"Prompt Message\", name=\"prompt\", method=\"build_prompt\"),\n ]\n\n async def build_prompt(self) -> Message:\n prompt = Message.from_template(**self._attributes)\n self.status = prompt.text\n return prompt\n\n def _update_template(self, frontend_node: dict):\n prompt_template = frontend_node[\"template\"][\"template\"][\"value\"]\n custom_fields = frontend_node[\"custom_fields\"]\n frontend_node_template = frontend_node[\"template\"]\n _ = process_prompt_template(\n template=prompt_template,\n name=\"template\",\n custom_fields=custom_fields,\n frontend_node_template=frontend_node_template,\n )\n return frontend_node\n\n async def update_frontend_node(self, new_frontend_node: dict, current_frontend_node: dict):\n \"\"\"This function is called after the code validation is done.\"\"\"\n frontend_node = await super().update_frontend_node(new_frontend_node, current_frontend_node)\n template = frontend_node[\"template\"][\"template\"][\"value\"]\n # Kept it duplicated for backwards compatibility\n _ = process_prompt_template(\n template=template,\n name=\"template\",\n custom_fields=frontend_node[\"custom_fields\"],\n frontend_node_template=frontend_node[\"template\"],\n )\n # Now that template is updated, we need to grab any values that were set in the current_frontend_node\n # and update the frontend_node with those values\n update_template_values(new_template=frontend_node, previous_template=current_frontend_node[\"template\"])\n return frontend_node\n\n def _get_fallback_input(self, **kwargs):\n return DefaultPromptField(**kwargs)\n",
349
+ "fileTypes": [],
350
+ "file_path": "",
351
+ "password": false,
352
+ "name": "code",
353
+ "advanced": true,
354
+ "dynamic": true,
355
+ "info": "",
356
+ "load_from_db": false,
357
+ "title_case": false
358
+ },
359
+ "template": {
360
+ "tool_mode": false,
361
+ "trace_as_input": true,
362
+ "list": false,
363
+ "list_add_label": "Add More",
364
+ "required": false,
365
+ "placeholder": "",
366
+ "show": true,
367
+ "name": "template",
368
+ "value": "Hello! I'm your credit card assistant. 😊\n\nPlease choose one option by typing the number (1, 2, or 3):\n\n1. Analyze Multiple Cards for a Specific Spend \n (I'll help you find the best card among your existing cards for a particular purchase)\n\n2. Card Recommendation Based on Lifestyle \n (Share your spending habits, and I'll suggest the perfect card for you)\n\n3. Compare Two Cards \n (I'll analyze and compare any two credit cards you're interested in)\n\n{input}\n\n",
369
+ "display_name": "Template",
370
+ "advanced": false,
371
+ "dynamic": false,
372
+ "info": "",
373
+ "title_case": false,
374
+ "type": "prompt",
375
+ "_input_type": "PromptInput",
376
+ "load_from_db": false
377
+ },
378
+ "tool_placeholder": {
379
+ "tool_mode": true,
380
+ "trace_as_input": true,
381
+ "trace_as_metadata": true,
382
+ "load_from_db": false,
383
+ "list": false,
384
+ "list_add_label": "Add More",
385
+ "required": false,
386
+ "placeholder": "",
387
+ "show": true,
388
+ "name": "tool_placeholder",
389
+ "value": "",
390
+ "display_name": "Tool Placeholder",
391
+ "advanced": true,
392
+ "input_types": [
393
+ "Message"
394
+ ],
395
+ "dynamic": false,
396
+ "info": "A placeholder input for tool mode.",
397
+ "title_case": false,
398
+ "type": "str",
399
+ "_input_type": "MessageTextInput"
400
+ },
401
+ "input": {
402
+ "field_type": "str",
403
+ "required": false,
404
+ "placeholder": "",
405
+ "list": false,
406
+ "show": true,
407
+ "multiline": true,
408
+ "value": "",
409
+ "fileTypes": [],
410
+ "file_path": "",
411
+ "name": "input",
412
+ "display_name": "input",
413
+ "advanced": false,
414
+ "input_types": [
415
+ "Message"
416
+ ],
417
+ "dynamic": false,
418
+ "info": "",
419
+ "load_from_db": false,
420
+ "title_case": false,
421
+ "type": "str"
422
+ }
423
+ },
424
+ "description": "Create a prompt template with dynamic variables.",
425
+ "icon": "prompts",
426
+ "base_classes": [
427
+ "Message"
428
+ ],
429
+ "display_name": "Prompt",
430
+ "documentation": "",
431
+ "minimized": false,
432
+ "custom_fields": {
433
+ "template": [
434
+ "input"
435
+ ]
436
+ },
437
+ "output_types": [],
438
+ "pinned": false,
439
+ "conditional_paths": [],
440
+ "frozen": false,
441
+ "outputs": [
442
+ {
443
+ "types": [
444
+ "Message"
445
+ ],
446
+ "selected": "Message",
447
+ "name": "prompt",
448
+ "hidden": null,
449
+ "display_name": "Prompt Message",
450
+ "method": "build_prompt",
451
+ "value": "__UNDEFINED__",
452
+ "cache": true,
453
+ "required_inputs": null,
454
+ "allows_loop": false,
455
+ "tool_mode": true
456
+ }
457
+ ],
458
+ "field_order": [
459
+ "template",
460
+ "tool_placeholder"
461
+ ],
462
+ "beta": false,
463
+ "legacy": false,
464
+ "edited": false,
465
+ "metadata": {},
466
+ "tool_mode": false,
467
+ "lf_version": "1.2.0"
468
+ },
469
+ "type": "Prompt",
470
+ "id": "Prompt-9gd62",
471
+ "description": "Create a prompt template with dynamic variables.",
472
+ "display_name": "Prompt"
473
+ },
474
+ "selected": false,
475
+ "width": 320,
476
+ "height": 346,
477
+ "dragging": false,
478
+ "positionAbsolute": {
479
+ "x": 22.371027963075107,
480
+ "y": 350.3598912906032
481
+ },
482
+ "measured": {
483
+ "width": 320,
484
+ "height": 346
485
+ }
486
+ },
487
+ {
488
+ "id": "ChatOutput-MfwRT",
489
+ "type": "genericNode",
490
+ "position": {
491
+ "x": 1358.5307666994065,
492
+ "y": 207.05019975986872
493
+ },
494
+ "data": {
495
+ "node": {
496
+ "template": {
497
+ "_type": "Component",
498
+ "input_value": {
499
+ "trace_as_metadata": true,
500
+ "list": false,
501
+ "list_add_label": "Add More",
502
+ "required": true,
503
+ "placeholder": "",
504
+ "show": true,
505
+ "name": "input_value",
506
+ "value": "",
507
+ "display_name": "Text",
508
+ "advanced": false,
509
+ "input_types": [
510
+ "Data",
511
+ "DataFrame",
512
+ "Message"
513
+ ],
514
+ "dynamic": false,
515
+ "info": "Message to be passed as output.",
516
+ "title_case": false,
517
+ "type": "other",
518
+ "_input_type": "HandleInput"
519
+ },
520
+ "background_color": {
521
+ "tool_mode": false,
522
+ "trace_as_input": true,
523
+ "trace_as_metadata": true,
524
+ "load_from_db": false,
525
+ "list": false,
526
+ "list_add_label": "Add More",
527
+ "required": false,
528
+ "placeholder": "",
529
+ "show": true,
530
+ "name": "background_color",
531
+ "value": "",
532
+ "display_name": "Background Color",
533
+ "advanced": true,
534
+ "input_types": [
535
+ "Message"
536
+ ],
537
+ "dynamic": false,
538
+ "info": "The background color of the icon.",
539
+ "title_case": false,
540
+ "type": "str",
541
+ "_input_type": "MessageTextInput"
542
+ },
543
+ "chat_icon": {
544
+ "tool_mode": false,
545
+ "trace_as_input": true,
546
+ "trace_as_metadata": true,
547
+ "load_from_db": false,
548
+ "list": false,
549
+ "list_add_label": "Add More",
550
+ "required": false,
551
+ "placeholder": "",
552
+ "show": true,
553
+ "name": "chat_icon",
554
+ "value": "",
555
+ "display_name": "Icon",
556
+ "advanced": true,
557
+ "input_types": [
558
+ "Message"
559
+ ],
560
+ "dynamic": false,
561
+ "info": "The icon of the message.",
562
+ "title_case": false,
563
+ "type": "str",
564
+ "_input_type": "MessageTextInput"
565
+ },
566
+ "clean_data": {
567
+ "tool_mode": false,
568
+ "trace_as_metadata": true,
569
+ "list": false,
570
+ "list_add_label": "Add More",
571
+ "required": false,
572
+ "placeholder": "",
573
+ "show": true,
574
+ "name": "clean_data",
575
+ "value": true,
576
+ "display_name": "Basic Clean Data",
577
+ "advanced": true,
578
+ "dynamic": false,
579
+ "info": "Whether to clean the data",
580
+ "title_case": false,
581
+ "type": "bool",
582
+ "_input_type": "BoolInput"
583
+ },
584
+ "code": {
585
+ "type": "code",
586
+ "required": true,
587
+ "placeholder": "",
588
+ "list": false,
589
+ "show": true,
590
+ "multiline": true,
591
+ "value": "from collections.abc import Generator\nfrom typing import Any\n\nfrom langflow.base.io.chat import ChatComponent\nfrom langflow.inputs import BoolInput\nfrom langflow.inputs.inputs import HandleInput\nfrom langflow.io import DropdownInput, MessageTextInput, Output\nfrom langflow.schema.data import Data\nfrom langflow.schema.dataframe import DataFrame\nfrom langflow.schema.message import Message\nfrom langflow.schema.properties import Source\nfrom langflow.utils.constants import (\n MESSAGE_SENDER_AI,\n MESSAGE_SENDER_NAME_AI,\n MESSAGE_SENDER_USER,\n)\n\n\nclass ChatOutput(ChatComponent):\n display_name = \"Chat Output\"\n description = \"Display a chat message in the Playground.\"\n icon = \"MessagesSquare\"\n name = \"ChatOutput\"\n minimized = True\n\n inputs = [\n HandleInput(\n name=\"input_value\",\n display_name=\"Text\",\n info=\"Message to be passed as output.\",\n input_types=[\"Data\", \"DataFrame\", \"Message\"],\n required=True,\n ),\n BoolInput(\n name=\"should_store_message\",\n display_name=\"Store Messages\",\n info=\"Store the message in the history.\",\n value=True,\n advanced=True,\n ),\n DropdownInput(\n name=\"sender\",\n display_name=\"Sender Type\",\n options=[MESSAGE_SENDER_AI, MESSAGE_SENDER_USER],\n value=MESSAGE_SENDER_AI,\n advanced=True,\n info=\"Type of sender.\",\n ),\n MessageTextInput(\n name=\"sender_name\",\n display_name=\"Sender Name\",\n info=\"Name of the sender.\",\n value=MESSAGE_SENDER_NAME_AI,\n advanced=True,\n ),\n MessageTextInput(\n name=\"session_id\",\n display_name=\"Session ID\",\n info=\"The session ID of the chat. If empty, the current session ID parameter will be used.\",\n advanced=True,\n ),\n MessageTextInput(\n name=\"data_template\",\n display_name=\"Data Template\",\n value=\"{text}\",\n advanced=True,\n info=\"Template to convert Data to Text. If left empty, it will be dynamically set to the Data's text key.\",\n ),\n MessageTextInput(\n name=\"background_color\",\n display_name=\"Background Color\",\n info=\"The background color of the icon.\",\n advanced=True,\n ),\n MessageTextInput(\n name=\"chat_icon\",\n display_name=\"Icon\",\n info=\"The icon of the message.\",\n advanced=True,\n ),\n MessageTextInput(\n name=\"text_color\",\n display_name=\"Text Color\",\n info=\"The text color of the name\",\n advanced=True,\n ),\n BoolInput(\n name=\"clean_data\",\n display_name=\"Basic Clean Data\",\n value=True,\n info=\"Whether to clean the data\",\n advanced=True,\n ),\n ]\n outputs = [\n Output(\n display_name=\"Message\",\n name=\"message\",\n method=\"message_response\",\n ),\n ]\n\n def _build_source(self, id_: str | None, display_name: str | None, source: str | None) -> Source:\n source_dict = {}\n if id_:\n source_dict[\"id\"] = id_\n if display_name:\n source_dict[\"display_name\"] = display_name\n if source:\n # Handle case where source is a ChatOpenAI object\n if hasattr(source, \"model_name\"):\n source_dict[\"source\"] = source.model_name\n elif hasattr(source, \"model\"):\n source_dict[\"source\"] = str(source.model)\n else:\n source_dict[\"source\"] = str(source)\n return Source(**source_dict)\n\n async def message_response(self) -> Message:\n # First convert the input to string if needed\n text = self.convert_to_string()\n # Get source properties\n source, icon, display_name, source_id = self.get_properties_from_source_component()\n background_color = self.background_color\n text_color = self.text_color\n if self.chat_icon:\n icon = self.chat_icon\n\n # Create or use existing Message object\n if isinstance(self.input_value, Message):\n message = self.input_value\n # Update message properties\n message.text = text\n else:\n message = Message(text=text)\n\n # Set message properties\n message.sender = self.sender\n message.sender_name = self.sender_name\n message.session_id = self.session_id\n message.flow_id = self.graph.flow_id if hasattr(self, \"graph\") else None\n message.properties.source = self._build_source(source_id, display_name, source)\n message.properties.icon = icon\n message.properties.background_color = background_color\n message.properties.text_color = text_color\n\n # Store message if needed\n if self.session_id and self.should_store_message:\n stored_message = await self.send_message(message)\n self.message.value = stored_message\n message = stored_message\n\n self.status = message\n return message\n\n def _validate_input(self) -> None:\n \"\"\"Validate the input data and raise ValueError if invalid.\"\"\"\n if self.input_value is None:\n msg = \"Input data cannot be None\"\n raise ValueError(msg)\n if isinstance(self.input_value, list) and not all(\n isinstance(item, Message | Data | DataFrame | str) for item in self.input_value\n ):\n invalid_types = [\n type(item).__name__\n for item in self.input_value\n if not isinstance(item, Message | Data | DataFrame | str)\n ]\n msg = f\"Expected Data or DataFrame or Message or str, got {invalid_types}\"\n raise TypeError(msg)\n if not isinstance(\n self.input_value,\n Message | Data | DataFrame | str | list | Generator | type(None),\n ):\n type_name = type(self.input_value).__name__\n msg = f\"Expected Data or DataFrame or Message or str, Generator or None, got {type_name}\"\n raise TypeError(msg)\n\n def _safe_convert(self, data: Any) -> str:\n \"\"\"Safely convert input data to string.\"\"\"\n try:\n if isinstance(data, str):\n return data\n if isinstance(data, Message):\n return data.get_text()\n if isinstance(data, Data):\n if data.get_text() is None:\n msg = \"Empty Data object\"\n raise ValueError(msg)\n return data.get_text()\n if isinstance(data, DataFrame):\n if self.clean_data:\n # Remove empty rows\n data = data.dropna(how=\"all\")\n # Remove empty lines in each cell\n data = data.replace(r\"^\\s*$\", \"\", regex=True)\n # Replace multiple newlines with a single newline\n data = data.replace(r\"\\n+\", \"\\n\", regex=True)\n return (\n data.replace(r\"\\|\", r\"\\\\|\", regex=True)\n .applymap(lambda x: (str(x).replace(\"\\n\", \"<br/>\") if isinstance(x, str) else x))\n .to_markdown(index=False)\n )\n return str(data)\n except (ValueError, TypeError, AttributeError) as e:\n msg = f\"Error converting data: {e!s}\"\n raise ValueError(msg) from e\n\n def convert_to_string(self) -> str | Generator[Any, None, None]:\n \"\"\"Convert input data to string with proper error handling.\"\"\"\n self._validate_input()\n if isinstance(self.input_value, list):\n return \"\\n\".join([self._safe_convert(item) for item in self.input_value])\n if isinstance(self.input_value, Generator):\n return self.input_value\n return self._safe_convert(self.input_value)\n",
592
+ "fileTypes": [],
593
+ "file_path": "",
594
+ "password": false,
595
+ "name": "code",
596
+ "advanced": true,
597
+ "dynamic": true,
598
+ "info": "",
599
+ "load_from_db": false,
600
+ "title_case": false
601
+ },
602
+ "data_template": {
603
+ "tool_mode": false,
604
+ "trace_as_input": true,
605
+ "trace_as_metadata": true,
606
+ "load_from_db": false,
607
+ "list": false,
608
+ "list_add_label": "Add More",
609
+ "required": false,
610
+ "placeholder": "",
611
+ "show": true,
612
+ "name": "data_template",
613
+ "value": "{text}",
614
+ "display_name": "Data Template",
615
+ "advanced": true,
616
+ "input_types": [
617
+ "Message"
618
+ ],
619
+ "dynamic": false,
620
+ "info": "Template to convert Data to Text. If left empty, it will be dynamically set to the Data's text key.",
621
+ "title_case": false,
622
+ "type": "str",
623
+ "_input_type": "MessageTextInput"
624
+ },
625
+ "sender": {
626
+ "tool_mode": false,
627
+ "trace_as_metadata": true,
628
+ "options": [
629
+ "Machine",
630
+ "User"
631
+ ],
632
+ "options_metadata": [],
633
+ "combobox": false,
634
+ "dialog_inputs": {},
635
+ "required": false,
636
+ "placeholder": "",
637
+ "show": true,
638
+ "name": "sender",
639
+ "value": "Machine",
640
+ "display_name": "Sender Type",
641
+ "advanced": true,
642
+ "dynamic": false,
643
+ "info": "Type of sender.",
644
+ "title_case": false,
645
+ "type": "str",
646
+ "_input_type": "DropdownInput"
647
+ },
648
+ "sender_name": {
649
+ "tool_mode": false,
650
+ "trace_as_input": true,
651
+ "trace_as_metadata": true,
652
+ "load_from_db": false,
653
+ "list": false,
654
+ "list_add_label": "Add More",
655
+ "required": false,
656
+ "placeholder": "",
657
+ "show": true,
658
+ "name": "sender_name",
659
+ "value": "AI",
660
+ "display_name": "Sender Name",
661
+ "advanced": true,
662
+ "input_types": [
663
+ "Message"
664
+ ],
665
+ "dynamic": false,
666
+ "info": "Name of the sender.",
667
+ "title_case": false,
668
+ "type": "str",
669
+ "_input_type": "MessageTextInput"
670
+ },
671
+ "session_id": {
672
+ "tool_mode": false,
673
+ "trace_as_input": true,
674
+ "trace_as_metadata": true,
675
+ "load_from_db": false,
676
+ "list": false,
677
+ "list_add_label": "Add More",
678
+ "required": false,
679
+ "placeholder": "",
680
+ "show": true,
681
+ "name": "session_id",
682
+ "value": "",
683
+ "display_name": "Session ID",
684
+ "advanced": true,
685
+ "input_types": [
686
+ "Message"
687
+ ],
688
+ "dynamic": false,
689
+ "info": "The session ID of the chat. If empty, the current session ID parameter will be used.",
690
+ "title_case": false,
691
+ "type": "str",
692
+ "_input_type": "MessageTextInput"
693
+ },
694
+ "should_store_message": {
695
+ "tool_mode": false,
696
+ "trace_as_metadata": true,
697
+ "list": false,
698
+ "list_add_label": "Add More",
699
+ "required": false,
700
+ "placeholder": "",
701
+ "show": true,
702
+ "name": "should_store_message",
703
+ "value": true,
704
+ "display_name": "Store Messages",
705
+ "advanced": true,
706
+ "dynamic": false,
707
+ "info": "Store the message in the history.",
708
+ "title_case": false,
709
+ "type": "bool",
710
+ "_input_type": "BoolInput"
711
+ },
712
+ "text_color": {
713
+ "tool_mode": false,
714
+ "trace_as_input": true,
715
+ "trace_as_metadata": true,
716
+ "load_from_db": false,
717
+ "list": false,
718
+ "list_add_label": "Add More",
719
+ "required": false,
720
+ "placeholder": "",
721
+ "show": true,
722
+ "name": "text_color",
723
+ "value": "",
724
+ "display_name": "Text Color",
725
+ "advanced": true,
726
+ "input_types": [
727
+ "Message"
728
+ ],
729
+ "dynamic": false,
730
+ "info": "The text color of the name",
731
+ "title_case": false,
732
+ "type": "str",
733
+ "_input_type": "MessageTextInput"
734
+ }
735
+ },
736
+ "description": "Display a chat message in the Playground.",
737
+ "icon": "MessagesSquare",
738
+ "base_classes": [
739
+ "Message"
740
+ ],
741
+ "display_name": "Chat Output",
742
+ "documentation": "",
743
+ "minimized": true,
744
+ "custom_fields": {},
745
+ "output_types": [],
746
+ "pinned": false,
747
+ "conditional_paths": [],
748
+ "frozen": false,
749
+ "outputs": [
750
+ {
751
+ "types": [
752
+ "Message"
753
+ ],
754
+ "selected": "Message",
755
+ "name": "message",
756
+ "hidden": null,
757
+ "display_name": "Message",
758
+ "method": "message_response",
759
+ "value": "__UNDEFINED__",
760
+ "cache": true,
761
+ "required_inputs": null,
762
+ "allows_loop": false,
763
+ "tool_mode": true
764
+ }
765
+ ],
766
+ "field_order": [
767
+ "input_value",
768
+ "should_store_message",
769
+ "sender",
770
+ "sender_name",
771
+ "session_id",
772
+ "data_template",
773
+ "background_color",
774
+ "chat_icon",
775
+ "text_color",
776
+ "clean_data"
777
+ ],
778
+ "beta": false,
779
+ "legacy": false,
780
+ "edited": false,
781
+ "metadata": {},
782
+ "tool_mode": false,
783
+ "lf_version": "1.2.0"
784
+ },
785
+ "type": "ChatOutput",
786
+ "id": "ChatOutput-MfwRT"
787
+ },
788
+ "selected": false,
789
+ "width": 320,
790
+ "height": 233,
791
+ "measured": {
792
+ "width": 320,
793
+ "height": 233
794
+ }
795
+ },
796
+ {
797
+ "id": "OpenAIModel-F7Fug",
798
+ "type": "genericNode",
799
+ "position": {
800
+ "x": 518.8176464736987,
801
+ "y": 2.7400609718167743
802
+ },
803
+ "data": {
804
+ "node": {
805
+ "template": {
806
+ "_type": "Component",
807
+ "api_key": {
808
+ "load_from_db": false,
809
+ "required": true,
810
+ "placeholder": "",
811
+ "show": true,
812
+ "name": "api_key",
813
+ "value": "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",
814
+ "display_name": "OpenAI API Key",
815
+ "advanced": false,
816
+ "input_types": [
817
+ "Message"
818
+ ],
819
+ "dynamic": false,
820
+ "info": "The OpenAI API Key to use for the OpenAI model.",
821
+ "title_case": false,
822
+ "password": true,
823
+ "type": "str",
824
+ "_input_type": "SecretStrInput"
825
+ },
826
+ "code": {
827
+ "type": "code",
828
+ "required": true,
829
+ "placeholder": "",
830
+ "list": false,
831
+ "show": true,
832
+ "multiline": true,
833
+ "value": "from langchain_openai import ChatOpenAI\nfrom pydantic.v1 import SecretStr\n\nfrom langflow.base.models.model import LCModelComponent\nfrom langflow.base.models.openai_constants import OPENAI_MODEL_NAMES\nfrom langflow.field_typing import LanguageModel\nfrom langflow.field_typing.range_spec import RangeSpec\nfrom langflow.inputs import BoolInput, DictInput, DropdownInput, IntInput, SecretStrInput, SliderInput, StrInput\n\n\nclass OpenAIModelComponent(LCModelComponent):\n display_name = \"OpenAI\"\n description = \"Generates text using OpenAI LLMs.\"\n icon = \"OpenAI\"\n name = \"OpenAIModel\"\n\n inputs = [\n *LCModelComponent._base_inputs,\n IntInput(\n name=\"max_tokens\",\n display_name=\"Max Tokens\",\n advanced=True,\n info=\"The maximum number of tokens to generate. Set to 0 for unlimited tokens.\",\n range_spec=RangeSpec(min=0, max=128000),\n ),\n DictInput(\n name=\"model_kwargs\",\n display_name=\"Model Kwargs\",\n advanced=True,\n info=\"Additional keyword arguments to pass to the model.\",\n ),\n BoolInput(\n name=\"json_mode\",\n display_name=\"JSON Mode\",\n advanced=True,\n info=\"If True, it will output JSON regardless of passing a schema.\",\n ),\n DropdownInput(\n name=\"model_name\",\n display_name=\"Model Name\",\n advanced=False,\n options=OPENAI_MODEL_NAMES,\n value=OPENAI_MODEL_NAMES[0],\n ),\n StrInput(\n name=\"openai_api_base\",\n display_name=\"OpenAI API Base\",\n advanced=True,\n info=\"The base URL of the OpenAI API. \"\n \"Defaults to https://api.openai.com/v1. \"\n \"You can change this to use other APIs like JinaChat, LocalAI and Prem.\",\n ),\n SecretStrInput(\n name=\"api_key\",\n display_name=\"OpenAI API Key\",\n info=\"The OpenAI API Key to use for the OpenAI model.\",\n advanced=False,\n value=\"OPENAI_API_KEY\",\n required=True,\n ),\n SliderInput(\n name=\"temperature\", display_name=\"Temperature\", value=0.1, range_spec=RangeSpec(min=0, max=1, step=0.01)\n ),\n IntInput(\n name=\"seed\",\n display_name=\"Seed\",\n info=\"The seed controls the reproducibility of the job.\",\n advanced=True,\n value=1,\n ),\n IntInput(\n name=\"max_retries\",\n display_name=\"Max Retries\",\n info=\"The maximum number of retries to make when generating.\",\n advanced=True,\n value=5,\n ),\n IntInput(\n name=\"timeout\",\n display_name=\"Timeout\",\n info=\"The timeout for requests to OpenAI completion API.\",\n advanced=True,\n value=700,\n ),\n ]\n\n def build_model(self) -> LanguageModel: # type: ignore[type-var]\n openai_api_key = self.api_key\n temperature = self.temperature\n model_name: str = self.model_name\n max_tokens = self.max_tokens\n model_kwargs = self.model_kwargs or {}\n openai_api_base = self.openai_api_base or \"https://api.openai.com/v1\"\n json_mode = self.json_mode\n seed = self.seed\n max_retries = self.max_retries\n timeout = self.timeout\n\n api_key = SecretStr(openai_api_key).get_secret_value() if openai_api_key else None\n output = ChatOpenAI(\n max_tokens=max_tokens or None,\n model_kwargs=model_kwargs,\n model=model_name,\n base_url=openai_api_base,\n api_key=api_key,\n temperature=temperature if temperature is not None else 0.1,\n seed=seed,\n max_retries=max_retries,\n request_timeout=timeout,\n )\n if json_mode:\n output = output.bind(response_format={\"type\": \"json_object\"})\n\n return output\n\n def _get_exception_message(self, e: Exception):\n \"\"\"Get a message from an OpenAI exception.\n\n Args:\n e (Exception): The exception to get the message from.\n\n Returns:\n str: The message from the exception.\n \"\"\"\n try:\n from openai import BadRequestError\n except ImportError:\n return None\n if isinstance(e, BadRequestError):\n message = e.body.get(\"message\")\n if message:\n return message\n return None\n",
834
+ "fileTypes": [],
835
+ "file_path": "",
836
+ "password": false,
837
+ "name": "code",
838
+ "advanced": true,
839
+ "dynamic": true,
840
+ "info": "",
841
+ "load_from_db": false,
842
+ "title_case": false
843
+ },
844
+ "input_value": {
845
+ "trace_as_input": true,
846
+ "tool_mode": false,
847
+ "trace_as_metadata": true,
848
+ "load_from_db": false,
849
+ "list": false,
850
+ "list_add_label": "Add More",
851
+ "required": false,
852
+ "placeholder": "",
853
+ "show": true,
854
+ "name": "input_value",
855
+ "value": "",
856
+ "display_name": "Input",
857
+ "advanced": false,
858
+ "input_types": [
859
+ "Message"
860
+ ],
861
+ "dynamic": false,
862
+ "info": "",
863
+ "title_case": false,
864
+ "type": "str",
865
+ "_input_type": "MessageInput"
866
+ },
867
+ "json_mode": {
868
+ "tool_mode": false,
869
+ "trace_as_metadata": true,
870
+ "list": false,
871
+ "list_add_label": "Add More",
872
+ "required": false,
873
+ "placeholder": "",
874
+ "show": true,
875
+ "name": "json_mode",
876
+ "value": false,
877
+ "display_name": "JSON Mode",
878
+ "advanced": true,
879
+ "dynamic": false,
880
+ "info": "If True, it will output JSON regardless of passing a schema.",
881
+ "title_case": false,
882
+ "type": "bool",
883
+ "_input_type": "BoolInput"
884
+ },
885
+ "max_retries": {
886
+ "tool_mode": false,
887
+ "trace_as_metadata": true,
888
+ "list": false,
889
+ "list_add_label": "Add More",
890
+ "required": false,
891
+ "placeholder": "",
892
+ "show": true,
893
+ "name": "max_retries",
894
+ "value": 5,
895
+ "display_name": "Max Retries",
896
+ "advanced": true,
897
+ "dynamic": false,
898
+ "info": "The maximum number of retries to make when generating.",
899
+ "title_case": false,
900
+ "type": "int",
901
+ "_input_type": "IntInput"
902
+ },
903
+ "max_tokens": {
904
+ "tool_mode": false,
905
+ "trace_as_metadata": true,
906
+ "range_spec": {
907
+ "step_type": "float",
908
+ "min": 0,
909
+ "max": 128000,
910
+ "step": 0.1
911
+ },
912
+ "list": false,
913
+ "list_add_label": "Add More",
914
+ "required": false,
915
+ "placeholder": "",
916
+ "show": true,
917
+ "name": "max_tokens",
918
+ "value": "",
919
+ "display_name": "Max Tokens",
920
+ "advanced": true,
921
+ "dynamic": false,
922
+ "info": "The maximum number of tokens to generate. Set to 0 for unlimited tokens.",
923
+ "title_case": false,
924
+ "type": "int",
925
+ "_input_type": "IntInput"
926
+ },
927
+ "model_kwargs": {
928
+ "tool_mode": false,
929
+ "trace_as_input": true,
930
+ "list": false,
931
+ "list_add_label": "Add More",
932
+ "required": false,
933
+ "placeholder": "",
934
+ "show": true,
935
+ "name": "model_kwargs",
936
+ "value": {},
937
+ "display_name": "Model Kwargs",
938
+ "advanced": true,
939
+ "dynamic": false,
940
+ "info": "Additional keyword arguments to pass to the model.",
941
+ "title_case": false,
942
+ "type": "dict",
943
+ "_input_type": "DictInput"
944
+ },
945
+ "model_name": {
946
+ "tool_mode": false,
947
+ "trace_as_metadata": true,
948
+ "options": [
949
+ "gpt-4o-mini",
950
+ "gpt-4o",
951
+ "gpt-4-turbo",
952
+ "gpt-4-turbo-preview",
953
+ "gpt-4",
954
+ "gpt-3.5-turbo",
955
+ "gpt-3.5-turbo-0125"
956
+ ],
957
+ "options_metadata": [],
958
+ "combobox": false,
959
+ "dialog_inputs": {},
960
+ "required": false,
961
+ "placeholder": "",
962
+ "show": true,
963
+ "name": "model_name",
964
+ "value": "gpt-3.5-turbo",
965
+ "display_name": "Model Name",
966
+ "advanced": false,
967
+ "dynamic": false,
968
+ "info": "",
969
+ "title_case": false,
970
+ "type": "str",
971
+ "_input_type": "DropdownInput",
972
+ "load_from_db": false
973
+ },
974
+ "openai_api_base": {
975
+ "tool_mode": false,
976
+ "trace_as_metadata": true,
977
+ "load_from_db": false,
978
+ "list": false,
979
+ "list_add_label": "Add More",
980
+ "required": false,
981
+ "placeholder": "",
982
+ "show": true,
983
+ "name": "openai_api_base",
984
+ "value": "",
985
+ "display_name": "OpenAI API Base",
986
+ "advanced": true,
987
+ "dynamic": false,
988
+ "info": "The base URL of the OpenAI API. Defaults to https://api.openai.com/v1. You can change this to use other APIs like JinaChat, LocalAI and Prem.",
989
+ "title_case": false,
990
+ "type": "str",
991
+ "_input_type": "StrInput"
992
+ },
993
+ "seed": {
994
+ "tool_mode": false,
995
+ "trace_as_metadata": true,
996
+ "list": false,
997
+ "list_add_label": "Add More",
998
+ "required": false,
999
+ "placeholder": "",
1000
+ "show": true,
1001
+ "name": "seed",
1002
+ "value": 1,
1003
+ "display_name": "Seed",
1004
+ "advanced": true,
1005
+ "dynamic": false,
1006
+ "info": "The seed controls the reproducibility of the job.",
1007
+ "title_case": false,
1008
+ "type": "int",
1009
+ "_input_type": "IntInput"
1010
+ },
1011
+ "stream": {
1012
+ "tool_mode": false,
1013
+ "trace_as_metadata": true,
1014
+ "list": false,
1015
+ "list_add_label": "Add More",
1016
+ "required": false,
1017
+ "placeholder": "",
1018
+ "show": true,
1019
+ "name": "stream",
1020
+ "value": false,
1021
+ "display_name": "Stream",
1022
+ "advanced": false,
1023
+ "dynamic": false,
1024
+ "info": "Stream the response from the model. Streaming works only in Chat.",
1025
+ "title_case": false,
1026
+ "type": "bool",
1027
+ "_input_type": "BoolInput"
1028
+ },
1029
+ "system_message": {
1030
+ "tool_mode": false,
1031
+ "trace_as_input": true,
1032
+ "multiline": true,
1033
+ "trace_as_metadata": true,
1034
+ "load_from_db": false,
1035
+ "list": false,
1036
+ "list_add_label": "Add More",
1037
+ "required": false,
1038
+ "placeholder": "",
1039
+ "show": true,
1040
+ "name": "system_message",
1041
+ "value": "Hello! I'm your credit card assistant. 😊 Please choose one option by typing the number (1, 2, or 3): 1. Analyze Multiple Cards for a Specific Spend (I'll help you find the best card among your existing cards for a particular purchase) 2. Card Recommendation Based on Lifestyle (Share your spending habits, and I'll suggest the perfect card for you) 3. Compare Two Cards (I'll analyze and compare any two credit cards you're interested in) {input}",
1042
+ "display_name": "System Message",
1043
+ "advanced": false,
1044
+ "input_types": [
1045
+ "Message"
1046
+ ],
1047
+ "dynamic": false,
1048
+ "info": "System message to pass to the model.",
1049
+ "title_case": false,
1050
+ "type": "str",
1051
+ "_input_type": "MultilineInput"
1052
+ },
1053
+ "temperature": {
1054
+ "tool_mode": false,
1055
+ "min_label": "",
1056
+ "max_label": "",
1057
+ "min_label_icon": "",
1058
+ "max_label_icon": "",
1059
+ "slider_buttons": false,
1060
+ "slider_buttons_options": [],
1061
+ "slider_input": false,
1062
+ "range_spec": {
1063
+ "step_type": "float",
1064
+ "min": 0,
1065
+ "max": 1,
1066
+ "step": 0.01
1067
+ },
1068
+ "required": false,
1069
+ "placeholder": "",
1070
+ "show": true,
1071
+ "name": "temperature",
1072
+ "value": 0.1,
1073
+ "display_name": "Temperature",
1074
+ "advanced": false,
1075
+ "dynamic": false,
1076
+ "info": "",
1077
+ "title_case": false,
1078
+ "type": "slider",
1079
+ "_input_type": "SliderInput"
1080
+ },
1081
+ "timeout": {
1082
+ "tool_mode": false,
1083
+ "trace_as_metadata": true,
1084
+ "list": false,
1085
+ "list_add_label": "Add More",
1086
+ "required": false,
1087
+ "placeholder": "",
1088
+ "show": true,
1089
+ "name": "timeout",
1090
+ "value": 700,
1091
+ "display_name": "Timeout",
1092
+ "advanced": true,
1093
+ "dynamic": false,
1094
+ "info": "The timeout for requests to OpenAI completion API.",
1095
+ "title_case": false,
1096
+ "type": "int",
1097
+ "_input_type": "IntInput"
1098
+ }
1099
+ },
1100
+ "description": "Generates text using OpenAI LLMs.",
1101
+ "icon": "OpenAI",
1102
+ "base_classes": [
1103
+ "LanguageModel",
1104
+ "Message"
1105
+ ],
1106
+ "display_name": "OpenAI",
1107
+ "documentation": "",
1108
+ "minimized": false,
1109
+ "custom_fields": {},
1110
+ "output_types": [],
1111
+ "pinned": false,
1112
+ "conditional_paths": [],
1113
+ "frozen": false,
1114
+ "outputs": [
1115
+ {
1116
+ "types": [
1117
+ "Message"
1118
+ ],
1119
+ "selected": "Message",
1120
+ "name": "text_output",
1121
+ "hidden": null,
1122
+ "display_name": "Message",
1123
+ "method": "text_response",
1124
+ "value": "__UNDEFINED__",
1125
+ "cache": true,
1126
+ "required_inputs": [],
1127
+ "allows_loop": false,
1128
+ "tool_mode": true
1129
+ },
1130
+ {
1131
+ "types": [
1132
+ "LanguageModel"
1133
+ ],
1134
+ "selected": "LanguageModel",
1135
+ "name": "model_output",
1136
+ "hidden": null,
1137
+ "display_name": "Language Model",
1138
+ "method": "build_model",
1139
+ "value": "__UNDEFINED__",
1140
+ "cache": true,
1141
+ "required_inputs": [
1142
+ "api_key"
1143
+ ],
1144
+ "allows_loop": false,
1145
+ "tool_mode": true
1146
+ }
1147
+ ],
1148
+ "field_order": [
1149
+ "input_value",
1150
+ "system_message",
1151
+ "stream",
1152
+ "max_tokens",
1153
+ "model_kwargs",
1154
+ "json_mode",
1155
+ "model_name",
1156
+ "openai_api_base",
1157
+ "api_key",
1158
+ "temperature",
1159
+ "seed",
1160
+ "max_retries",
1161
+ "timeout"
1162
+ ],
1163
+ "beta": false,
1164
+ "legacy": false,
1165
+ "edited": false,
1166
+ "metadata": {},
1167
+ "tool_mode": false,
1168
+ "lf_version": "1.2.0"
1169
+ },
1170
+ "type": "OpenAIModel",
1171
+ "id": "OpenAIModel-F7Fug",
1172
+ "description": "Generates text using OpenAI LLMs.",
1173
+ "display_name": "OpenAI"
1174
+ },
1175
+ "selected": false,
1176
+ "width": 320,
1177
+ "height": 672,
1178
+ "positionAbsolute": {
1179
+ "x": 518.8176464736987,
1180
+ "y": 2.7400609718167743
1181
+ },
1182
+ "dragging": false,
1183
+ "measured": {
1184
+ "width": 320,
1185
+ "height": 672
1186
+ }
1187
+ }
1188
+ ],
1189
+ "edges": [
1190
+ {
1191
+ "source": "Prompt-9gd62",
1192
+ "sourceHandle": "{œdataTypeœ:œPromptœ,œidœ:œPrompt-9gd62œ,œnameœ:œpromptœ,œoutput_typesœ:[œMessageœ]}",
1193
+ "target": "OpenAIModel-F7Fug",
1194
+ "targetHandle": "{œfieldNameœ:œinput_valueœ,œidœ:œOpenAIModel-F7Fugœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",
1195
+ "data": {
1196
+ "targetHandle": {
1197
+ "fieldName": "input_value",
1198
+ "id": "OpenAIModel-F7Fug",
1199
+ "inputTypes": [
1200
+ "Message"
1201
+ ],
1202
+ "type": "str"
1203
+ },
1204
+ "sourceHandle": {
1205
+ "dataType": "Prompt",
1206
+ "id": "Prompt-9gd62",
1207
+ "name": "prompt",
1208
+ "output_types": [
1209
+ "Message"
1210
+ ]
1211
+ }
1212
+ },
1213
+ "id": "reactflow__edge-Prompt-9gd62{œdataTypeœ:œPromptœ,œidœ:œPrompt-9gd62œ,œnameœ:œpromptœ,œoutput_typesœ:[œMessageœ]}-OpenAIModel-F7Fug{œfieldNameœ:œinput_valueœ,œidœ:œOpenAIModel-F7Fugœ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",
1214
+ "className": "",
1215
+ "animated": false
1216
+ },
1217
+ {
1218
+ "source": "ChatInput-4qazp",
1219
+ "sourceHandle": "{œdataTypeœ:œChatInputœ,œidœ:œChatInput-4qazpœ,œnameœ:œmessageœ,œoutput_typesœ:[œMessageœ]}",
1220
+ "target": "Prompt-9gd62",
1221
+ "targetHandle": "{œfieldNameœ:œinputœ,œidœ:œPrompt-9gd62œ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",
1222
+ "data": {
1223
+ "targetHandle": {
1224
+ "fieldName": "input",
1225
+ "id": "Prompt-9gd62",
1226
+ "inputTypes": [
1227
+ "Message"
1228
+ ],
1229
+ "type": "str"
1230
+ },
1231
+ "sourceHandle": {
1232
+ "dataType": "ChatInput",
1233
+ "id": "ChatInput-4qazp",
1234
+ "name": "message",
1235
+ "output_types": [
1236
+ "Message"
1237
+ ]
1238
+ }
1239
+ },
1240
+ "id": "xy-edge__ChatInput-4qazp{œdataTypeœ:œChatInputœ,œidœ:œChatInput-4qazpœ,œnameœ:œmessageœ,œoutput_typesœ:[œMessageœ]}-Prompt-9gd62{œfieldNameœ:œinputœ,œidœ:œPrompt-9gd62œ,œinputTypesœ:[œMessageœ],œtypeœ:œstrœ}",
1241
+ "className": "",
1242
+ "animated": false
1243
+ },
1244
+ {
1245
+ "source": "OpenAIModel-F7Fug",
1246
+ "sourceHandle": "{œdataTypeœ:œOpenAIModelœ,œidœ:œOpenAIModel-F7Fugœ,œnameœ:œtext_outputœ,œoutput_typesœ:[œMessageœ]}",
1247
+ "target": "ChatOutput-MfwRT",
1248
+ "targetHandle": "{œfieldNameœ:œinput_valueœ,œidœ:œChatOutput-MfwRTœ,œinputTypesœ:[œDataœ,œDataFrameœ,œMessageœ],œtypeœ:œotherœ}",
1249
+ "data": {
1250
+ "targetHandle": {
1251
+ "fieldName": "input_value",
1252
+ "id": "ChatOutput-MfwRT",
1253
+ "inputTypes": [
1254
+ "Data",
1255
+ "DataFrame",
1256
+ "Message"
1257
+ ],
1258
+ "type": "other"
1259
+ },
1260
+ "sourceHandle": {
1261
+ "dataType": "OpenAIModel",
1262
+ "id": "OpenAIModel-F7Fug",
1263
+ "name": "text_output",
1264
+ "output_types": [
1265
+ "Message"
1266
+ ]
1267
+ }
1268
+ },
1269
+ "id": "xy-edge__OpenAIModel-F7Fug{œdataTypeœ:œOpenAIModelœ,œidœ:œOpenAIModel-F7Fugœ,œnameœ:œtext_outputœ,œoutput_typesœ:[œMessageœ]}-ChatOutput-MfwRT{œfieldNameœ:œinput_valueœ,œidœ:œChatOutput-MfwRTœ,œinputTypesœ:[œDataœ,œDataFrameœ,œMessageœ],œtypeœ:œotherœ}",
1270
+ "className": "",
1271
+ "animated": false
1272
+ }
1273
+ ],
1274
+ "viewport": {
1275
+ "x": 302.1603803711132,
1276
+ "y": 63.46009537552766,
1277
+ "zoom": 0.5342462159935901
1278
+ }
1279
+ },
1280
+ "updated_at": "2025-03-25T15:50:18+00:00",
1281
+ "icon": null,
1282
+ "name": "Credit Card",
1283
+ "icon_bg_color": null,
1284
+ "webhook": false
1285
+ }