Visualization
VisualizationTools enables agents to create various types of charts and plots using matplotlib.
Example
The following agent can create various types of data visualizations:
1from kern.agent import Agent2from kern.tools.visualization import VisualizationTools34agent = Agent(5 instructions=[6 "You are a data visualization assistant that creates charts and plots",7 "Generate clear, informative visualizations based on user data",8 "Save charts to files and provide insights about the data",9 "Choose appropriate chart types for different data patterns",10 ],11 tools=[VisualizationTools(output_dir="my_charts")],12)1314agent.print_response("Create a bar chart showing sales by quarter: Q1=100, Q2=150, Q3=120, Q4=180", stream=True)Toolkit Params
| Parameter | Type | Default | Description |
|---|---|---|---|
output_dir | str | "charts" | Directory to save generated charts. |
enable_create_bar_chart | bool | True | Enable bar chart creation. |
enable_create_line_chart | bool | True | Enable line chart creation. |
enable_create_pie_chart | bool | True | Enable pie chart creation. |
enable_create_scatter_plot | bool | True | Enable scatter plot creation. |
enable_create_histogram | bool | True | Enable histogram creation. |
Toolkit Functions
| Function | Description |
|---|---|
create_bar_chart | Create bar charts for categorical data comparison. |
create_line_chart | Create line charts for time series and trend visualization. |
create_pie_chart | Create pie charts for proportional data representation. |
create_scatter_plot | Create scatter plots for correlation analysis. |
create_histogram | Create histograms for data distribution visualization. |