Run LLM-generated code to analyze data and produce graphs
generate_code()
function, along with a prompt for the LLM:
generate_code(csv_sample)
in main()
. We’ll only send a few rows of our CSV data to the LLM, because that’s all it needs to understand the shape of the data:
pandas
, matplotlib
, and seaborn
. We’re asking the LLM to write code to analyze and visualize data, so we want it to be able to use these popular libraries.
By default, Riza provides access to standard libraries. To use additional libraries, you can create a
custom runtime. We’ll do that in the next step.pandas
, matplotlib
, and seaborn
in its parsing code. To make these libraries available on Riza, we’ll create a custom runtime.
Follow these steps:
Field | Value |
---|---|
Language | Python |
requirements.txt | pandas matplotlib seaborn |
run_code()
, that calls the Riza Execute Function API and uses our custom runtime.
Make sure to fill in your own runtime ID:
main()
function to run the generated code, and save the resulting image: