-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdata_processing.yaml
More file actions
161 lines (139 loc) · 4.46 KB
/
Copy pathdata_processing.yaml
File metadata and controls
161 lines (139 loc) · 4.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
id: data-processing
name: Data Processing Pipeline
description: Process and validate data from various sources
parameters:
data_source:
type: string
required: false
default: "examples/test_data/sample_data.json"
description: Path to data file (CSV or JSON)
output_format:
type: string
default: json
description: Output format (json, csv, or yaml)
output_path:
type: string
default: "examples/outputs/data_processing"
description: Directory where output files will be saved
steps:
- id: load_data
tool: filesystem
action: read
parameters:
path: "{{ data_source }}"
- id: parse_data
action: generate_text
parameters:
prompt: |
Parse this data and identify its structure:
{{ load_data }}
Return ONLY one word: "json" if it's JSON, "csv" if it's CSV, or "unknown" if unclear.
model: <AUTO task="parse">Select a model for parsing</AUTO>
max_tokens: 10
dependencies:
- load_data
- id: validate_data
tool: validation
action: validate
parameters:
data: "{{ load_data.result.content }}"
schema:
type: object
properties:
records:
type: array
items:
type: object
properties:
id:
type: integer
name:
type: string
active:
type: boolean
required: ["id", "name"]
validation_level: permissive
dependencies:
- parse_data
- id: transform_data
tool: data-processing
action: transform
parameters:
data: "{{ load_data.result.content }}"
operation:
transformations:
- type: filter
field: active
value: true
- type: aggregate
operation: sum
field: value
dependencies:
- validate_data
- id: format_results
action: generate_text
parameters:
prompt: |
Convert this data to clean JSON format:
{{ transform_data }}
Return ONLY valid JSON without any markdown formatting, code fences, or explanations.
Do NOT include ```json or ``` markers.
Start directly with { and end with }
model: <AUTO task="format">Select a model for formatting</AUTO>
max_tokens: 500
dependencies:
- transform_data
- id: save_results
tool: filesystem
action: write
parameters:
path: "{{ output_path }}/processed_data.{{ output_format }}"
content: "{{ format_results }}"
dependencies:
- format_results
- id: generate_summary
action: generate_text
parameters:
prompt: |
Generate a brief processing summary based on:
- Original data: {{ load_data }}
- Validation result: {{ validate_data }}
- Transformed data: {{ transform_data }}
Include:
- Number of records processed
- Validation status
- Transformation applied
Keep it concise (3-4 lines).
model: <AUTO task="summary">Select a model for summary</AUTO>
max_tokens: 150
dependencies:
- transform_data
- id: save_report
tool: filesystem
action: write
parameters:
path: "{{ output_path }}/processing_report.md"
content: |
# Data Processing Report
**Source File:** {{ data_source }}
**Output Format:** {{ output_format }}
## Validation Results
- Validation Status: {% if validate_data.valid %}Passed{% else %}Failed{% endif %}
- Errors: {% if validate_data.errors %}{{ validate_data.errors | length }} errors found{% else %}None{% endif %}
- Warnings: {% if validate_data.warnings %}{{ validate_data.warnings | length }} warnings{% else %}None{% endif %}
## Processing Summary
{{ generate_summary }}
## Output Details
- Transformed data saved to: {{ output_path }}/processed_data.{{ output_format }}
- Report generated at: {{ output_path }}/processing_report.md
---
*Generated by Data Processing Pipeline*
dependencies:
- save_results
- generate_summary
outputs:
original_data: "{{ load_data }}"
validated: "{{ validate_data.valid }}"
transformed: "{{ transform_data }}"
output_file: "{{ output_path }}/processed_data.{{ output_format }}"
summary: "{{ generate_summary }}"