ai-data-science-team 0.0.0.9008__tar.gz → 0.0.0.9009__tar.gz
Sign up to get free protection for your applications and to get access to all the features.
- {ai_data_science_team-0.0.0.9008/ai_data_science_team.egg-info → ai_data_science_team-0.0.0.9009}/PKG-INFO +28 -14
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/README.md +21 -13
- ai_data_science_team-0.0.0.9009/ai_data_science_team/_version.py +1 -0
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team/agents/__init__.py +0 -1
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team/agents/data_cleaning_agent.py +45 -34
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team/agents/data_visualization_agent.py +39 -43
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team/agents/data_wrangling_agent.py +45 -44
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team/agents/feature_engineering_agent.py +42 -61
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team/agents/sql_database_agent.py +125 -71
- ai_data_science_team-0.0.0.9009/ai_data_science_team/ml_agents/__init__.py +1 -0
- ai_data_science_team-0.0.0.9009/ai_data_science_team/ml_agents/h2o_ml_agent.py +1032 -0
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team/multiagents/sql_data_analyst.py +119 -7
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team/templates/__init__.py +1 -0
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team/templates/agent_templates.py +73 -2
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team/tools/metadata.py +94 -62
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team/tools/regex.py +59 -1
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009/ai_data_science_team.egg-info}/PKG-INFO +28 -14
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team.egg-info/SOURCES.txt +2 -0
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team.egg-info/requires.txt +7 -0
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/requirements.txt +1 -0
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/setup.py +4 -0
- ai_data_science_team-0.0.0.9008/ai_data_science_team/_version.py +0 -1
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/LICENSE +0 -0
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/MANIFEST.in +0 -0
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team/__init__.py +0 -0
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team/multiagents/__init__.py +0 -0
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team/multiagents/supervised_data_analyst.py +0 -0
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team/orchestration.py +0 -0
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team/tools/__init__.py +0 -0
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team/tools/logging.py +0 -0
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team/tools/parsers.py +0 -0
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team/utils/__init__.py +0 -0
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team/utils/plotly.py +0 -0
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team.egg-info/dependency_links.txt +0 -0
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/ai_data_science_team.egg-info/top_level.txt +0 -0
- {ai_data_science_team-0.0.0.9008 → ai_data_science_team-0.0.0.9009}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.2
|
2
2
|
Name: ai-data-science-team
|
3
|
-
Version: 0.0.0.
|
3
|
+
Version: 0.0.0.9009
|
4
4
|
Summary: Build and run an AI-powered data science team.
|
5
5
|
Home-page: https://github.com/business-science/ai-data-science-team
|
6
6
|
Author: Matt Dancho
|
@@ -21,17 +21,23 @@ Requires-Dist: langchain_experimental
|
|
21
21
|
Requires-Dist: langgraph>=0.2.57
|
22
22
|
Requires-Dist: openai
|
23
23
|
Requires-Dist: pandas
|
24
|
+
Requires-Dist: sqlalchemy
|
24
25
|
Requires-Dist: numpy
|
25
26
|
Requires-Dist: plotly
|
26
27
|
Requires-Dist: streamlit
|
27
28
|
Requires-Dist: scikit-learn
|
28
29
|
Requires-Dist: xgboost
|
30
|
+
Provides-Extra: machine-learning-agent
|
31
|
+
Requires-Dist: h2o; extra == "machine-learning-agent"
|
32
|
+
Provides-Extra: all
|
33
|
+
Requires-Dist: h2o; extra == "all"
|
29
34
|
Dynamic: author
|
30
35
|
Dynamic: author-email
|
31
36
|
Dynamic: classifier
|
32
37
|
Dynamic: description
|
33
38
|
Dynamic: description-content-type
|
34
39
|
Dynamic: home-page
|
40
|
+
Dynamic: provides-extra
|
35
41
|
Dynamic: requires-dist
|
36
42
|
Dynamic: requires-python
|
37
43
|
Dynamic: summary
|
@@ -47,13 +53,13 @@ Dynamic: summary
|
|
47
53
|
<em>An AI-powered data science team of agents to help you perform common data science tasks 10X faster</em>
|
48
54
|
</div>
|
49
55
|
<div align="center">
|
50
|
-
<a href="https://pypi.python.org/pypi/ai-data-science-team"><img src="https://img.shields.io/pypi/v/ai-data-science-team.svg" alt="PyPI"></a>
|
51
|
-
<a href="https://github.com/business-science/ai-data-science-team"><img src="https://img.shields.io/pypi/pyversions/ai-data-science-team.svg" alt="versions"></a>
|
52
|
-
<a href="https://github.com/business-science/ai-data-science-team/blob/main/LICENSE"><img src="https://img.shields.io/github/license/business-science/ai-data-science-team.svg?
|
56
|
+
<a href="https://pypi.python.org/pypi/ai-data-science-team"><img src="https://img.shields.io/pypi/v/ai-data-science-team.svg?style=for-the-badge" alt="PyPI"></a>
|
57
|
+
<a href="https://github.com/business-science/ai-data-science-team"><img src="https://img.shields.io/pypi/pyversions/ai-data-science-team.svg?style=for-the-badge" alt="versions"></a>
|
58
|
+
<a href="https://github.com/business-science/ai-data-science-team/blob/main/LICENSE"><img src="https://img.shields.io/github/license/business-science/ai-data-science-team.svg?style=for-the-badge" alt="license"></a>
|
53
59
|
</div>
|
54
60
|
|
55
61
|
|
56
|
-
# Your AI Data Science Team (An Army Of Agents)
|
62
|
+
# Your AI Data Science Team (🪖 An Army Of Agents)
|
57
63
|
|
58
64
|
**An AI-powered data science team of agents to help you perform common data science tasks 10X faster**.
|
59
65
|
|
@@ -74,14 +80,16 @@ The AI Data Science Team of Copilots includes Agents that specialize data cleani
|
|
74
80
|
|
75
81
|
## Table of Contents
|
76
82
|
|
77
|
-
- [Your AI Data Science Team (An Army Of Agents)](#your-ai-data-science-team
|
83
|
+
- [Your AI Data Science Team (🪖 An Army Of Agents)](#your-ai-data-science-team--an-army-of-agents)
|
78
84
|
- [Table of Contents](#table-of-contents)
|
79
85
|
- [Companies That Want A Custom AI Data Science Team (And AI Apps)](#companies-that-want-a-custom-ai-data-science-team-and-ai-apps)
|
80
|
-
- [
|
86
|
+
- [Generative AI for Data Scientists Workshop](#generative-ai-for-data-scientists-workshop)
|
81
87
|
- [Data Science Agents](#data-science-agents)
|
82
|
-
- [
|
83
|
-
- [
|
88
|
+
- [NEW: Multi-Agents](#new-multi-agents)
|
89
|
+
- [Coming Soon: Data Science Apps](#coming-soon-data-science-apps)
|
84
90
|
- [Agents Available Now](#agents-available-now)
|
91
|
+
- [Data Science Agents](#data-science-agents-1)
|
92
|
+
- [Multi-Agents](#multi-agents)
|
85
93
|
- [Agents Coming Soon](#agents-coming-soon)
|
86
94
|
- [Disclaimer](#disclaimer)
|
87
95
|
- [Installation](#installation)
|
@@ -94,11 +102,11 @@ The AI Data Science Team of Copilots includes Agents that specialize data cleani
|
|
94
102
|
|
95
103
|
## Companies That Want A Custom AI Data Science Team (And AI Apps)
|
96
104
|
|
97
|
-
Want to have your own _customized_ enterprise-grade AI Data Science Team and domain-
|
105
|
+
Want to have your own _customized_ enterprise-grade AI Data Science Team and *domain-specific* AI-powered Apps?
|
98
106
|
|
99
107
|
**Send inquiries here:** [https://www.business-science.io/contact.html](https://www.business-science.io/contact.html)
|
100
108
|
|
101
|
-
##
|
109
|
+
## Generative AI for Data Scientists Workshop
|
102
110
|
|
103
111
|
If you're an aspiring data scientist who wants to learn how to build AI Agents and AI Apps for your company that performs Data Science, Business Intelligence, Churn Modeling, Time Series Forecasting, and more, then I'd love to help you.
|
104
112
|
|
@@ -110,13 +118,13 @@ This project is a work in progress. New data science agents will be released soo
|
|
110
118
|
|
111
119
|

|
112
120
|
|
113
|
-
###
|
121
|
+
### NEW: Multi-Agents
|
114
122
|
|
115
|
-
This is the internals of the
|
123
|
+
This is the internals of the SQL Data Analyst Agent that connects to SQL databases to pull data into the data science environment. It creates pipelines to automate data extraction, performs Joins, Aggregations, and other SQL Query operations. And it includes a Data Visualization Agent that creates visualizations to help you understand your data.:
|
116
124
|
|
117
125
|

|
118
126
|
|
119
|
-
###
|
127
|
+
### Coming Soon: Data Science Apps
|
120
128
|
|
121
129
|
This is a top secret project I'm working on. It's a multi-agent data science app that performs time series forecasting.
|
122
130
|
|
@@ -124,12 +132,18 @@ This is a top secret project I'm working on. It's a multi-agent data science app
|
|
124
132
|
|
125
133
|
### Agents Available Now
|
126
134
|
|
135
|
+
#### Data Science Agents
|
136
|
+
|
127
137
|
1. **Data Wrangling Agent:** Merges, Joins, Preps and Wrangles data into a format that is ready for data analysis.
|
128
138
|
2. **Data Visualization Agent:** Creates visualizations to help you understand your data. Returns JSON serializable plotly visualizations.
|
129
139
|
3. **Data Cleaning Agent:** Performs Data Preparation steps including handling missing values, outliers, and data type conversions.
|
130
140
|
4. **Feature Engineering Agent:** Converts the prepared data into ML-ready data. Adds features to increase predictive accuracy of ML models.
|
131
141
|
5. **SQL Database Agent:** Connects to SQL databases to pull data into the data science environment. Creates pipelines to automate data extraction. Performs Joins, Aggregations, and other SQL Query operations.
|
132
142
|
|
143
|
+
#### Multi-Agents
|
144
|
+
|
145
|
+
1. **SQL Data Analyst Agent:** Connects to SQL databases to pull data into the data science environment. Creates pipelines to automate data extraction. Performs Joins, Aggregations, and other SQL Query operations. Includes a Data Visualization Agent that creates visualizations to help you understand your data.
|
146
|
+
|
133
147
|
### Agents Coming Soon
|
134
148
|
|
135
149
|
1. **Data Analyst:** Analyzes data structure, creates exploratory visualizations, and performs correlation analysis to identify relationships.
|
@@ -9,13 +9,13 @@
|
|
9
9
|
<em>An AI-powered data science team of agents to help you perform common data science tasks 10X faster</em>
|
10
10
|
</div>
|
11
11
|
<div align="center">
|
12
|
-
<a href="https://pypi.python.org/pypi/ai-data-science-team"><img src="https://img.shields.io/pypi/v/ai-data-science-team.svg" alt="PyPI"></a>
|
13
|
-
<a href="https://github.com/business-science/ai-data-science-team"><img src="https://img.shields.io/pypi/pyversions/ai-data-science-team.svg" alt="versions"></a>
|
14
|
-
<a href="https://github.com/business-science/ai-data-science-team/blob/main/LICENSE"><img src="https://img.shields.io/github/license/business-science/ai-data-science-team.svg?
|
12
|
+
<a href="https://pypi.python.org/pypi/ai-data-science-team"><img src="https://img.shields.io/pypi/v/ai-data-science-team.svg?style=for-the-badge" alt="PyPI"></a>
|
13
|
+
<a href="https://github.com/business-science/ai-data-science-team"><img src="https://img.shields.io/pypi/pyversions/ai-data-science-team.svg?style=for-the-badge" alt="versions"></a>
|
14
|
+
<a href="https://github.com/business-science/ai-data-science-team/blob/main/LICENSE"><img src="https://img.shields.io/github/license/business-science/ai-data-science-team.svg?style=for-the-badge" alt="license"></a>
|
15
15
|
</div>
|
16
16
|
|
17
17
|
|
18
|
-
# Your AI Data Science Team (An Army Of Agents)
|
18
|
+
# Your AI Data Science Team (🪖 An Army Of Agents)
|
19
19
|
|
20
20
|
**An AI-powered data science team of agents to help you perform common data science tasks 10X faster**.
|
21
21
|
|
@@ -36,14 +36,16 @@ The AI Data Science Team of Copilots includes Agents that specialize data cleani
|
|
36
36
|
|
37
37
|
## Table of Contents
|
38
38
|
|
39
|
-
- [Your AI Data Science Team (An Army Of Agents)](#your-ai-data-science-team
|
39
|
+
- [Your AI Data Science Team (🪖 An Army Of Agents)](#your-ai-data-science-team--an-army-of-agents)
|
40
40
|
- [Table of Contents](#table-of-contents)
|
41
41
|
- [Companies That Want A Custom AI Data Science Team (And AI Apps)](#companies-that-want-a-custom-ai-data-science-team-and-ai-apps)
|
42
|
-
- [
|
42
|
+
- [Generative AI for Data Scientists Workshop](#generative-ai-for-data-scientists-workshop)
|
43
43
|
- [Data Science Agents](#data-science-agents)
|
44
|
-
- [
|
45
|
-
- [
|
44
|
+
- [NEW: Multi-Agents](#new-multi-agents)
|
45
|
+
- [Coming Soon: Data Science Apps](#coming-soon-data-science-apps)
|
46
46
|
- [Agents Available Now](#agents-available-now)
|
47
|
+
- [Data Science Agents](#data-science-agents-1)
|
48
|
+
- [Multi-Agents](#multi-agents)
|
47
49
|
- [Agents Coming Soon](#agents-coming-soon)
|
48
50
|
- [Disclaimer](#disclaimer)
|
49
51
|
- [Installation](#installation)
|
@@ -56,11 +58,11 @@ The AI Data Science Team of Copilots includes Agents that specialize data cleani
|
|
56
58
|
|
57
59
|
## Companies That Want A Custom AI Data Science Team (And AI Apps)
|
58
60
|
|
59
|
-
Want to have your own _customized_ enterprise-grade AI Data Science Team and domain-
|
61
|
+
Want to have your own _customized_ enterprise-grade AI Data Science Team and *domain-specific* AI-powered Apps?
|
60
62
|
|
61
63
|
**Send inquiries here:** [https://www.business-science.io/contact.html](https://www.business-science.io/contact.html)
|
62
64
|
|
63
|
-
##
|
65
|
+
## Generative AI for Data Scientists Workshop
|
64
66
|
|
65
67
|
If you're an aspiring data scientist who wants to learn how to build AI Agents and AI Apps for your company that performs Data Science, Business Intelligence, Churn Modeling, Time Series Forecasting, and more, then I'd love to help you.
|
66
68
|
|
@@ -72,13 +74,13 @@ This project is a work in progress. New data science agents will be released soo
|
|
72
74
|
|
73
75
|

|
74
76
|
|
75
|
-
###
|
77
|
+
### NEW: Multi-Agents
|
76
78
|
|
77
|
-
This is the internals of the
|
79
|
+
This is the internals of the SQL Data Analyst Agent that connects to SQL databases to pull data into the data science environment. It creates pipelines to automate data extraction, performs Joins, Aggregations, and other SQL Query operations. And it includes a Data Visualization Agent that creates visualizations to help you understand your data.:
|
78
80
|
|
79
81
|

|
80
82
|
|
81
|
-
###
|
83
|
+
### Coming Soon: Data Science Apps
|
82
84
|
|
83
85
|
This is a top secret project I'm working on. It's a multi-agent data science app that performs time series forecasting.
|
84
86
|
|
@@ -86,12 +88,18 @@ This is a top secret project I'm working on. It's a multi-agent data science app
|
|
86
88
|
|
87
89
|
### Agents Available Now
|
88
90
|
|
91
|
+
#### Data Science Agents
|
92
|
+
|
89
93
|
1. **Data Wrangling Agent:** Merges, Joins, Preps and Wrangles data into a format that is ready for data analysis.
|
90
94
|
2. **Data Visualization Agent:** Creates visualizations to help you understand your data. Returns JSON serializable plotly visualizations.
|
91
95
|
3. **Data Cleaning Agent:** Performs Data Preparation steps including handling missing values, outliers, and data type conversions.
|
92
96
|
4. **Feature Engineering Agent:** Converts the prepared data into ML-ready data. Adds features to increase predictive accuracy of ML models.
|
93
97
|
5. **SQL Database Agent:** Connects to SQL databases to pull data into the data science environment. Creates pipelines to automate data extraction. Performs Joins, Aggregations, and other SQL Query operations.
|
94
98
|
|
99
|
+
#### Multi-Agents
|
100
|
+
|
101
|
+
1. **SQL Data Analyst Agent:** Connects to SQL databases to pull data into the data science environment. Creates pipelines to automate data extraction. Performs Joins, Aggregations, and other SQL Query operations. Includes a Data Visualization Agent that creates visualizations to help you understand your data.
|
102
|
+
|
95
103
|
### Agents Coming Soon
|
96
104
|
|
97
105
|
1. **Data Analyst:** Analyzes data structure, creates exploratory visualizations, and performs correlation analysis to identify relationships.
|
@@ -0,0 +1 @@
|
|
1
|
+
__version__ = "0.0.0.9009"
|
@@ -3,4 +3,3 @@ from ai_data_science_team.agents.feature_engineering_agent import make_feature_e
|
|
3
3
|
from ai_data_science_team.agents.data_wrangling_agent import make_data_wrangling_agent, DataWranglingAgent
|
4
4
|
from ai_data_science_team.agents.sql_database_agent import make_sql_database_agent, SQLDatabaseAgent
|
5
5
|
from ai_data_science_team.agents.data_visualization_agent import make_data_visualization_agent, DataVisualizationAgent
|
6
|
-
|
@@ -14,7 +14,7 @@ from langgraph.types import Command
|
|
14
14
|
from langgraph.checkpoint.memory import MemorySaver
|
15
15
|
|
16
16
|
import os
|
17
|
-
import
|
17
|
+
import json
|
18
18
|
import pandas as pd
|
19
19
|
|
20
20
|
from IPython.display import Markdown
|
@@ -23,12 +23,18 @@ from ai_data_science_team.templates import(
|
|
23
23
|
node_func_execute_agent_code_on_data,
|
24
24
|
node_func_human_review,
|
25
25
|
node_func_fix_agent_code,
|
26
|
-
|
26
|
+
node_func_report_agent_outputs,
|
27
27
|
create_coding_agent_graph,
|
28
28
|
BaseAgent,
|
29
29
|
)
|
30
30
|
from ai_data_science_team.tools.parsers import PythonOutputParser
|
31
|
-
from ai_data_science_team.tools.regex import
|
31
|
+
from ai_data_science_team.tools.regex import (
|
32
|
+
relocate_imports_inside_function,
|
33
|
+
add_comments_to_top,
|
34
|
+
format_agent_name,
|
35
|
+
format_recommended_steps,
|
36
|
+
get_generic_summary,
|
37
|
+
)
|
32
38
|
from ai_data_science_team.tools.metadata import get_dataframe_summary
|
33
39
|
from ai_data_science_team.tools.logging import log_ai_function
|
34
40
|
|
@@ -37,7 +43,6 @@ AGENT_NAME = "data_cleaning_agent"
|
|
37
43
|
LOG_PATH = os.path.join(os.getcwd(), "logs/")
|
38
44
|
|
39
45
|
|
40
|
-
|
41
46
|
# Class
|
42
47
|
class DataCleaningAgent(BaseAgent):
|
43
48
|
"""
|
@@ -89,8 +94,8 @@ class DataCleaningAgent(BaseAgent):
|
|
89
94
|
Cleans the provided dataset asynchronously based on user instructions.
|
90
95
|
invoke_agent(user_instructions: str, data_raw: pd.DataFrame, max_retries=3, retry_count=0)
|
91
96
|
Cleans the provided dataset synchronously based on user instructions.
|
92
|
-
|
93
|
-
|
97
|
+
get_workflow_summary()
|
98
|
+
Retrieves a summary of the agent's workflow.
|
94
99
|
get_log_summary()
|
95
100
|
Retrieves a summary of logged operations if logging is enabled.
|
96
101
|
get_state_keys()
|
@@ -178,7 +183,6 @@ class DataCleaningAgent(BaseAgent):
|
|
178
183
|
self.response=None
|
179
184
|
return make_data_cleaning_agent(**self._params)
|
180
185
|
|
181
|
-
|
182
186
|
def ainvoke_agent(self, data_raw: pd.DataFrame, user_instructions: str=None, max_retries:int=3, retry_count:int=0, **kwargs):
|
183
187
|
"""
|
184
188
|
Asynchronously invokes the agent. The response is stored in the response attribute.
|
@@ -239,15 +243,16 @@ class DataCleaningAgent(BaseAgent):
|
|
239
243
|
self.response = response
|
240
244
|
return None
|
241
245
|
|
242
|
-
def
|
246
|
+
def get_workflow_summary(self, markdown=False):
|
243
247
|
"""
|
244
|
-
|
245
|
-
|
246
|
-
Returns:
|
247
|
-
str: Explanation of the cleaning steps.
|
248
|
+
Retrieves the agent's workflow summary, if logging is enabled.
|
248
249
|
"""
|
249
|
-
|
250
|
-
|
250
|
+
if self.response and self.response.get("messages"):
|
251
|
+
summary = get_generic_summary(json.loads(self.response.get("messages")[-1].content))
|
252
|
+
if markdown:
|
253
|
+
return Markdown(summary)
|
254
|
+
else:
|
255
|
+
return summary
|
251
256
|
|
252
257
|
def get_log_summary(self, markdown=False):
|
253
258
|
"""
|
@@ -255,7 +260,13 @@ class DataCleaningAgent(BaseAgent):
|
|
255
260
|
"""
|
256
261
|
if self.response:
|
257
262
|
if self.response.get('data_cleaner_function_path'):
|
258
|
-
log_details = f"
|
263
|
+
log_details = f"""
|
264
|
+
## Data Cleaning Agent Log Summary:
|
265
|
+
|
266
|
+
Function Path: {self.response.get('data_cleaner_function_path')}
|
267
|
+
|
268
|
+
Function Name: {self.response.get('data_cleaner_function_name')}
|
269
|
+
"""
|
259
270
|
if markdown:
|
260
271
|
return Markdown(log_details)
|
261
272
|
else:
|
@@ -462,7 +473,7 @@ def make_data_cleaning_agent(
|
|
462
473
|
Below are summaries of all datasets provided:
|
463
474
|
{all_datasets_summary}
|
464
475
|
|
465
|
-
Return
|
476
|
+
Return steps as a numbered list. You can return short code snippets to demonstrate actions. But do not return a fully coded solution. The code will be generated separately by a Coding Agent.
|
466
477
|
|
467
478
|
Avoid these:
|
468
479
|
1. Do not include steps to save files.
|
@@ -633,32 +644,31 @@ def make_data_cleaning_agent(
|
|
633
644
|
function_name=state.get("data_cleaner_function_name"),
|
634
645
|
)
|
635
646
|
|
636
|
-
|
637
|
-
|
647
|
+
# Final reporting node
|
648
|
+
def report_agent_outputs(state: GraphState):
|
649
|
+
return node_func_report_agent_outputs(
|
638
650
|
state=state,
|
639
|
-
|
651
|
+
keys_to_include=[
|
652
|
+
"recommended_steps",
|
653
|
+
"data_cleaner_function",
|
654
|
+
"data_cleaner_function_path",
|
655
|
+
"data_cleaner_function_name",
|
656
|
+
"data_cleaner_error",
|
657
|
+
],
|
640
658
|
result_key="messages",
|
641
|
-
error_key="data_cleaner_error",
|
642
|
-
llm=llm,
|
643
659
|
role=AGENT_NAME,
|
644
|
-
|
645
|
-
Explain the data cleaning steps that the data cleaning agent performed in this function.
|
646
|
-
Keep the summary succinct and to the point.\n\n# Data Cleaning Agent:\n\n{code}
|
647
|
-
""",
|
648
|
-
success_prefix="# Data Cleaning Agent:\n\n ",
|
649
|
-
error_message="The Data Cleaning Agent encountered an error during data cleaning. Data could not be explained."
|
660
|
+
custom_title="Data Cleaning Agent Outputs"
|
650
661
|
)
|
651
|
-
|
652
|
-
# Define the graph
|
662
|
+
|
653
663
|
node_functions = {
|
654
664
|
"recommend_cleaning_steps": recommend_cleaning_steps,
|
655
665
|
"human_review": human_review,
|
656
666
|
"create_data_cleaner_code": create_data_cleaner_code,
|
657
667
|
"execute_data_cleaner_code": execute_data_cleaner_code,
|
658
668
|
"fix_data_cleaner_code": fix_data_cleaner_code,
|
659
|
-
"
|
669
|
+
"report_agent_outputs": report_agent_outputs,
|
660
670
|
}
|
661
|
-
|
671
|
+
|
662
672
|
app = create_coding_agent_graph(
|
663
673
|
GraphState=GraphState,
|
664
674
|
node_functions=node_functions,
|
@@ -666,16 +676,17 @@ def make_data_cleaning_agent(
|
|
666
676
|
create_code_node_name="create_data_cleaner_code",
|
667
677
|
execute_code_node_name="execute_data_cleaner_code",
|
668
678
|
fix_code_node_name="fix_data_cleaner_code",
|
669
|
-
explain_code_node_name="
|
679
|
+
explain_code_node_name="report_agent_outputs",
|
670
680
|
error_key="data_cleaner_error",
|
671
|
-
human_in_the_loop=human_in_the_loop,
|
681
|
+
human_in_the_loop=human_in_the_loop,
|
672
682
|
human_review_node_name="human_review",
|
673
683
|
checkpointer=MemorySaver() if human_in_the_loop else None,
|
674
684
|
bypass_recommended_steps=bypass_recommended_steps,
|
675
685
|
bypass_explain_code=bypass_explain_code,
|
676
686
|
)
|
677
|
-
|
687
|
+
|
678
688
|
return app
|
689
|
+
|
679
690
|
|
680
691
|
|
681
692
|
|
@@ -17,6 +17,7 @@ from langgraph.types import Command
|
|
17
17
|
from langgraph.checkpoint.memory import MemorySaver
|
18
18
|
|
19
19
|
import os
|
20
|
+
import json
|
20
21
|
import pandas as pd
|
21
22
|
|
22
23
|
from IPython.display import Markdown
|
@@ -25,7 +26,7 @@ from ai_data_science_team.templates import(
|
|
25
26
|
node_func_execute_agent_code_on_data,
|
26
27
|
node_func_human_review,
|
27
28
|
node_func_fix_agent_code,
|
28
|
-
|
29
|
+
node_func_report_agent_outputs,
|
29
30
|
create_coding_agent_graph,
|
30
31
|
BaseAgent,
|
31
32
|
)
|
@@ -34,7 +35,8 @@ from ai_data_science_team.tools.regex import (
|
|
34
35
|
relocate_imports_inside_function,
|
35
36
|
add_comments_to_top,
|
36
37
|
format_agent_name,
|
37
|
-
format_recommended_steps
|
38
|
+
format_recommended_steps,
|
39
|
+
get_generic_summary,
|
38
40
|
)
|
39
41
|
from ai_data_science_team.tools.metadata import get_dataframe_summary
|
40
42
|
from ai_data_science_team.tools.logging import log_ai_function
|
@@ -93,8 +95,8 @@ class DataVisualizationAgent(BaseAgent):
|
|
93
95
|
Asynchronously generates a visualization based on user instructions.
|
94
96
|
invoke_agent(user_instructions: str, data_raw: pd.DataFrame, max_retries=3, retry_count=0)
|
95
97
|
Synchronously generates a visualization based on user instructions.
|
96
|
-
|
97
|
-
|
98
|
+
get_workflow_summary()
|
99
|
+
Retrieves a summary of the agent's workflow.
|
98
100
|
get_log_summary()
|
99
101
|
Retrieves a summary of logged operations if logging is enabled.
|
100
102
|
get_plotly_graph()
|
@@ -257,40 +259,34 @@ class DataVisualizationAgent(BaseAgent):
|
|
257
259
|
self.response = response
|
258
260
|
return None
|
259
261
|
|
260
|
-
def
|
262
|
+
def get_workflow_summary(self, markdown=False):
|
261
263
|
"""
|
262
|
-
|
263
|
-
|
264
|
-
Returns
|
265
|
-
-------
|
266
|
-
str
|
267
|
-
Explanation of the visualization steps, if any are available.
|
264
|
+
Retrieves the agent's workflow summary, if logging is enabled.
|
268
265
|
"""
|
269
|
-
if self.response:
|
270
|
-
|
271
|
-
|
266
|
+
if self.response and self.response.get("messages"):
|
267
|
+
summary = get_generic_summary(json.loads(self.response.get("messages")[-1].content))
|
268
|
+
if markdown:
|
269
|
+
return Markdown(summary)
|
270
|
+
else:
|
271
|
+
return summary
|
272
272
|
|
273
273
|
def get_log_summary(self, markdown=False):
|
274
274
|
"""
|
275
275
|
Logs a summary of the agent's operations, if logging is enabled.
|
276
|
+
"""
|
277
|
+
if self.response:
|
278
|
+
if self.response.get('data_visualization_function_path'):
|
279
|
+
log_details = f"""
|
280
|
+
## Data Visualization Agent Log Summary:
|
276
281
|
|
277
|
-
|
278
|
-
----------
|
279
|
-
markdown : bool, optional
|
280
|
-
If True, returns Markdown-formatted output.
|
282
|
+
Function Path: {self.response.get('data_visualization_function_path')}
|
281
283
|
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
log_details = f"Log Path: {self.response.get('data_visualization_function_path')}"
|
289
|
-
if markdown:
|
290
|
-
return Markdown(log_details)
|
291
|
-
else:
|
292
|
-
return log_details
|
293
|
-
return None
|
284
|
+
Function Name: {self.response.get('data_visualization_function_name')}
|
285
|
+
"""
|
286
|
+
if markdown:
|
287
|
+
return Markdown(log_details)
|
288
|
+
else:
|
289
|
+
return log_details
|
294
290
|
|
295
291
|
def get_plotly_graph(self):
|
296
292
|
"""
|
@@ -719,20 +715,20 @@ def make_data_visualization_agent(
|
|
719
715
|
function_name=state.get("data_visualization_function_name"),
|
720
716
|
)
|
721
717
|
|
722
|
-
|
723
|
-
|
718
|
+
# Final reporting node
|
719
|
+
def report_agent_outputs(state: GraphState):
|
720
|
+
return node_func_report_agent_outputs(
|
724
721
|
state=state,
|
725
|
-
|
722
|
+
keys_to_include=[
|
723
|
+
"recommended_steps",
|
724
|
+
"data_visualization_function",
|
725
|
+
"data_visualization_function_path",
|
726
|
+
"data_visualization_function_name",
|
727
|
+
"data_visualization_error",
|
728
|
+
],
|
726
729
|
result_key="messages",
|
727
|
-
error_key="data_visualization_error",
|
728
|
-
llm=llm,
|
729
730
|
role=AGENT_NAME,
|
730
|
-
|
731
|
-
Explain the data visualization steps that the data visualization agent performed in this function.
|
732
|
-
Keep the summary succinct and to the point.\n\n# Data Visualization Agent:\n\n{code}
|
733
|
-
""",
|
734
|
-
success_prefix="# Data Visualization Agent:\n\n ",
|
735
|
-
error_message="The Data Visualization Agent encountered an error during data visualization. No explanation could be provided."
|
731
|
+
custom_title="Data Visualization Agent Outputs"
|
736
732
|
)
|
737
733
|
|
738
734
|
# Define the graph
|
@@ -742,7 +738,7 @@ def make_data_visualization_agent(
|
|
742
738
|
"chart_generator": chart_generator,
|
743
739
|
"execute_data_visualization_code": execute_data_visualization_code,
|
744
740
|
"fix_data_visualization_code": fix_data_visualization_code,
|
745
|
-
"
|
741
|
+
"report_agent_outputs": report_agent_outputs,
|
746
742
|
}
|
747
743
|
|
748
744
|
app = create_coding_agent_graph(
|
@@ -752,7 +748,7 @@ def make_data_visualization_agent(
|
|
752
748
|
create_code_node_name="chart_generator",
|
753
749
|
execute_code_node_name="execute_data_visualization_code",
|
754
750
|
fix_code_node_name="fix_data_visualization_code",
|
755
|
-
explain_code_node_name="
|
751
|
+
explain_code_node_name="report_agent_outputs",
|
756
752
|
error_key="data_visualization_error",
|
757
753
|
human_in_the_loop=human_in_the_loop, # or False
|
758
754
|
human_review_node_name="human_review",
|