This AI data analyst can plot a linear regression chart based on CSV data. It uses Together AI LLMs, and the Code Interpreter SDK by E2B for the code interpreting capabilities. The SDK quickly creates a secure cloud sandbox powered by Firecracker. Inside this sandbox is a running Jupyter server that the LLM can use.
The AI agent performs a data analysis task on an uploaded CSV file, executes the AI-generated code in the sandboxed environment by E2B, and returns a chart, saving it as a PNG file. The code is processing the data in the CSV file, cleaning the data, and performing the assigned analysis, which includes plotting a chart.
Add your API keys to the corresponding part of the notebook.
- Get the E2B API KEY
- Get the TOGETHER AI API KEY
In the Python notebook, uncomment the model of your choice. The recommended code generation models to choose from are:
- Llama 3.3 70B Instruct Turbo
- Qwen 3.7 Plus and Qwen 3.6 Plus
- DeepSeek V4 Pro and DeepSeek V4 Flash
- Qwen 2.5 7B Instruct Turbo
See the complete list of Together AI models here.
The script performs the following steps:
- Loads the API keys from the environment variables.
- Uploads the CSV dataset to the E2B sandboxed cloud environment.
- Sends a prompt to the model to generate Python code for analyzing the dataset.
- Executes the generated Python code using the E2B Code Interpreter SDK.
- Saves any generated visualization as a PNG file.
After running the notebook, you should get the result of the data analysis task saved in an image_1.png file. You should see a plot like this:
If you encounter any problems, please let us know at our Discord.
Check the E2B documentation to learn more about how to use the Code Interpreter SDK.
