ds-agent-cli 0.1.0
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.
- package/bin/ds-agent.js +451 -0
- package/ds_agent/__init__.py +8 -0
- package/package.json +28 -0
- package/requirements.txt +126 -0
- package/setup.py +35 -0
- package/src/__init__.py +7 -0
- package/src/_compress_tool_result.py +118 -0
- package/src/api/__init__.py +4 -0
- package/src/api/app.py +1626 -0
- package/src/cache/__init__.py +5 -0
- package/src/cache/cache_manager.py +561 -0
- package/src/cli.py +2886 -0
- package/src/dynamic_prompts.py +281 -0
- package/src/orchestrator.py +4799 -0
- package/src/progress_manager.py +139 -0
- package/src/reasoning/__init__.py +332 -0
- package/src/reasoning/business_summary.py +431 -0
- package/src/reasoning/data_understanding.py +356 -0
- package/src/reasoning/model_explanation.py +383 -0
- package/src/reasoning/reasoning_trace.py +239 -0
- package/src/registry/__init__.py +3 -0
- package/src/registry/tools_registry.py +3 -0
- package/src/session_memory.py +448 -0
- package/src/session_store.py +370 -0
- package/src/storage/__init__.py +19 -0
- package/src/storage/artifact_store.py +620 -0
- package/src/storage/helpers.py +116 -0
- package/src/storage/huggingface_storage.py +694 -0
- package/src/storage/r2_storage.py +0 -0
- package/src/storage/user_files_service.py +288 -0
- package/src/tools/__init__.py +335 -0
- package/src/tools/advanced_analysis.py +823 -0
- package/src/tools/advanced_feature_engineering.py +708 -0
- package/src/tools/advanced_insights.py +578 -0
- package/src/tools/advanced_preprocessing.py +549 -0
- package/src/tools/advanced_training.py +906 -0
- package/src/tools/agent_tool_mapping.py +326 -0
- package/src/tools/auto_pipeline.py +420 -0
- package/src/tools/autogluon_training.py +1480 -0
- package/src/tools/business_intelligence.py +860 -0
- package/src/tools/cloud_data_sources.py +581 -0
- package/src/tools/code_interpreter.py +390 -0
- package/src/tools/computer_vision.py +614 -0
- package/src/tools/data_cleaning.py +614 -0
- package/src/tools/data_profiling.py +593 -0
- package/src/tools/data_type_conversion.py +268 -0
- package/src/tools/data_wrangling.py +433 -0
- package/src/tools/eda_reports.py +284 -0
- package/src/tools/enhanced_feature_engineering.py +241 -0
- package/src/tools/feature_engineering.py +302 -0
- package/src/tools/matplotlib_visualizations.py +1327 -0
- package/src/tools/model_training.py +520 -0
- package/src/tools/nlp_text_analytics.py +761 -0
- package/src/tools/plotly_visualizations.py +497 -0
- package/src/tools/production_mlops.py +852 -0
- package/src/tools/time_series.py +507 -0
- package/src/tools/tools_registry.py +2133 -0
- package/src/tools/visualization_engine.py +559 -0
- package/src/utils/__init__.py +42 -0
- package/src/utils/error_recovery.py +313 -0
- package/src/utils/parallel_executor.py +402 -0
- package/src/utils/polars_helpers.py +248 -0
- package/src/utils/schema_extraction.py +132 -0
- package/src/utils/semantic_layer.py +392 -0
- package/src/utils/token_budget.py +411 -0
- package/src/utils/validation.py +377 -0
- package/src/workflow_state.py +154 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Helper utilities for artifact storage integration
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import tempfile
|
|
7
|
+
import joblib
|
|
8
|
+
from typing import Any, Dict, Optional
|
|
9
|
+
from pathlib import Path
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def save_model_with_store(
|
|
13
|
+
model_data: Any,
|
|
14
|
+
filename: str,
|
|
15
|
+
metadata: Optional[Dict[str, Any]] = None,
|
|
16
|
+
fallback_dir: str = "./outputs/models"
|
|
17
|
+
) -> str:
|
|
18
|
+
"""
|
|
19
|
+
Save model using artifact store if available, otherwise use fallback path.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
model_data: Model object or dict to save
|
|
23
|
+
filename: Name of the model file (e.g., "model.pkl")
|
|
24
|
+
metadata: Optional metadata to attach
|
|
25
|
+
fallback_dir: Directory to use if artifact store unavailable
|
|
26
|
+
|
|
27
|
+
Returns:
|
|
28
|
+
Path where model was saved
|
|
29
|
+
"""
|
|
30
|
+
try:
|
|
31
|
+
from storage import get_artifact_store
|
|
32
|
+
store = get_artifact_store()
|
|
33
|
+
|
|
34
|
+
# Save to temp file first
|
|
35
|
+
with tempfile.NamedTemporaryFile(mode='wb', suffix='.pkl', delete=False) as tmp:
|
|
36
|
+
joblib.dump(model_data, tmp.name)
|
|
37
|
+
model_path = store.save_model(tmp.name, metadata=metadata)
|
|
38
|
+
os.unlink(tmp.name)
|
|
39
|
+
|
|
40
|
+
return model_path
|
|
41
|
+
|
|
42
|
+
except ImportError:
|
|
43
|
+
# Fallback to local path
|
|
44
|
+
model_path = os.path.join(fallback_dir, filename)
|
|
45
|
+
Path(model_path).parent.mkdir(parents=True, exist_ok=True)
|
|
46
|
+
joblib.dump(model_data, model_path)
|
|
47
|
+
return model_path
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def save_plot_with_store(
|
|
51
|
+
plot_path: str,
|
|
52
|
+
metadata: Optional[Dict[str, Any]] = None
|
|
53
|
+
) -> str:
|
|
54
|
+
"""
|
|
55
|
+
Save plot using artifact store if available.
|
|
56
|
+
|
|
57
|
+
Args:
|
|
58
|
+
plot_path: Path to existing plot file
|
|
59
|
+
metadata: Optional metadata to attach
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
Path where plot was saved
|
|
63
|
+
"""
|
|
64
|
+
try:
|
|
65
|
+
from storage import get_artifact_store
|
|
66
|
+
store = get_artifact_store()
|
|
67
|
+
return store.save_plot(plot_path, metadata=metadata)
|
|
68
|
+
except ImportError:
|
|
69
|
+
# Already saved locally
|
|
70
|
+
return plot_path
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def save_report_with_store(
|
|
74
|
+
report_path: str,
|
|
75
|
+
metadata: Optional[Dict[str, Any]] = None
|
|
76
|
+
) -> str:
|
|
77
|
+
"""
|
|
78
|
+
Save report using artifact store if available.
|
|
79
|
+
|
|
80
|
+
Args:
|
|
81
|
+
report_path: Path to existing report file
|
|
82
|
+
metadata: Optional metadata to attach
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
Path where report was saved
|
|
86
|
+
"""
|
|
87
|
+
try:
|
|
88
|
+
from storage import get_artifact_store
|
|
89
|
+
store = get_artifact_store()
|
|
90
|
+
return store.save_report(report_path, metadata=metadata)
|
|
91
|
+
except ImportError:
|
|
92
|
+
# Already saved locally
|
|
93
|
+
return report_path
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def save_data_with_store(
|
|
97
|
+
data_path: str,
|
|
98
|
+
metadata: Optional[Dict[str, Any]] = None
|
|
99
|
+
) -> str:
|
|
100
|
+
"""
|
|
101
|
+
Save data file using artifact store if available.
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
data_path: Path to existing data file
|
|
105
|
+
metadata: Optional metadata to attach
|
|
106
|
+
|
|
107
|
+
Returns:
|
|
108
|
+
Path where data was saved
|
|
109
|
+
"""
|
|
110
|
+
try:
|
|
111
|
+
from storage import get_artifact_store
|
|
112
|
+
store = get_artifact_store()
|
|
113
|
+
return store.save_data(data_path, metadata=metadata)
|
|
114
|
+
except ImportError:
|
|
115
|
+
# Already saved locally
|
|
116
|
+
return data_path
|