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.
Files changed (67) hide show
  1. package/bin/ds-agent.js +451 -0
  2. package/ds_agent/__init__.py +8 -0
  3. package/package.json +28 -0
  4. package/requirements.txt +126 -0
  5. package/setup.py +35 -0
  6. package/src/__init__.py +7 -0
  7. package/src/_compress_tool_result.py +118 -0
  8. package/src/api/__init__.py +4 -0
  9. package/src/api/app.py +1626 -0
  10. package/src/cache/__init__.py +5 -0
  11. package/src/cache/cache_manager.py +561 -0
  12. package/src/cli.py +2886 -0
  13. package/src/dynamic_prompts.py +281 -0
  14. package/src/orchestrator.py +4799 -0
  15. package/src/progress_manager.py +139 -0
  16. package/src/reasoning/__init__.py +332 -0
  17. package/src/reasoning/business_summary.py +431 -0
  18. package/src/reasoning/data_understanding.py +356 -0
  19. package/src/reasoning/model_explanation.py +383 -0
  20. package/src/reasoning/reasoning_trace.py +239 -0
  21. package/src/registry/__init__.py +3 -0
  22. package/src/registry/tools_registry.py +3 -0
  23. package/src/session_memory.py +448 -0
  24. package/src/session_store.py +370 -0
  25. package/src/storage/__init__.py +19 -0
  26. package/src/storage/artifact_store.py +620 -0
  27. package/src/storage/helpers.py +116 -0
  28. package/src/storage/huggingface_storage.py +694 -0
  29. package/src/storage/r2_storage.py +0 -0
  30. package/src/storage/user_files_service.py +288 -0
  31. package/src/tools/__init__.py +335 -0
  32. package/src/tools/advanced_analysis.py +823 -0
  33. package/src/tools/advanced_feature_engineering.py +708 -0
  34. package/src/tools/advanced_insights.py +578 -0
  35. package/src/tools/advanced_preprocessing.py +549 -0
  36. package/src/tools/advanced_training.py +906 -0
  37. package/src/tools/agent_tool_mapping.py +326 -0
  38. package/src/tools/auto_pipeline.py +420 -0
  39. package/src/tools/autogluon_training.py +1480 -0
  40. package/src/tools/business_intelligence.py +860 -0
  41. package/src/tools/cloud_data_sources.py +581 -0
  42. package/src/tools/code_interpreter.py +390 -0
  43. package/src/tools/computer_vision.py +614 -0
  44. package/src/tools/data_cleaning.py +614 -0
  45. package/src/tools/data_profiling.py +593 -0
  46. package/src/tools/data_type_conversion.py +268 -0
  47. package/src/tools/data_wrangling.py +433 -0
  48. package/src/tools/eda_reports.py +284 -0
  49. package/src/tools/enhanced_feature_engineering.py +241 -0
  50. package/src/tools/feature_engineering.py +302 -0
  51. package/src/tools/matplotlib_visualizations.py +1327 -0
  52. package/src/tools/model_training.py +520 -0
  53. package/src/tools/nlp_text_analytics.py +761 -0
  54. package/src/tools/plotly_visualizations.py +497 -0
  55. package/src/tools/production_mlops.py +852 -0
  56. package/src/tools/time_series.py +507 -0
  57. package/src/tools/tools_registry.py +2133 -0
  58. package/src/tools/visualization_engine.py +559 -0
  59. package/src/utils/__init__.py +42 -0
  60. package/src/utils/error_recovery.py +313 -0
  61. package/src/utils/parallel_executor.py +402 -0
  62. package/src/utils/polars_helpers.py +248 -0
  63. package/src/utils/schema_extraction.py +132 -0
  64. package/src/utils/semantic_layer.py +392 -0
  65. package/src/utils/token_budget.py +411 -0
  66. package/src/utils/validation.py +377 -0
  67. 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