Spaces:
Running
Running
fixing demos
Browse files
examples/LynxScribe Data Cleaning.lynxkite.json
CHANGED
@@ -19,20 +19,20 @@
|
|
19 |
"source": "Read Excel 1",
|
20 |
"sourceHandle": "output",
|
21 |
"target": "LynxScribe Task Solver 1",
|
22 |
-
"targetHandle": "
|
23 |
},
|
24 |
{
|
25 |
-
"id": "
|
26 |
-
"source": "
|
27 |
"sourceHandle": "output",
|
28 |
-
"target": "View DataFrame
|
29 |
"targetHandle": "input"
|
30 |
},
|
31 |
{
|
32 |
-
"id": "
|
33 |
-
"source": "
|
34 |
"sourceHandle": "output",
|
35 |
-
"target": "View DataFrame
|
36 |
"targetHandle": "input"
|
37 |
}
|
38 |
],
|
@@ -43,84 +43,122 @@
|
|
43 |
"__execution_delay": 0.0,
|
44 |
"collapsed": null,
|
45 |
"display": null,
|
46 |
-
"error":
|
47 |
"input_metadata": null,
|
48 |
"meta": {
|
49 |
-
"inputs": {
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
|
|
53 |
"type": {
|
54 |
-
"type": "
|
55 |
}
|
56 |
-
}
|
57 |
-
|
58 |
-
|
59 |
-
|
|
|
|
|
60 |
"type": {
|
61 |
-
"
|
62 |
}
|
63 |
},
|
64 |
-
"
|
65 |
-
"
|
66 |
-
"
|
67 |
"type": {
|
68 |
-
"
|
|
|
|
|
|
|
69 |
}
|
70 |
}
|
71 |
},
|
72 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
73 |
"outputs": {
|
74 |
"output": {
|
75 |
"name": "output",
|
76 |
-
"position": "
|
77 |
"type": {
|
78 |
"type": "None"
|
79 |
}
|
80 |
}
|
81 |
},
|
82 |
"params": {
|
83 |
-
"
|
84 |
-
"default":
|
85 |
-
"name": "
|
86 |
-
"type": {
|
87 |
-
"type": "<class 'str'>"
|
88 |
-
}
|
89 |
-
},
|
90 |
-
"llm_model_name": {
|
91 |
-
"default": "gpt-4o",
|
92 |
-
"name": "llm_model_name",
|
93 |
"type": {
|
94 |
-
"
|
95 |
}
|
96 |
},
|
97 |
-
"
|
98 |
-
"default":
|
99 |
-
"name": "
|
100 |
"type": {
|
101 |
-
"
|
|
|
|
|
|
|
102 |
}
|
103 |
}
|
104 |
},
|
|
|
|
|
|
|
|
|
105 |
"type": "basic"
|
106 |
},
|
107 |
"params": {
|
108 |
-
"
|
109 |
-
"
|
110 |
-
"new_column_names": "zip_code, country, state_or_county, city, district, street_name, house_number, floor, flat_number, additional_info"
|
111 |
},
|
112 |
"status": "done",
|
113 |
-
"title": "LynxScribe
|
114 |
},
|
115 |
"dragHandle": ".bg-primary",
|
116 |
-
"height":
|
117 |
-
"id": "LynxScribe
|
118 |
"position": {
|
119 |
-
"x":
|
120 |
-
"y":
|
121 |
},
|
122 |
"type": "basic",
|
123 |
-
"width":
|
124 |
},
|
125 |
{
|
126 |
"data": {
|
@@ -164,6 +202,10 @@
|
|
164 |
}
|
165 |
}
|
166 |
},
|
|
|
|
|
|
|
|
|
167 |
"type": "basic"
|
168 |
},
|
169 |
"params": {
|
@@ -175,14 +217,14 @@
|
|
175 |
"title": "Read Excel"
|
176 |
},
|
177 |
"dragHandle": ".bg-primary",
|
178 |
-
"height":
|
179 |
"id": "Read Excel 1",
|
180 |
"position": {
|
181 |
-
"x":
|
182 |
-
"y":
|
183 |
},
|
184 |
"type": "basic",
|
185 |
-
"width":
|
186 |
},
|
187 |
{
|
188 |
"data": {
|
@@ -192,111 +234,85 @@
|
|
192 |
"error": null,
|
193 |
"input_metadata": null,
|
194 |
"meta": {
|
195 |
-
"inputs": {
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
"name": "output",
|
200 |
-
"position": "top",
|
201 |
"type": {
|
202 |
-
"type": "
|
203 |
}
|
204 |
-
}
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
"default": null,
|
209 |
-
"name": "prompt_content",
|
210 |
"type": {
|
211 |
-
"
|
212 |
}
|
213 |
},
|
214 |
-
"
|
215 |
-
"
|
216 |
-
"
|
217 |
"type": {
|
218 |
-
"
|
219 |
-
"SYSTEM",
|
220 |
-
"USER"
|
221 |
-
]
|
222 |
}
|
223 |
}
|
224 |
},
|
225 |
-
"
|
226 |
-
},
|
227 |
-
"params": {
|
228 |
-
"prompt_content": "You are an AI assistant designed to clean and extract structured address information from raw text.\nYour goal is to identify and extract relevant address components while ignoring any unrelated information.\nThe output must be formatted as a structured dictionary.\n\nYour task is to parse an address from raw text and return a dictionary with the following keys:\n - zip_code: The postal or ZIP code.\n - country: The country name.\n - state_or_county: The state, province, or county (if applicable).\n - city: The city or town name.\n - district: The district or borough name (if mentioned).\n - street_type: The type of public space (e.g., street, avenue, boulevard, square).\n - street_name: The name of the public space (e.g., Main, Baker, Champs-\u00c9lys\u00e9es).\n - house_number: The house or building number.\n - floor: The floor number (if mentioned).\n - flat_number: The apartment or unit number (if mentioned).\n - additional_info: Any other useful details, such as building names, or known landmarks.\n\nIf any information is missing from the input, leave the corresponding key as an empty string.\n\nYou must return only a python dictionary with the following keys:\n`zip_code`, `country`, `state_or_county`, `city`, `district`, `street_name`, \n`house_number`, `floor`, `flat_number`, `additional_info`.\n\nDo not include any extra text, comments, or explanations\u2014only return the dictionary.",
|
229 |
-
"prompt_role": "SYSTEM"
|
230 |
-
},
|
231 |
-
"status": "done",
|
232 |
-
"title": "LynxScribe Message"
|
233 |
-
},
|
234 |
-
"dragHandle": ".bg-primary",
|
235 |
-
"height": 571.0,
|
236 |
-
"id": "LynxScribe Message 3",
|
237 |
-
"position": {
|
238 |
-
"x": 164.47629681808115,
|
239 |
-
"y": 558.211148839972
|
240 |
-
},
|
241 |
-
"type": "basic",
|
242 |
-
"width": 553.0
|
243 |
-
},
|
244 |
-
{
|
245 |
-
"data": {
|
246 |
-
"__execution_delay": 0.0,
|
247 |
-
"collapsed": null,
|
248 |
-
"display": null,
|
249 |
-
"error": null,
|
250 |
-
"input_metadata": null,
|
251 |
-
"meta": {
|
252 |
-
"inputs": {},
|
253 |
-
"name": "LynxScribe Message",
|
254 |
"outputs": {
|
255 |
"output": {
|
256 |
"name": "output",
|
257 |
-
"position": "
|
258 |
"type": {
|
259 |
"type": "None"
|
260 |
}
|
261 |
}
|
262 |
},
|
263 |
"params": {
|
264 |
-
"
|
265 |
-
"default":
|
266 |
-
"name": "
|
267 |
"type": {
|
268 |
-
"
|
269 |
}
|
270 |
},
|
271 |
-
"
|
272 |
-
"default":
|
273 |
-
"name": "
|
274 |
"type": {
|
275 |
-
"
|
276 |
-
|
277 |
-
|
278 |
-
|
|
|
|
|
|
|
|
|
279 |
}
|
280 |
}
|
281 |
},
|
|
|
|
|
|
|
|
|
282 |
"type": "basic"
|
283 |
},
|
284 |
"params": {
|
285 |
-
"
|
286 |
-
"
|
|
|
287 |
},
|
288 |
"status": "done",
|
289 |
-
"title": "LynxScribe
|
290 |
},
|
291 |
"dragHandle": ".bg-primary",
|
292 |
-
"height":
|
293 |
-
"id": "LynxScribe
|
294 |
"position": {
|
295 |
-
"x":
|
296 |
-
"y":
|
297 |
},
|
298 |
"type": "basic",
|
299 |
-
"width":
|
300 |
},
|
301 |
{
|
302 |
"data": {
|
@@ -304,29 +320,109 @@
|
|
304 |
"dataframes": {
|
305 |
"df": {
|
306 |
"columns": [
|
307 |
-
"message_parts"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
308 |
],
|
309 |
"data": [
|
310 |
[
|
311 |
-
"John's old apartment: 742 Evergreen Terrace, Springfield, IL 62704, USA. Call me at +1-555-1234 or email [email protected]."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
312 |
],
|
313 |
[
|
314 |
-
"Visit our office at 56B Baker Street, Marylebone, London W1U 8ED, UK. (Nearest Tube: Baker Street). Contact: [email protected]."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
],
|
316 |
[
|
317 |
-
"New residence: 300, 5th Avenue, New York, NY 10001, USA. Floor 12, Apt 1204. My new phone is (212) 555-6789."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
318 |
],
|
319 |
[
|
320 |
-
"We just moved to 23 rue de la Paix, 75002 Paris, France. Floor 3, Flat 5. Send mail to my old address instead."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
],
|
322 |
[
|
323 |
-
"Warehouse location: 1024 Industrial Blvd, Houston, TX 77002, USA. Not open on weekends. Customer support: [email protected]."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
324 |
],
|
325 |
[
|
326 |
-
"My grandma lives at 2F, 15-3 Shinjuku, Tokyo 160-0022, Japan. Don't use my old phone number anymore!"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
327 |
],
|
328 |
[
|
329 |
-
"Delivery address: Apt 9, 88 Queen's Road Central, Central, Hong Kong. Landmark: Opposite IFC Mall."
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
330 |
]
|
331 |
]
|
332 |
}
|
@@ -348,8 +444,8 @@
|
|
348 |
"outputs": {},
|
349 |
"params": {},
|
350 |
"position": {
|
351 |
-
"x":
|
352 |
-
"y":
|
353 |
},
|
354 |
"type": "table_view"
|
355 |
},
|
@@ -358,19 +454,50 @@
|
|
358 |
"title": "View DataFrame"
|
359 |
},
|
360 |
"dragHandle": ".bg-primary",
|
361 |
-
"height":
|
362 |
-
"id": "View DataFrame
|
363 |
"position": {
|
364 |
-
"x":
|
365 |
-
"y":
|
366 |
},
|
367 |
"type": "table_view",
|
368 |
-
"width":
|
369 |
},
|
370 |
{
|
371 |
"data": {
|
372 |
-
"display":
|
373 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
"input_metadata": null,
|
375 |
"meta": {
|
376 |
"inputs": {
|
@@ -386,8 +513,8 @@
|
|
386 |
"outputs": {},
|
387 |
"params": {},
|
388 |
"position": {
|
389 |
-
"x":
|
390 |
-
"y":
|
391 |
},
|
392 |
"type": "table_view"
|
393 |
},
|
@@ -397,10 +524,10 @@
|
|
397 |
},
|
398 |
"dragHandle": ".bg-primary",
|
399 |
"height": 200.0,
|
400 |
-
"id": "View DataFrame
|
401 |
"position": {
|
402 |
-
"x":
|
403 |
-
"y": -
|
404 |
},
|
405 |
"type": "table_view",
|
406 |
"width": 200.0
|
|
|
19 |
"source": "Read Excel 1",
|
20 |
"sourceHandle": "output",
|
21 |
"target": "LynxScribe Task Solver 1",
|
22 |
+
"targetHandle": "dataframe"
|
23 |
},
|
24 |
{
|
25 |
+
"id": "LynxScribe Task Solver 1 View DataFrame 1",
|
26 |
+
"source": "LynxScribe Task Solver 1",
|
27 |
"sourceHandle": "output",
|
28 |
+
"target": "View DataFrame 1",
|
29 |
"targetHandle": "input"
|
30 |
},
|
31 |
{
|
32 |
+
"id": "Read Excel 1 View DataFrame 2",
|
33 |
+
"source": "Read Excel 1",
|
34 |
"sourceHandle": "output",
|
35 |
+
"target": "View DataFrame 2",
|
36 |
"targetHandle": "input"
|
37 |
}
|
38 |
],
|
|
|
43 |
"__execution_delay": 0.0,
|
44 |
"collapsed": null,
|
45 |
"display": null,
|
46 |
+
"error": null,
|
47 |
"input_metadata": null,
|
48 |
"meta": {
|
49 |
+
"inputs": {},
|
50 |
+
"name": "LynxScribe Message",
|
51 |
+
"outputs": {
|
52 |
+
"output": {
|
53 |
+
"name": "output",
|
54 |
+
"position": "top",
|
55 |
"type": {
|
56 |
+
"type": "None"
|
57 |
}
|
58 |
+
}
|
59 |
+
},
|
60 |
+
"params": {
|
61 |
+
"prompt_content": {
|
62 |
+
"default": null,
|
63 |
+
"name": "prompt_content",
|
64 |
"type": {
|
65 |
+
"format": "textarea"
|
66 |
}
|
67 |
},
|
68 |
+
"prompt_role": {
|
69 |
+
"default": null,
|
70 |
+
"name": "prompt_role",
|
71 |
"type": {
|
72 |
+
"enum": [
|
73 |
+
"SYSTEM",
|
74 |
+
"USER"
|
75 |
+
]
|
76 |
}
|
77 |
}
|
78 |
},
|
79 |
+
"position": {
|
80 |
+
"x": 653.0,
|
81 |
+
"y": 954.0
|
82 |
+
},
|
83 |
+
"type": "basic"
|
84 |
+
},
|
85 |
+
"params": {
|
86 |
+
"prompt_content": "You are an AI assistant designed to clean and extract structured address information from raw text.\nYour goal is to identify and extract relevant address components while ignoring any unrelated information.\nThe output must be formatted as a structured dictionary.\n\nYour task is to parse an address from raw text and return a dictionary with the following keys:\n - zip_code: The postal or ZIP code.\n - country: The country name.\n - state_or_county: The state, province, or county (if applicable).\n - city: The city or town name.\n - district: The district or borough name (if mentioned).\n - street_type: The type of public space (e.g., street, avenue, boulevard, square).\n - street_name: The name of the public space (e.g., Main, Baker, Champs-\u00c9lys\u00e9es).\n - house_number: The house or building number.\n - floor: The floor number (if mentioned).\n - flat_number: The apartment or unit number (if mentioned).\n - additional_info: Any other useful details, such as building names, or known landmarks.\n\nIf any information is missing from the input, leave the corresponding key as an empty string.\n\nYou must return only a python dictionary with the following keys:\n`zip_code`, `country`, `state_or_county`, `city`, `district`, `street_name`, \n`house_number`, `floor`, `flat_number`, `additional_info`.\n\nDo not include any extra text, comments, or explanations\u2014only return the dictionary.",
|
87 |
+
"prompt_role": "SYSTEM"
|
88 |
+
},
|
89 |
+
"status": "done",
|
90 |
+
"title": "LynxScribe Message"
|
91 |
+
},
|
92 |
+
"dragHandle": ".bg-primary",
|
93 |
+
"height": 354.0,
|
94 |
+
"id": "LynxScribe Message 3",
|
95 |
+
"position": {
|
96 |
+
"x": 36.0,
|
97 |
+
"y": 569.0
|
98 |
+
},
|
99 |
+
"type": "basic",
|
100 |
+
"width": 740.0
|
101 |
+
},
|
102 |
+
{
|
103 |
+
"data": {
|
104 |
+
"__execution_delay": 0.0,
|
105 |
+
"collapsed": null,
|
106 |
+
"display": null,
|
107 |
+
"error": null,
|
108 |
+
"input_metadata": null,
|
109 |
+
"meta": {
|
110 |
+
"inputs": {},
|
111 |
+
"name": "LynxScribe Message",
|
112 |
"outputs": {
|
113 |
"output": {
|
114 |
"name": "output",
|
115 |
+
"position": "top",
|
116 |
"type": {
|
117 |
"type": "None"
|
118 |
}
|
119 |
}
|
120 |
},
|
121 |
"params": {
|
122 |
+
"prompt_content": {
|
123 |
+
"default": null,
|
124 |
+
"name": "prompt_content",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
"type": {
|
126 |
+
"format": "textarea"
|
127 |
}
|
128 |
},
|
129 |
+
"prompt_role": {
|
130 |
+
"default": null,
|
131 |
+
"name": "prompt_role",
|
132 |
"type": {
|
133 |
+
"enum": [
|
134 |
+
"SYSTEM",
|
135 |
+
"USER"
|
136 |
+
]
|
137 |
}
|
138 |
}
|
139 |
},
|
140 |
+
"position": {
|
141 |
+
"x": 1498.0,
|
142 |
+
"y": 660.0
|
143 |
+
},
|
144 |
"type": "basic"
|
145 |
},
|
146 |
"params": {
|
147 |
+
"prompt_content": "Extract structured address information from the following text: {message_parts}",
|
148 |
+
"prompt_role": "USER"
|
|
|
149 |
},
|
150 |
"status": "done",
|
151 |
+
"title": "LynxScribe Message"
|
152 |
},
|
153 |
"dragHandle": ".bg-primary",
|
154 |
+
"height": 347.0,
|
155 |
+
"id": "LynxScribe Message 1",
|
156 |
"position": {
|
157 |
+
"x": 817.0,
|
158 |
+
"y": 566.0
|
159 |
},
|
160 |
"type": "basic",
|
161 |
+
"width": 498.0
|
162 |
},
|
163 |
{
|
164 |
"data": {
|
|
|
202 |
}
|
203 |
}
|
204 |
},
|
205 |
+
"position": {
|
206 |
+
"x": 236.0,
|
207 |
+
"y": 150.0
|
208 |
+
},
|
209 |
"type": "basic"
|
210 |
},
|
211 |
"params": {
|
|
|
217 |
"title": "Read Excel"
|
218 |
},
|
219 |
"dragHandle": ".bg-primary",
|
220 |
+
"height": 284.0,
|
221 |
"id": "Read Excel 1",
|
222 |
"position": {
|
223 |
+
"x": 41.0,
|
224 |
+
"y": 168.0
|
225 |
},
|
226 |
"type": "basic",
|
227 |
+
"width": 332.0
|
228 |
},
|
229 |
{
|
230 |
"data": {
|
|
|
234 |
"error": null,
|
235 |
"input_metadata": null,
|
236 |
"meta": {
|
237 |
+
"inputs": {
|
238 |
+
"dataframe": {
|
239 |
+
"name": "dataframe",
|
240 |
+
"position": "left",
|
|
|
|
|
241 |
"type": {
|
242 |
+
"type": "<class 'inspect._empty'>"
|
243 |
}
|
244 |
+
},
|
245 |
+
"instruction_prompt": {
|
246 |
+
"name": "instruction_prompt",
|
247 |
+
"position": "bottom",
|
|
|
|
|
248 |
"type": {
|
249 |
+
"type": "<class 'inspect._empty'>"
|
250 |
}
|
251 |
},
|
252 |
+
"system_prompt": {
|
253 |
+
"name": "system_prompt",
|
254 |
+
"position": "bottom",
|
255 |
"type": {
|
256 |
+
"type": "<class 'inspect._empty'>"
|
|
|
|
|
|
|
257 |
}
|
258 |
}
|
259 |
},
|
260 |
+
"name": "LynxScribe Task Solver",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
"outputs": {
|
262 |
"output": {
|
263 |
"name": "output",
|
264 |
+
"position": "right",
|
265 |
"type": {
|
266 |
"type": "None"
|
267 |
}
|
268 |
}
|
269 |
},
|
270 |
"params": {
|
271 |
+
"llm_interface": {
|
272 |
+
"default": "openai",
|
273 |
+
"name": "llm_interface",
|
274 |
"type": {
|
275 |
+
"type": "<class 'str'>"
|
276 |
}
|
277 |
},
|
278 |
+
"llm_model_name": {
|
279 |
+
"default": "gpt-4o",
|
280 |
+
"name": "llm_model_name",
|
281 |
"type": {
|
282 |
+
"type": "<class 'str'>"
|
283 |
+
}
|
284 |
+
},
|
285 |
+
"new_column_names": {
|
286 |
+
"default": "processed_field",
|
287 |
+
"name": "new_column_names",
|
288 |
+
"type": {
|
289 |
+
"type": "<class 'str'>"
|
290 |
}
|
291 |
}
|
292 |
},
|
293 |
+
"position": {
|
294 |
+
"x": 1511.0,
|
295 |
+
"y": 220.0
|
296 |
+
},
|
297 |
"type": "basic"
|
298 |
},
|
299 |
"params": {
|
300 |
+
"llm_interface": "openai",
|
301 |
+
"llm_model_name": "gpt-4o-mini",
|
302 |
+
"new_column_names": "zip_code, country, state_or_county, city, district, street_name, house_number, floor, flat_number, additional_info"
|
303 |
},
|
304 |
"status": "done",
|
305 |
+
"title": "LynxScribe Task Solver"
|
306 |
},
|
307 |
"dragHandle": ".bg-primary",
|
308 |
+
"height": 282.0,
|
309 |
+
"id": "LynxScribe Task Solver 1",
|
310 |
"position": {
|
311 |
+
"x": 626.0,
|
312 |
+
"y": 170.0
|
313 |
},
|
314 |
"type": "basic",
|
315 |
+
"width": 272.0
|
316 |
},
|
317 |
{
|
318 |
"data": {
|
|
|
320 |
"dataframes": {
|
321 |
"df": {
|
322 |
"columns": [
|
323 |
+
"message_parts",
|
324 |
+
"zip_code",
|
325 |
+
"country",
|
326 |
+
"state_or_county",
|
327 |
+
"city",
|
328 |
+
"district",
|
329 |
+
"street_name",
|
330 |
+
"house_number",
|
331 |
+
"floor",
|
332 |
+
"flat_number",
|
333 |
+
"additional_info"
|
334 |
],
|
335 |
"data": [
|
336 |
[
|
337 |
+
"John's old apartment: 742 Evergreen Terrace, Springfield, IL 62704, USA. Call me at +1-555-1234 or email [email protected].",
|
338 |
+
"62704",
|
339 |
+
"USA",
|
340 |
+
"IL",
|
341 |
+
"Springfield",
|
342 |
+
"",
|
343 |
+
"Evergreen Terrace",
|
344 |
+
"742",
|
345 |
+
"",
|
346 |
+
"",
|
347 |
+
"John's old apartment"
|
348 |
],
|
349 |
[
|
350 |
+
"Visit our office at 56B Baker Street, Marylebone, London W1U 8ED, UK. (Nearest Tube: Baker Street). Contact: [email protected].",
|
351 |
+
"W1U 8ED",
|
352 |
+
"UK",
|
353 |
+
"",
|
354 |
+
"London",
|
355 |
+
"Marylebone",
|
356 |
+
"Baker",
|
357 |
+
"56B",
|
358 |
+
"",
|
359 |
+
"",
|
360 |
+
""
|
361 |
],
|
362 |
[
|
363 |
+
"New residence: 300, 5th Avenue, New York, NY 10001, USA. Floor 12, Apt 1204. My new phone is (212) 555-6789.",
|
364 |
+
"10001",
|
365 |
+
"USA",
|
366 |
+
"NY",
|
367 |
+
"New York",
|
368 |
+
"",
|
369 |
+
"5th Avenue",
|
370 |
+
"300",
|
371 |
+
"12",
|
372 |
+
"1204",
|
373 |
+
""
|
374 |
],
|
375 |
[
|
376 |
+
"We just moved to 23 rue de la Paix, 75002 Paris, France. Floor 3, Flat 5. Send mail to my old address instead.",
|
377 |
+
"75002",
|
378 |
+
"France",
|
379 |
+
"",
|
380 |
+
"Paris",
|
381 |
+
"",
|
382 |
+
"rue de la Paix",
|
383 |
+
"23",
|
384 |
+
"3",
|
385 |
+
"5",
|
386 |
+
""
|
387 |
],
|
388 |
[
|
389 |
+
"Warehouse location: 1024 Industrial Blvd, Houston, TX 77002, USA. Not open on weekends. Customer support: [email protected].",
|
390 |
+
"77002",
|
391 |
+
"USA",
|
392 |
+
"TX",
|
393 |
+
"Houston",
|
394 |
+
"",
|
395 |
+
"Industrial Blvd",
|
396 |
+
"1024",
|
397 |
+
"",
|
398 |
+
"",
|
399 |
+
"Warehouse location"
|
400 |
],
|
401 |
[
|
402 |
+
"My grandma lives at 2F, 15-3 Shinjuku, Tokyo 160-0022, Japan. Don't use my old phone number anymore!",
|
403 |
+
"160-0022",
|
404 |
+
"Japan",
|
405 |
+
"",
|
406 |
+
"Tokyo",
|
407 |
+
"Shinjuku",
|
408 |
+
"Shinjuku",
|
409 |
+
"15-3",
|
410 |
+
"2F",
|
411 |
+
"",
|
412 |
+
""
|
413 |
],
|
414 |
[
|
415 |
+
"Delivery address: Apt 9, 88 Queen's Road Central, Central, Hong Kong. Landmark: Opposite IFC Mall.",
|
416 |
+
"",
|
417 |
+
"Hong Kong",
|
418 |
+
"",
|
419 |
+
"Central",
|
420 |
+
"",
|
421 |
+
"Queen's Road Central",
|
422 |
+
"88",
|
423 |
+
"",
|
424 |
+
"9",
|
425 |
+
"Opposite IFC Mall"
|
426 |
]
|
427 |
]
|
428 |
}
|
|
|
444 |
"outputs": {},
|
445 |
"params": {},
|
446 |
"position": {
|
447 |
+
"x": 1719.0,
|
448 |
+
"y": 332.0
|
449 |
},
|
450 |
"type": "table_view"
|
451 |
},
|
|
|
454 |
"title": "View DataFrame"
|
455 |
},
|
456 |
"dragHandle": ".bg-primary",
|
457 |
+
"height": 316.0,
|
458 |
+
"id": "View DataFrame 1",
|
459 |
"position": {
|
460 |
+
"x": 1139.0,
|
461 |
+
"y": 91.0
|
462 |
},
|
463 |
"type": "table_view",
|
464 |
+
"width": 1118.0
|
465 |
},
|
466 |
{
|
467 |
"data": {
|
468 |
+
"display": {
|
469 |
+
"dataframes": {
|
470 |
+
"df": {
|
471 |
+
"columns": [
|
472 |
+
"message_parts"
|
473 |
+
],
|
474 |
+
"data": [
|
475 |
+
[
|
476 |
+
"John's old apartment: 742 Evergreen Terrace, Springfield, IL 62704, USA. Call me at +1-555-1234 or email [email protected]."
|
477 |
+
],
|
478 |
+
[
|
479 |
+
"Visit our office at 56B Baker Street, Marylebone, London W1U 8ED, UK. (Nearest Tube: Baker Street). Contact: [email protected]."
|
480 |
+
],
|
481 |
+
[
|
482 |
+
"New residence: 300, 5th Avenue, New York, NY 10001, USA. Floor 12, Apt 1204. My new phone is (212) 555-6789."
|
483 |
+
],
|
484 |
+
[
|
485 |
+
"We just moved to 23 rue de la Paix, 75002 Paris, France. Floor 3, Flat 5. Send mail to my old address instead."
|
486 |
+
],
|
487 |
+
[
|
488 |
+
"Warehouse location: 1024 Industrial Blvd, Houston, TX 77002, USA. Not open on weekends. Customer support: [email protected]."
|
489 |
+
],
|
490 |
+
[
|
491 |
+
"My grandma lives at 2F, 15-3 Shinjuku, Tokyo 160-0022, Japan. Don't use my old phone number anymore!"
|
492 |
+
],
|
493 |
+
[
|
494 |
+
"Delivery address: Apt 9, 88 Queen's Road Central, Central, Hong Kong. Landmark: Opposite IFC Mall."
|
495 |
+
]
|
496 |
+
]
|
497 |
+
}
|
498 |
+
}
|
499 |
+
},
|
500 |
+
"error": null,
|
501 |
"input_metadata": null,
|
502 |
"meta": {
|
503 |
"inputs": {
|
|
|
513 |
"outputs": {},
|
514 |
"params": {},
|
515 |
"position": {
|
516 |
+
"x": 1083.0,
|
517 |
+
"y": 134.0
|
518 |
},
|
519 |
"type": "table_view"
|
520 |
},
|
|
|
524 |
},
|
525 |
"dragHandle": ".bg-primary",
|
526 |
"height": 200.0,
|
527 |
+
"id": "View DataFrame 2",
|
528 |
"position": {
|
529 |
+
"x": 515.0,
|
530 |
+
"y": -135.125
|
531 |
},
|
532 |
"type": "table_view",
|
533 |
"width": 200.0
|
examples/LynxScribe Image Search.lynxkite.json
CHANGED
@@ -14,6 +14,13 @@
|
|
14 |
"target": "LynxScribe Image RAG Builder 1",
|
15 |
"targetHandle": "image_descriptions"
|
16 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
{
|
18 |
"id": "Input chat 1 LynxScribe Image RAG Query 1",
|
19 |
"source": "Input chat 1",
|
@@ -27,13 +34,6 @@
|
|
27 |
"sourceHandle": "output",
|
28 |
"target": "LynxScribe Image RAG Query 1",
|
29 |
"targetHandle": "rag_graph"
|
30 |
-
},
|
31 |
-
{
|
32 |
-
"id": "LynxScribe Image RAG Query 1 LynxScribe Image Result Viewer 1",
|
33 |
-
"source": "LynxScribe Image RAG Query 1",
|
34 |
-
"sourceHandle": "output",
|
35 |
-
"target": "LynxScribe Image Result Viewer 1",
|
36 |
-
"targetHandle": "embedding_similarities"
|
37 |
}
|
38 |
],
|
39 |
"env": "LynxScribe",
|
@@ -295,7 +295,7 @@
|
|
295 |
"type": "basic"
|
296 |
},
|
297 |
"params": {
|
298 |
-
"chat": "Show me a picture about
|
299 |
},
|
300 |
"status": "done",
|
301 |
"title": "Input chat"
|
@@ -312,6 +312,42 @@
|
|
312 |
},
|
313 |
{
|
314 |
"data": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
315 |
"display": null,
|
316 |
"error": null,
|
317 |
"input_metadata": null,
|
@@ -351,57 +387,27 @@
|
|
351 |
}
|
352 |
}
|
353 |
},
|
|
|
|
|
|
|
|
|
354 |
"type": "basic"
|
355 |
},
|
356 |
"params": {
|
357 |
-
"top_k":
|
358 |
},
|
359 |
"status": "done",
|
360 |
"title": "LynxScribe Image RAG Query"
|
361 |
},
|
362 |
"dragHandle": ".bg-primary",
|
363 |
-
"height":
|
364 |
"id": "LynxScribe Image RAG Query 1",
|
365 |
"position": {
|
366 |
-
"x":
|
367 |
-
"y": -
|
368 |
},
|
369 |
"type": "basic",
|
370 |
-
"width":
|
371 |
-
},
|
372 |
-
{
|
373 |
-
"data": {
|
374 |
-
"display": "https://storage.googleapis.com/lynxkite_public_data/lynxscribe-images/image-rag-test/food-405521_1280.jpg",
|
375 |
-
"error": null,
|
376 |
-
"input_metadata": null,
|
377 |
-
"meta": {
|
378 |
-
"inputs": {
|
379 |
-
"embedding_similarities": {
|
380 |
-
"name": "embedding_similarities",
|
381 |
-
"position": "left",
|
382 |
-
"type": {
|
383 |
-
"type": "<class 'inspect._empty'>"
|
384 |
-
}
|
385 |
-
}
|
386 |
-
},
|
387 |
-
"name": "LynxScribe Image Result Viewer",
|
388 |
-
"outputs": {},
|
389 |
-
"params": {},
|
390 |
-
"type": "image"
|
391 |
-
},
|
392 |
-
"params": {},
|
393 |
-
"status": "done",
|
394 |
-
"title": "LynxScribe Image Result Viewer"
|
395 |
-
},
|
396 |
-
"dragHandle": ".bg-primary",
|
397 |
-
"height": 515.0,
|
398 |
-
"id": "LynxScribe Image Result Viewer 1",
|
399 |
-
"position": {
|
400 |
-
"x": 1657.0,
|
401 |
-
"y": -193.0
|
402 |
-
},
|
403 |
-
"type": "image",
|
404 |
-
"width": 707.0
|
405 |
}
|
406 |
]
|
407 |
}
|
|
|
14 |
"target": "LynxScribe Image RAG Builder 1",
|
15 |
"targetHandle": "image_descriptions"
|
16 |
},
|
17 |
+
{
|
18 |
+
"id": "LynxScribe Image RAG Query 1 LynxScribe Image Result Viewer 1",
|
19 |
+
"source": "LynxScribe Image RAG Query 1",
|
20 |
+
"sourceHandle": "output",
|
21 |
+
"target": "LynxScribe Image Result Viewer 1",
|
22 |
+
"targetHandle": "embedding_similarities"
|
23 |
+
},
|
24 |
{
|
25 |
"id": "Input chat 1 LynxScribe Image RAG Query 1",
|
26 |
"source": "Input chat 1",
|
|
|
34 |
"sourceHandle": "output",
|
35 |
"target": "LynxScribe Image RAG Query 1",
|
36 |
"targetHandle": "rag_graph"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
}
|
38 |
],
|
39 |
"env": "LynxScribe",
|
|
|
295 |
"type": "basic"
|
296 |
},
|
297 |
"params": {
|
298 |
+
"chat": "Show me a picture about healthy lifestyle"
|
299 |
},
|
300 |
"status": "done",
|
301 |
"title": "Input chat"
|
|
|
312 |
},
|
313 |
{
|
314 |
"data": {
|
315 |
+
"display": "https://storage.googleapis.com/lynxkite_public_data/lynxscribe-images/image-rag-test/food-405521_1280.jpg",
|
316 |
+
"error": null,
|
317 |
+
"input_metadata": null,
|
318 |
+
"meta": {
|
319 |
+
"inputs": {
|
320 |
+
"embedding_similarities": {
|
321 |
+
"name": "embedding_similarities",
|
322 |
+
"position": "left",
|
323 |
+
"type": {
|
324 |
+
"type": "<class 'inspect._empty'>"
|
325 |
+
}
|
326 |
+
}
|
327 |
+
},
|
328 |
+
"name": "LynxScribe Image Result Viewer",
|
329 |
+
"outputs": {},
|
330 |
+
"params": {},
|
331 |
+
"type": "image"
|
332 |
+
},
|
333 |
+
"params": {},
|
334 |
+
"status": "done",
|
335 |
+
"title": "LynxScribe Image Result Viewer"
|
336 |
+
},
|
337 |
+
"dragHandle": ".bg-primary",
|
338 |
+
"height": 1008.0,
|
339 |
+
"id": "LynxScribe Image Result Viewer 1",
|
340 |
+
"position": {
|
341 |
+
"x": 1674.3708499095837,
|
342 |
+
"y": -254.88365280289335
|
343 |
+
},
|
344 |
+
"type": "image",
|
345 |
+
"width": 677.0
|
346 |
+
},
|
347 |
+
{
|
348 |
+
"data": {
|
349 |
+
"__execution_delay": 0.0,
|
350 |
+
"collapsed": null,
|
351 |
"display": null,
|
352 |
"error": null,
|
353 |
"input_metadata": null,
|
|
|
387 |
}
|
388 |
}
|
389 |
},
|
390 |
+
"position": {
|
391 |
+
"x": 1611.0,
|
392 |
+
"y": 353.0
|
393 |
+
},
|
394 |
"type": "basic"
|
395 |
},
|
396 |
"params": {
|
397 |
+
"top_k": "1"
|
398 |
},
|
399 |
"status": "done",
|
400 |
"title": "LynxScribe Image RAG Query"
|
401 |
},
|
402 |
"dragHandle": ".bg-primary",
|
403 |
+
"height": 212.0,
|
404 |
"id": "LynxScribe Image RAG Query 1",
|
405 |
"position": {
|
406 |
+
"x": 1106.0332007233271,
|
407 |
+
"y": -44.51280289330922
|
408 |
},
|
409 |
"type": "basic",
|
410 |
+
"width": 281.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
411 |
}
|
412 |
]
|
413 |
}
|
lynxkite-lynxscribe/src/lynxkite_lynxscribe/lynxscribe_ops.py
CHANGED
@@ -370,6 +370,10 @@ def ls_save_rag_graph(
|
|
370 |
@ops.input_position(rag_graph="bottom")
|
371 |
@op("LynxScribe Image RAG Query")
|
372 |
async def search_context(rag_graph, text, *, top_k=3):
|
|
|
|
|
|
|
|
|
373 |
message = text["text"]
|
374 |
rag_graph = rag_graph[0]["rag_graph"]
|
375 |
|
@@ -387,7 +391,9 @@ async def search_context(rag_graph, text, *, top_k=3):
|
|
387 |
description = emb_sim.embedding.document
|
388 |
result_list.append({"image_url": image_url, "score": score, "description": description})
|
389 |
|
390 |
-
|
|
|
|
|
391 |
|
392 |
|
393 |
@op("LynxScribe Image Result Viewer", view="image")
|
@@ -702,16 +708,16 @@ def read_excel(*, file_path: str, sheet_name: str = "Sheet1", columns: str = "")
|
|
702 |
if len(columns) == 0:
|
703 |
raise ValueError("No valid columns specified.")
|
704 |
df = df[columns].copy()
|
705 |
-
return
|
706 |
|
707 |
|
708 |
-
@ops.input_position(system_prompt="bottom", instruction_prompt="bottom",
|
709 |
@op("LynxScribe Task Solver")
|
710 |
@mem.cache
|
711 |
async def ls_task_solver(
|
712 |
system_prompt,
|
713 |
instruction_prompt,
|
714 |
-
|
715 |
*,
|
716 |
llm_interface: str = "openai",
|
717 |
llm_model_name: str = "gpt-4o",
|
@@ -728,6 +734,7 @@ async def ls_task_solver(
|
|
728 |
# handling inputs
|
729 |
system_message = system_prompt[0]["prompt_message"]
|
730 |
instruction_message = instruction_prompt[0]["prompt_message"]
|
|
|
731 |
|
732 |
# preparing output
|
733 |
out_df = df.copy()
|
@@ -783,7 +790,7 @@ async def ls_task_solver(
|
|
783 |
for i, col in enumerate(col_list):
|
784 |
out_df[col] = [answer[col] for answer in answers]
|
785 |
|
786 |
-
return
|
787 |
|
788 |
|
789 |
@output_on_top
|
@@ -835,7 +842,7 @@ def input_chat(*, chat: str):
|
|
835 |
@ops.input_position(input="bottom")
|
836 |
@op("View DataFrame", view="table_view")
|
837 |
def view_df(input):
|
838 |
-
df =
|
839 |
v = {
|
840 |
"dataframes": {
|
841 |
"df": {
|
|
|
370 |
@ops.input_position(rag_graph="bottom")
|
371 |
@op("LynxScribe Image RAG Query")
|
372 |
async def search_context(rag_graph, text, *, top_k=3):
|
373 |
+
"""
|
374 |
+
top_k: which results we are showing (TODO: when the image viewer is
|
375 |
+
updated w pager, change back to top k)
|
376 |
+
"""
|
377 |
message = text["text"]
|
378 |
rag_graph = rag_graph[0]["rag_graph"]
|
379 |
|
|
|
391 |
description = emb_sim.embedding.document
|
392 |
result_list.append({"image_url": image_url, "score": score, "description": description})
|
393 |
|
394 |
+
real_k = min(top_k, len(result_list) - 1)
|
395 |
+
|
396 |
+
return {"embedding_similarities": [result_list[real_k]]}
|
397 |
|
398 |
|
399 |
@op("LynxScribe Image Result Viewer", view="image")
|
|
|
708 |
if len(columns) == 0:
|
709 |
raise ValueError("No valid columns specified.")
|
710 |
df = df[columns].copy()
|
711 |
+
return {"dataframe": df}
|
712 |
|
713 |
|
714 |
+
@ops.input_position(system_prompt="bottom", instruction_prompt="bottom", dataframe="left")
|
715 |
@op("LynxScribe Task Solver")
|
716 |
@mem.cache
|
717 |
async def ls_task_solver(
|
718 |
system_prompt,
|
719 |
instruction_prompt,
|
720 |
+
dataframe,
|
721 |
*,
|
722 |
llm_interface: str = "openai",
|
723 |
llm_model_name: str = "gpt-4o",
|
|
|
734 |
# handling inputs
|
735 |
system_message = system_prompt[0]["prompt_message"]
|
736 |
instruction_message = instruction_prompt[0]["prompt_message"]
|
737 |
+
df = dataframe["dataframe"]
|
738 |
|
739 |
# preparing output
|
740 |
out_df = df.copy()
|
|
|
790 |
for i, col in enumerate(col_list):
|
791 |
out_df[col] = [answer[col] for answer in answers]
|
792 |
|
793 |
+
return {"dataframe": out_df}
|
794 |
|
795 |
|
796 |
@output_on_top
|
|
|
842 |
@ops.input_position(input="bottom")
|
843 |
@op("View DataFrame", view="table_view")
|
844 |
def view_df(input):
|
845 |
+
df = input[0]["dataframe"]
|
846 |
v = {
|
847 |
"dataframes": {
|
848 |
"df": {
|