plot-agent 0.3.1__tar.gz → 0.5.0__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.
- {plot_agent-0.3.1 → plot_agent-0.5.0}/PKG-INFO +58 -3
- {plot_agent-0.3.1 → plot_agent-0.5.0}/README.md +57 -2
- plot_agent-0.5.0/plot_agent/__init__.py +5 -0
- plot_agent-0.5.0/plot_agent/agent.py +653 -0
- {plot_agent-0.3.1 → plot_agent-0.5.0}/plot_agent/execution.py +107 -11
- {plot_agent-0.3.1 → plot_agent-0.5.0}/plot_agent/models.py +6 -0
- {plot_agent-0.3.1 → plot_agent-0.5.0}/plot_agent/prompt.py +10 -5
- {plot_agent-0.3.1 → plot_agent-0.5.0}/plot_agent.egg-info/PKG-INFO +58 -3
- {plot_agent-0.3.1 → plot_agent-0.5.0}/pyproject.toml +1 -1
- plot_agent-0.3.1/plot_agent/__init__.py +0 -0
- plot_agent-0.3.1/plot_agent/agent.py +0 -269
- {plot_agent-0.3.1 → plot_agent-0.5.0}/LICENSE +0 -0
- {plot_agent-0.3.1 → plot_agent-0.5.0}/plot_agent.egg-info/SOURCES.txt +0 -0
- {plot_agent-0.3.1 → plot_agent-0.5.0}/plot_agent.egg-info/dependency_links.txt +0 -0
- {plot_agent-0.3.1 → plot_agent-0.5.0}/plot_agent.egg-info/top_level.txt +0 -0
- {plot_agent-0.3.1 → plot_agent-0.5.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plot-agent
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.5.0
|
|
4
4
|
Summary: An AI-powered data visualization assistant using Plotly
|
|
5
5
|
Author-email: andrewm4894 <andrewm4894@gmail.com>
|
|
6
6
|
Project-URL: Homepage, https://github.com/andrewm4894/plot-agent
|
|
@@ -19,6 +19,8 @@ Dynamic: license-file
|
|
|
19
19
|
|
|
20
20
|
An AI-powered data visualization assistant that helps users create Plotly visualizations in Python.
|
|
21
21
|
|
|
22
|
+
Built on LangGraph with tool-calling to reliably execute generated Plotly code in a sandbox and keep the current `fig` in sync.
|
|
23
|
+
|
|
22
24
|
## Installation
|
|
23
25
|
|
|
24
26
|
You can install the package using pip:
|
|
@@ -37,7 +39,7 @@ Here's a simple minimal example of how to use Plot Agent:
|
|
|
37
39
|
import pandas as pd
|
|
38
40
|
from plot_agent.agent import PlotAgent
|
|
39
41
|
|
|
40
|
-
# ensure OPENAI_API_KEY is set
|
|
42
|
+
# ensure OPENAI_API_KEY is set (env or .env); optional debug via PLOT_AGENT_DEBUG=1
|
|
41
43
|
|
|
42
44
|
# Create a sample dataframe
|
|
43
45
|
df = pd.DataFrame({
|
|
@@ -92,19 +94,72 @@ fig.update_layout(
|
|
|
92
94
|
)
|
|
93
95
|
```
|
|
94
96
|
|
|
97
|
+
## How it works
|
|
98
|
+
|
|
99
|
+
```mermaid
|
|
100
|
+
flowchart TD
|
|
101
|
+
A[User message] --> B{LangGraph ReAct Agent}
|
|
102
|
+
subgraph Tools
|
|
103
|
+
T1[execute_plotly_code<br/>- runs code in sandbox<br/>- returns success/fig/error]
|
|
104
|
+
T2[does_fig_exist]
|
|
105
|
+
T3[view_generated_code]
|
|
106
|
+
end
|
|
107
|
+
B -- tool call --> T1
|
|
108
|
+
T1 -- result --> B
|
|
109
|
+
B -- optional --> T2
|
|
110
|
+
B -- optional --> T3
|
|
111
|
+
B --> C[AI response]
|
|
112
|
+
C --> D{Agent wrapper}
|
|
113
|
+
D -- persist messages --> B
|
|
114
|
+
D -- extract code blocks --> E[Sandbox execution]
|
|
115
|
+
E --> F[fig]
|
|
116
|
+
F --> G[get_figure]
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
- The LangGraph agent plans and decides when to call tools.
|
|
120
|
+
- The wrapper persists full graph messages between turns and executes any returned code blocks to keep `fig` updated.
|
|
121
|
+
- A safe execution environment runs code with an allowlist and a main-thread-only timeout.
|
|
122
|
+
|
|
95
123
|
## Features
|
|
96
124
|
|
|
97
125
|
- AI-powered visualization generation
|
|
98
126
|
- Support for various Plotly chart types
|
|
99
127
|
- Automatic data preprocessing
|
|
100
128
|
- Interactive visualization capabilities
|
|
101
|
-
-
|
|
129
|
+
- LangGraph-based tool calling and control flow
|
|
130
|
+
- Debug logging via `PlotAgent(debug=True)` or `PLOT_AGENT_DEBUG=1`
|
|
102
131
|
|
|
103
132
|
## Requirements
|
|
104
133
|
|
|
105
134
|
- Python 3.8 or higher
|
|
106
135
|
- Dependencies are automatically installed with the package
|
|
107
136
|
|
|
137
|
+
## Development
|
|
138
|
+
|
|
139
|
+
- Run unit tests:
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
make test
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
- Execute all example notebooks:
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
make run-examples
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
- Execute with debug logs enabled:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
make run-examples-debug
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
- Quick CLI repro that prints evolving code each step:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
make run-example-script
|
|
161
|
+
```
|
|
162
|
+
|
|
108
163
|
## License
|
|
109
164
|
|
|
110
165
|
This project is licensed under the MIT License - see the LICENSE file for details.
|
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
|
|
6
6
|
An AI-powered data visualization assistant that helps users create Plotly visualizations in Python.
|
|
7
7
|
|
|
8
|
+
Built on LangGraph with tool-calling to reliably execute generated Plotly code in a sandbox and keep the current `fig` in sync.
|
|
9
|
+
|
|
8
10
|
## Installation
|
|
9
11
|
|
|
10
12
|
You can install the package using pip:
|
|
@@ -23,7 +25,7 @@ Here's a simple minimal example of how to use Plot Agent:
|
|
|
23
25
|
import pandas as pd
|
|
24
26
|
from plot_agent.agent import PlotAgent
|
|
25
27
|
|
|
26
|
-
# ensure OPENAI_API_KEY is set
|
|
28
|
+
# ensure OPENAI_API_KEY is set (env or .env); optional debug via PLOT_AGENT_DEBUG=1
|
|
27
29
|
|
|
28
30
|
# Create a sample dataframe
|
|
29
31
|
df = pd.DataFrame({
|
|
@@ -78,19 +80,72 @@ fig.update_layout(
|
|
|
78
80
|
)
|
|
79
81
|
```
|
|
80
82
|
|
|
83
|
+
## How it works
|
|
84
|
+
|
|
85
|
+
```mermaid
|
|
86
|
+
flowchart TD
|
|
87
|
+
A[User message] --> B{LangGraph ReAct Agent}
|
|
88
|
+
subgraph Tools
|
|
89
|
+
T1[execute_plotly_code<br/>- runs code in sandbox<br/>- returns success/fig/error]
|
|
90
|
+
T2[does_fig_exist]
|
|
91
|
+
T3[view_generated_code]
|
|
92
|
+
end
|
|
93
|
+
B -- tool call --> T1
|
|
94
|
+
T1 -- result --> B
|
|
95
|
+
B -- optional --> T2
|
|
96
|
+
B -- optional --> T3
|
|
97
|
+
B --> C[AI response]
|
|
98
|
+
C --> D{Agent wrapper}
|
|
99
|
+
D -- persist messages --> B
|
|
100
|
+
D -- extract code blocks --> E[Sandbox execution]
|
|
101
|
+
E --> F[fig]
|
|
102
|
+
F --> G[get_figure]
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
- The LangGraph agent plans and decides when to call tools.
|
|
106
|
+
- The wrapper persists full graph messages between turns and executes any returned code blocks to keep `fig` updated.
|
|
107
|
+
- A safe execution environment runs code with an allowlist and a main-thread-only timeout.
|
|
108
|
+
|
|
81
109
|
## Features
|
|
82
110
|
|
|
83
111
|
- AI-powered visualization generation
|
|
84
112
|
- Support for various Plotly chart types
|
|
85
113
|
- Automatic data preprocessing
|
|
86
114
|
- Interactive visualization capabilities
|
|
87
|
-
-
|
|
115
|
+
- LangGraph-based tool calling and control flow
|
|
116
|
+
- Debug logging via `PlotAgent(debug=True)` or `PLOT_AGENT_DEBUG=1`
|
|
88
117
|
|
|
89
118
|
## Requirements
|
|
90
119
|
|
|
91
120
|
- Python 3.8 or higher
|
|
92
121
|
- Dependencies are automatically installed with the package
|
|
93
122
|
|
|
123
|
+
## Development
|
|
124
|
+
|
|
125
|
+
- Run unit tests:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
make test
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
- Execute all example notebooks:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
make run-examples
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
- Execute with debug logs enabled:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
make run-examples-debug
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
- Quick CLI repro that prints evolving code each step:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
make run-example-script
|
|
147
|
+
```
|
|
148
|
+
|
|
94
149
|
## License
|
|
95
150
|
|
|
96
151
|
This project is licensed under the MIT License - see the LICENSE file for details.
|