satif-ai 0.2.6__tar.gz → 0.2.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {satif_ai-0.2.6 → satif_ai-0.2.7}/PKG-INFO +1 -1
- {satif_ai-0.2.6 → satif_ai-0.2.7}/pyproject.toml +1 -1
- {satif_ai-0.2.6 → satif_ai-0.2.7}/satif_ai/code_builders/transformation.py +43 -4
- {satif_ai-0.2.6 → satif_ai-0.2.7}/LICENSE +0 -0
- {satif_ai-0.2.6 → satif_ai-0.2.7}/README.md +0 -0
- {satif_ai-0.2.6 → satif_ai-0.2.7}/satif_ai/__init__.py +0 -0
- {satif_ai-0.2.6 → satif_ai-0.2.7}/satif_ai/adapters/__init__.py +0 -0
- {satif_ai-0.2.6 → satif_ai-0.2.7}/satif_ai/adapters/tidy.py +0 -0
- {satif_ai-0.2.6 → satif_ai-0.2.7}/satif_ai/code_builders/__init__.py +0 -0
- {satif_ai-0.2.6 → satif_ai-0.2.7}/satif_ai/code_builders/adaptation.py +0 -0
- {satif_ai-0.2.6 → satif_ai-0.2.7}/satif_ai/plot_builders/__init__.py +0 -0
- {satif_ai-0.2.6 → satif_ai-0.2.7}/satif_ai/plot_builders/agent.py +0 -0
- {satif_ai-0.2.6 → satif_ai-0.2.7}/satif_ai/plot_builders/prompt.py +0 -0
- {satif_ai-0.2.6 → satif_ai-0.2.7}/satif_ai/plot_builders/tool.py +0 -0
- {satif_ai-0.2.6 → satif_ai-0.2.7}/satif_ai/standardizers/__init__.py +0 -0
- {satif_ai-0.2.6 → satif_ai-0.2.7}/satif_ai/standardizers/ai_csv.py +0 -0
@@ -19,6 +19,37 @@ OUTPUT_TARGET_FILES: Optional[Dict[Union[str, Path], str]] = None
|
|
19
19
|
SCHEMA_ONLY: Optional[bool] = None
|
20
20
|
|
21
21
|
|
22
|
+
def _format_comparison_output(
|
23
|
+
comparison_result: Dict[str, Any],
|
24
|
+
schema_only_mode: Optional[bool],
|
25
|
+
source_file_display_name: str,
|
26
|
+
target_file_display_name: str,
|
27
|
+
) -> str:
|
28
|
+
"""
|
29
|
+
Formats the comparison result string, with special handling for schema_only mode
|
30
|
+
where files are equivalent due to being empty.
|
31
|
+
"""
|
32
|
+
base_message_prefix = f"Comparison for {source_file_display_name} [SOURCE] with {target_file_display_name} [TARGET]:"
|
33
|
+
|
34
|
+
if schema_only_mode is True and comparison_result.get("are_equivalent") is True:
|
35
|
+
details = comparison_result.get("details", {})
|
36
|
+
row_comparison = details.get("row_comparison", {})
|
37
|
+
|
38
|
+
row_count1 = row_comparison.get("row_count1")
|
39
|
+
row_count2 = row_comparison.get("row_count2")
|
40
|
+
|
41
|
+
if (
|
42
|
+
isinstance(row_count1, (int, float))
|
43
|
+
and row_count1 == 0
|
44
|
+
and isinstance(row_count2, (int, float))
|
45
|
+
and row_count2 == 0
|
46
|
+
):
|
47
|
+
return f"{base_message_prefix} Files have the same headers but are both empty (no data rows). This should not happen. Please verify the instructions and try again."
|
48
|
+
|
49
|
+
# Default formatting if the special condition isn't met
|
50
|
+
return f"{base_message_prefix} {comparison_result}"
|
51
|
+
|
52
|
+
|
22
53
|
@function_tool
|
23
54
|
async def execute_transformation(code: str) -> str:
|
24
55
|
"""Executes the transformation code on the input and returns the
|
@@ -54,9 +85,13 @@ async def execute_transformation(code: str) -> str:
|
|
54
85
|
comparison = comparator.compare(
|
55
86
|
generated_file_path, output_base_file, **comparator_kwargs
|
56
87
|
)
|
57
|
-
|
58
|
-
|
88
|
+
formatted_message = _format_comparison_output(
|
89
|
+
comparison,
|
90
|
+
SCHEMA_ONLY,
|
91
|
+
generated_file_path,
|
92
|
+
output_target_file_name,
|
59
93
|
)
|
94
|
+
comparisons.append(formatted_message)
|
60
95
|
else:
|
61
96
|
comparisons.append(
|
62
97
|
f"Error: {output_target_file_name} not found in the generated output"
|
@@ -70,9 +105,13 @@ async def execute_transformation(code: str) -> str:
|
|
70
105
|
comparison = comparator.compare(
|
71
106
|
generated_output_path, output_file, **comparator_kwargs
|
72
107
|
)
|
73
|
-
|
74
|
-
|
108
|
+
formatted_message = _format_comparison_output(
|
109
|
+
comparison,
|
110
|
+
SCHEMA_ONLY,
|
111
|
+
str(generated_output_path),
|
112
|
+
output_target_file_name,
|
75
113
|
)
|
114
|
+
comparisons.append(formatted_message)
|
76
115
|
else:
|
77
116
|
comparisons.append(
|
78
117
|
"Error: Single output file generated but multiple target files expected"
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|