plot-agent 0.2.2__py3-none-any.whl → 0.3.0__py3-none-any.whl
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/agent.py +4 -4
- plot_agent/execution.py +1 -1
- plot_agent/models.py +5 -2
- {plot_agent-0.2.2.dist-info → plot_agent-0.3.0.dist-info}/METADATA +3 -3
- plot_agent-0.3.0.dist-info/RECORD +10 -0
- plot_agent-0.2.2.dist-info/RECORD +0 -10
- {plot_agent-0.2.2.dist-info → plot_agent-0.3.0.dist-info}/WHEEL +0 -0
- {plot_agent-0.2.2.dist-info → plot_agent-0.3.0.dist-info}/licenses/LICENSE +0 -0
- {plot_agent-0.2.2.dist-info → plot_agent-0.3.0.dist-info}/top_level.txt +0 -0
plot_agent/agent.py
CHANGED
|
@@ -14,10 +14,10 @@ from plot_agent.models import (
|
|
|
14
14
|
DoesFigExistInput,
|
|
15
15
|
ViewGeneratedCodeInput,
|
|
16
16
|
)
|
|
17
|
-
from plot_agent.execution import
|
|
17
|
+
from plot_agent.execution import PlotAgentExecutionEnvironment
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
class
|
|
20
|
+
class PlotAgent:
|
|
21
21
|
"""
|
|
22
22
|
A class that uses an LLM to generate Plotly code based on a user's plot description.
|
|
23
23
|
"""
|
|
@@ -32,7 +32,7 @@ class PlotlyAgent:
|
|
|
32
32
|
handle_parsing_errors: bool = True,
|
|
33
33
|
):
|
|
34
34
|
"""
|
|
35
|
-
Initialize the
|
|
35
|
+
Initialize the PlotAgent.
|
|
36
36
|
|
|
37
37
|
Args:
|
|
38
38
|
model (str): The model to use for the LLM.
|
|
@@ -90,7 +90,7 @@ class PlotlyAgent:
|
|
|
90
90
|
self.sql_query = sql_query
|
|
91
91
|
|
|
92
92
|
# Initialize execution environment
|
|
93
|
-
self.execution_env =
|
|
93
|
+
self.execution_env = PlotAgentExecutionEnvironment(df)
|
|
94
94
|
|
|
95
95
|
# Initialize the agent with tools
|
|
96
96
|
self._initialize_agent()
|
plot_agent/execution.py
CHANGED
plot_agent/models.py
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
from pydantic import BaseModel, Field
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
# Define input schemas for the tools
|
|
5
4
|
class PlotDescriptionInput(BaseModel):
|
|
5
|
+
"""Model indicating that the plot_description function takes a plot_description argument."""
|
|
6
|
+
|
|
6
7
|
plot_description: str = Field(
|
|
7
8
|
..., description="Description of the plot the user wants to create"
|
|
8
9
|
)
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
class GeneratedCodeInput(BaseModel):
|
|
13
|
+
"""Model indicating that the generated_code function takes a generated_code argument."""
|
|
14
|
+
|
|
12
15
|
generated_code: str = Field(
|
|
13
16
|
..., description="Python code that creates a Plotly figure"
|
|
14
17
|
)
|
|
@@ -23,4 +26,4 @@ class DoesFigExistInput(BaseModel):
|
|
|
23
26
|
class ViewGeneratedCodeInput(BaseModel):
|
|
24
27
|
"""Model indicating that the view_generated_code function takes no arguments."""
|
|
25
28
|
|
|
26
|
-
pass
|
|
29
|
+
pass
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: plot-agent
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.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
|
|
@@ -35,7 +35,7 @@ Here's a simple minimal example of how to use Plot Agent:
|
|
|
35
35
|
|
|
36
36
|
```python
|
|
37
37
|
import pandas as pd
|
|
38
|
-
from plot_agent.agent import
|
|
38
|
+
from plot_agent.agent import PlotAgent
|
|
39
39
|
|
|
40
40
|
# ensure OPENAI_API_KEY is set and available for langchain
|
|
41
41
|
|
|
@@ -46,7 +46,7 @@ df = pd.DataFrame({
|
|
|
46
46
|
})
|
|
47
47
|
|
|
48
48
|
# Initialize the agent
|
|
49
|
-
agent =
|
|
49
|
+
agent = PlotAgent()
|
|
50
50
|
|
|
51
51
|
# Set the dataframe
|
|
52
52
|
agent.set_df(df)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
plot_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
plot_agent/agent.py,sha256=FPHma_u_77y3c5nBrCPS0VR8AWz-NFFRqURn0xHph-M,9584
|
|
3
|
+
plot_agent/execution.py,sha256=Ewnz6Pb2EWM0pDAmeVoJ5RmhY5gmO1F7iOvERkj2D28,2770
|
|
4
|
+
plot_agent/models.py,sha256=MkAaSELr54RfGRONKfiqCRA2ghlRbzTe5L5krVuqMsk,800
|
|
5
|
+
plot_agent/prompt.py,sha256=HjRgbsAe8HHs8arQogvzOGQdThEWKRqQhtQyaUplxhQ,3064
|
|
6
|
+
plot_agent-0.3.0.dist-info/licenses/LICENSE,sha256=A4DPih7wHrh4VMEG3p1PhorqdhjmGIo8nQdYNQL7daA,1062
|
|
7
|
+
plot_agent-0.3.0.dist-info/METADATA,sha256=Cqw5gPpT2OM0fPaV_XLFJChEjsAFrVKfiwvxWxdVphM,2837
|
|
8
|
+
plot_agent-0.3.0.dist-info/WHEEL,sha256=lTU6B6eIfYoiQJTZNc-fyaR6BpL6ehTzU3xGYxn2n8k,91
|
|
9
|
+
plot_agent-0.3.0.dist-info/top_level.txt,sha256=KyOjpihUssx26Ra-37vKUQ71pI2qgJsHaRwXHJUhjzQ,11
|
|
10
|
+
plot_agent-0.3.0.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
plot_agent/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
plot_agent/agent.py,sha256=mflUj-vE_x9_W7XTJ3-GgYFfvg3uXV3wkrUw7wRPlVM,9592
|
|
3
|
-
plot_agent/execution.py,sha256=BBKBVGQDrg7BPWvPbLWOjkAAFRlfyu28QxClXuspd8o,2772
|
|
4
|
-
plot_agent/models.py,sha256=ZOWWeYaqmnKJarXYyXnBQQ4nwUe71ae_gMul3bZXaWU,644
|
|
5
|
-
plot_agent/prompt.py,sha256=HjRgbsAe8HHs8arQogvzOGQdThEWKRqQhtQyaUplxhQ,3064
|
|
6
|
-
plot_agent-0.2.2.dist-info/licenses/LICENSE,sha256=A4DPih7wHrh4VMEG3p1PhorqdhjmGIo8nQdYNQL7daA,1062
|
|
7
|
-
plot_agent-0.2.2.dist-info/METADATA,sha256=dLTSBMjvxg0U63r-EbN2tfI7-eZGYexq854L0kN8M6M,2841
|
|
8
|
-
plot_agent-0.2.2.dist-info/WHEEL,sha256=lTU6B6eIfYoiQJTZNc-fyaR6BpL6ehTzU3xGYxn2n8k,91
|
|
9
|
-
plot_agent-0.2.2.dist-info/top_level.txt,sha256=KyOjpihUssx26Ra-37vKUQ71pI2qgJsHaRwXHJUhjzQ,11
|
|
10
|
-
plot_agent-0.2.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|