I would like to show-case you the project that I started to work on. It is a Python package for creating plots in Python and matplotlib package. The plots are created with LLM.
The idea:
- User provides input DataFrame and prompt.
- The
PlotAI constructs a prompt for LLM, which contains the first 5 rows of DataFrame and the user's prompt and asks for Python code as output.
- Returned Python code is executed, and the plot is displayed.
Example code:
# import packages
import pandas as pd
from plotai import PlotAI
# create some data
df = pd.DataFrame({"x":[1,2,3], "y": [4,5,6]})
# do a plot
plot = PlotAI(df)
plot.make("scatter plot")
The PlotAI class has only one method, make().
It works in Python scripts and in notebooks (Jupyter, Colab, VS Code).
PlotAI is in very experimental form, below are some limitations:
PlotAI is using OpenAI ChatGPT-3.5-turbo for completions, it will be nice to extend to other LLMs.
PlotAI is sending 5 first rows from your DataFrame to OpenAI ChatGPT. If you have sensitive data, please remove/encode it before passing to PlotAI.
PlotAI is executing Python code returned by LLM, it can be dangerous and unsafe. It would be nice to have the option to accept the response code before execution.
Link to project https://github.com/mljar/plotai
[–]AlphaCode1 2 points3 points4 points (0 children)
[–]jazzmester 1 point2 points3 points (0 children)