Spaces:
Running
Running
Fix "View DataFrame".
Browse files
examples/LynxScribe Data Cleaning.lynxkite.json
CHANGED
@@ -1,32 +1,39 @@
|
|
1 |
{
|
2 |
"edges": [
|
3 |
{
|
4 |
-
"id": "LynxScribe
|
5 |
-
"source": "LynxScribe
|
6 |
"sourceHandle": "output",
|
7 |
-
"target": "
|
8 |
-
"targetHandle": "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
},
|
10 |
{
|
11 |
"id": "Read Excel 1 LynxScribe Task Solver 1",
|
12 |
"source": "Read Excel 1",
|
13 |
"sourceHandle": "output",
|
14 |
"target": "LynxScribe Task Solver 1",
|
15 |
-
"targetHandle": "
|
16 |
},
|
17 |
{
|
18 |
-
"id": "
|
19 |
-
"source": "
|
20 |
"sourceHandle": "output",
|
21 |
-
"target": "
|
22 |
-
"targetHandle": "
|
23 |
},
|
24 |
{
|
25 |
-
"id": "LynxScribe
|
26 |
-
"source": "LynxScribe
|
27 |
"sourceHandle": "output",
|
28 |
-
"target": "
|
29 |
-
"targetHandle": "
|
30 |
}
|
31 |
],
|
32 |
"env": "LynxScribe",
|
@@ -36,12 +43,12 @@
|
|
36 |
"__execution_delay": 0.0,
|
37 |
"collapsed": null,
|
38 |
"display": null,
|
39 |
-
"error":
|
40 |
"input_metadata": null,
|
41 |
"meta": {
|
42 |
"inputs": {
|
43 |
-
"
|
44 |
-
"name": "
|
45 |
"position": "left",
|
46 |
"type": {
|
47 |
"type": "<class 'inspect._empty'>"
|
@@ -106,52 +113,14 @@
|
|
106 |
"title": "LynxScribe Task Solver"
|
107 |
},
|
108 |
"dragHandle": ".bg-primary",
|
109 |
-
"height":
|
110 |
"id": "LynxScribe Task Solver 1",
|
111 |
"position": {
|
112 |
-
"x":
|
113 |
-
"y":
|
114 |
},
|
115 |
"type": "basic",
|
116 |
-
"width":
|
117 |
-
},
|
118 |
-
{
|
119 |
-
"data": {
|
120 |
-
"display": null,
|
121 |
-
"error": null,
|
122 |
-
"input_metadata": null,
|
123 |
-
"meta": {
|
124 |
-
"inputs": {
|
125 |
-
"input": {
|
126 |
-
"name": "input",
|
127 |
-
"position": "left",
|
128 |
-
"type": {
|
129 |
-
"type": "<class 'inspect._empty'>"
|
130 |
-
}
|
131 |
-
}
|
132 |
-
},
|
133 |
-
"name": "View DataFrame",
|
134 |
-
"outputs": {},
|
135 |
-
"params": {},
|
136 |
-
"position": {
|
137 |
-
"x": 2162.0,
|
138 |
-
"y": 266.0
|
139 |
-
},
|
140 |
-
"type": "table_view"
|
141 |
-
},
|
142 |
-
"params": {},
|
143 |
-
"status": "done",
|
144 |
-
"title": "View DataFrame"
|
145 |
-
},
|
146 |
-
"dragHandle": ".bg-primary",
|
147 |
-
"height": 309.0,
|
148 |
-
"id": "View DataFrame 1",
|
149 |
-
"position": {
|
150 |
-
"x": 1350.0,
|
151 |
-
"y": 210.0
|
152 |
-
},
|
153 |
-
"type": "table_view",
|
154 |
-
"width": 662.0
|
155 |
},
|
156 |
{
|
157 |
"data": {
|
@@ -195,10 +164,6 @@
|
|
195 |
}
|
196 |
}
|
197 |
},
|
198 |
-
"position": {
|
199 |
-
"x": 429.0,
|
200 |
-
"y": 234.0
|
201 |
-
},
|
202 |
"type": "basic"
|
203 |
},
|
204 |
"params": {
|
@@ -213,8 +178,8 @@
|
|
213 |
"height": 296.0,
|
214 |
"id": "Read Excel 1",
|
215 |
"position": {
|
216 |
-
"x":
|
217 |
-
"y":
|
218 |
},
|
219 |
"type": "basic",
|
220 |
"width": 400.0
|
@@ -257,28 +222,24 @@
|
|
257 |
}
|
258 |
}
|
259 |
},
|
260 |
-
"position": {
|
261 |
-
"x": 653.0,
|
262 |
-
"y": 954.0
|
263 |
-
},
|
264 |
"type": "basic"
|
265 |
},
|
266 |
"params": {
|
267 |
"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.",
|
268 |
-
"prompt_role":
|
269 |
},
|
270 |
"status": "done",
|
271 |
"title": "LynxScribe Message"
|
272 |
},
|
273 |
"dragHandle": ".bg-primary",
|
274 |
-
"height":
|
275 |
"id": "LynxScribe Message 3",
|
276 |
"position": {
|
277 |
-
"x":
|
278 |
-
"y":
|
279 |
},
|
280 |
"type": "basic",
|
281 |
-
"width":
|
282 |
},
|
283 |
{
|
284 |
"data": {
|
@@ -318,10 +279,6 @@
|
|
318 |
}
|
319 |
}
|
320 |
},
|
321 |
-
"position": {
|
322 |
-
"x": 1498.0,
|
323 |
-
"y": 660.0
|
324 |
-
},
|
325 |
"type": "basic"
|
326 |
},
|
327 |
"params": {
|
@@ -335,11 +292,118 @@
|
|
335 |
"height": 347.0,
|
336 |
"id": "LynxScribe Message 1",
|
337 |
"position": {
|
338 |
-
"x":
|
339 |
-
"y":
|
340 |
},
|
341 |
"type": "basic",
|
342 |
"width": 498.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
}
|
344 |
]
|
345 |
}
|
|
|
1 |
{
|
2 |
"edges": [
|
3 |
{
|
4 |
+
"id": "LynxScribe Message 3 LynxScribe Task Solver 1",
|
5 |
+
"source": "LynxScribe Message 3",
|
6 |
"sourceHandle": "output",
|
7 |
+
"target": "LynxScribe Task Solver 1",
|
8 |
+
"targetHandle": "system_prompt"
|
9 |
+
},
|
10 |
+
{
|
11 |
+
"id": "LynxScribe Message 1 LynxScribe Task Solver 1",
|
12 |
+
"source": "LynxScribe Message 1",
|
13 |
+
"sourceHandle": "output",
|
14 |
+
"target": "LynxScribe Task Solver 1",
|
15 |
+
"targetHandle": "instruction_prompt"
|
16 |
},
|
17 |
{
|
18 |
"id": "Read Excel 1 LynxScribe Task Solver 1",
|
19 |
"source": "Read Excel 1",
|
20 |
"sourceHandle": "output",
|
21 |
"target": "LynxScribe Task Solver 1",
|
22 |
+
"targetHandle": "df"
|
23 |
},
|
24 |
{
|
25 |
+
"id": "Read Excel 1 View DataFrame 3",
|
26 |
+
"source": "Read Excel 1",
|
27 |
"sourceHandle": "output",
|
28 |
+
"target": "View DataFrame 3",
|
29 |
+
"targetHandle": "input"
|
30 |
},
|
31 |
{
|
32 |
+
"id": "LynxScribe Task Solver 1 View DataFrame 1",
|
33 |
+
"source": "LynxScribe Task Solver 1",
|
34 |
"sourceHandle": "output",
|
35 |
+
"target": "View DataFrame 1",
|
36 |
+
"targetHandle": "input"
|
37 |
}
|
38 |
],
|
39 |
"env": "LynxScribe",
|
|
|
43 |
"__execution_delay": 0.0,
|
44 |
"collapsed": null,
|
45 |
"display": null,
|
46 |
+
"error": "'dict' object has no attribute 'columns'",
|
47 |
"input_metadata": null,
|
48 |
"meta": {
|
49 |
"inputs": {
|
50 |
+
"df": {
|
51 |
+
"name": "df",
|
52 |
"position": "left",
|
53 |
"type": {
|
54 |
"type": "<class 'inspect._empty'>"
|
|
|
113 |
"title": "LynxScribe Task Solver"
|
114 |
},
|
115 |
"dragHandle": ".bg-primary",
|
116 |
+
"height": 338.0,
|
117 |
"id": "LynxScribe Task Solver 1",
|
118 |
"position": {
|
119 |
+
"x": 552.5716888887608,
|
120 |
+
"y": 116.75102499949588
|
121 |
},
|
122 |
"type": "basic",
|
123 |
+
"width": 475.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
},
|
125 |
{
|
126 |
"data": {
|
|
|
164 |
}
|
165 |
}
|
166 |
},
|
|
|
|
|
|
|
|
|
167 |
"type": "basic"
|
168 |
},
|
169 |
"params": {
|
|
|
178 |
"height": 296.0,
|
179 |
"id": "Read Excel 1",
|
180 |
"position": {
|
181 |
+
"x": -334.4711428397128,
|
182 |
+
"y": 205.45080205004612
|
183 |
},
|
184 |
"type": "basic",
|
185 |
"width": 400.0
|
|
|
222 |
}
|
223 |
}
|
224 |
},
|
|
|
|
|
|
|
|
|
225 |
"type": "basic"
|
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": {
|
|
|
279 |
}
|
280 |
}
|
281 |
},
|
|
|
|
|
|
|
|
|
282 |
"type": "basic"
|
283 |
},
|
284 |
"params": {
|
|
|
292 |
"height": 347.0,
|
293 |
"id": "LynxScribe Message 1",
|
294 |
"position": {
|
295 |
+
"x": 972.1851717027744,
|
296 |
+
"y": 595.0972196942703
|
297 |
},
|
298 |
"type": "basic",
|
299 |
"width": 498.0
|
300 |
+
},
|
301 |
+
{
|
302 |
+
"data": {
|
303 |
+
"display": {
|
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 |
+
}
|
333 |
+
}
|
334 |
+
},
|
335 |
+
"error": null,
|
336 |
+
"input_metadata": null,
|
337 |
+
"meta": {
|
338 |
+
"inputs": {
|
339 |
+
"input": {
|
340 |
+
"name": "input",
|
341 |
+
"position": "bottom",
|
342 |
+
"type": {
|
343 |
+
"type": "<class 'inspect._empty'>"
|
344 |
+
}
|
345 |
+
}
|
346 |
+
},
|
347 |
+
"name": "View DataFrame",
|
348 |
+
"outputs": {},
|
349 |
+
"params": {},
|
350 |
+
"position": {
|
351 |
+
"x": 509.0,
|
352 |
+
"y": 333.0
|
353 |
+
},
|
354 |
+
"type": "table_view"
|
355 |
+
},
|
356 |
+
"params": {},
|
357 |
+
"status": "done",
|
358 |
+
"title": "View DataFrame"
|
359 |
+
},
|
360 |
+
"dragHandle": ".bg-primary",
|
361 |
+
"height": 200.0,
|
362 |
+
"id": "View DataFrame 3",
|
363 |
+
"position": {
|
364 |
+
"x": 103.41814621957258,
|
365 |
+
"y": -51.67901479134021
|
366 |
+
},
|
367 |
+
"type": "table_view",
|
368 |
+
"width": 200.0
|
369 |
+
},
|
370 |
+
{
|
371 |
+
"data": {
|
372 |
+
"display": null,
|
373 |
+
"error": "input is missing",
|
374 |
+
"input_metadata": null,
|
375 |
+
"meta": {
|
376 |
+
"inputs": {
|
377 |
+
"input": {
|
378 |
+
"name": "input",
|
379 |
+
"position": "bottom",
|
380 |
+
"type": {
|
381 |
+
"type": "<class 'inspect._empty'>"
|
382 |
+
}
|
383 |
+
}
|
384 |
+
},
|
385 |
+
"name": "View DataFrame",
|
386 |
+
"outputs": {},
|
387 |
+
"params": {},
|
388 |
+
"position": {
|
389 |
+
"x": 1012.0,
|
390 |
+
"y": 194.0
|
391 |
+
},
|
392 |
+
"type": "table_view"
|
393 |
+
},
|
394 |
+
"params": {},
|
395 |
+
"status": "done",
|
396 |
+
"title": "View DataFrame"
|
397 |
+
},
|
398 |
+
"dragHandle": ".bg-primary",
|
399 |
+
"height": 200.0,
|
400 |
+
"id": "View DataFrame 1",
|
401 |
+
"position": {
|
402 |
+
"x": 1343.9738575285708,
|
403 |
+
"y": -27.16272859910062
|
404 |
+
},
|
405 |
+
"type": "table_view",
|
406 |
+
"width": 200.0
|
407 |
}
|
408 |
]
|
409 |
}
|
lynxkite-lynxscribe/src/lynxkite_lynxscribe/lynxscribe_ops.py
CHANGED
@@ -832,25 +832,18 @@ def input_chat(*, chat: str):
|
|
832 |
return {"text": chat}
|
833 |
|
834 |
|
|
|
835 |
@op("View DataFrame", view="table_view")
|
836 |
-
def view_df(input
|
837 |
-
|
838 |
-
|
839 |
-
|
840 |
-
|
841 |
-
|
842 |
-
|
843 |
-
v["dataframes"]["df"]["data"].append([input[c] for c in columns])
|
844 |
-
else:
|
845 |
-
columns = [str(c) for c in input.keys() if not str(c).startswith("_")]
|
846 |
-
v = {
|
847 |
-
"dataframes": {
|
848 |
-
"df": {
|
849 |
-
"columns": columns,
|
850 |
-
"data": [[input[c] for c in columns]],
|
851 |
-
}
|
852 |
}
|
853 |
}
|
|
|
854 |
return v
|
855 |
|
856 |
|
|
|
832 |
return {"text": chat}
|
833 |
|
834 |
|
835 |
+
@ops.input_position(input="bottom")
|
836 |
@op("View DataFrame", view="table_view")
|
837 |
+
def view_df(input):
|
838 |
+
df = pd.DataFrame(input)
|
839 |
+
v = {
|
840 |
+
"dataframes": {
|
841 |
+
"df": {
|
842 |
+
"columns": [str(c) for c in df.columns],
|
843 |
+
"data": df.values.tolist(),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
844 |
}
|
845 |
}
|
846 |
+
}
|
847 |
return v
|
848 |
|
849 |
|