Skip to main content
Version: 0.12.0

Visualization tool

Introduced 0.5.0

Use the VisualizationTool to find saved visualizations whose titles match a search term. The tool runs a plain search against a saved-object index (default .kibana): it filters for documents of type: visualization and matches your input against the visualization.title field, then returns the matching results in CSV format with two columns, Title and Id. No large language model (LLM) is involved.

Note The implementing class in the shipped ML Commons module is VisualizationsTool, but the registered tool type is VisualizationTool, without the s. Use the type shown in the examples on this page.

Note Saved visualizations are stored in a saved-object index (default .kibana) created by OpenSearch Dashboards. Lucenia does not ship OpenSearch Dashboards, so a stock Lucenia cluster is unlikely to contain such an index. This tool returns results only if a compatible saved-object index is present.

Step 1: Register a flow agent that will run the VisualizationTool

A flow agent runs a sequence of tools in order and returns the last tool's output. To create a flow agent, send the following register agent request:

POST /_plugins/_ml/agents/_register
{
"name": "Test_Agent_For_Visualization_tool",
"type": "flow",
"description": "this is a test agent for the VisuailizationTool",
"tools": [
{
"type": "VisualizationTool",
"name": "DemoVisualizationTool",
"parameters": {
"index": ".kibana",
"input": "${parameters.question}",
"size": 3
}
}
]
}

For parameter descriptions, see Register parameters.

Lucenia responds with an agent ID:

{
"agent_id": "9X7xWI0Bpc3sThaJdY9i"
}

Step 2: Run the agent

Run the agent by sending the following request. The question parameter is used as the search term that is matched against saved visualization titles:

POST /_plugins/_ml/agents/9X7xWI0Bpc3sThaJdY9i/_execute
{
"parameters": {
"question": "Revenue"
}
}

By default, Lucenia returns the top three matching visualizations. You can use the size parameter to specify the number of results returned. If no compatible saved-object index exists or nothing matches, the tool returns No Visualization found. The output is returned in CSV format with two columns: Title (the saved visualization title) and Id (a unique ID for this visualization):

{
"inference_results": [
{
"output": [
{
"name": "response",
"result": """Title,Id
[eCommerce] Total Revenue,10f1a240-b891-11e8-a6d9-e546fe2bba5f
"""
}
]
}
]
}

Register parameters

The following table lists all tool parameters that are available when registering an agent.

ParameterTypeRequired/OptionalDescription
inputStringRequiredThe search term matched against the visualization.title field of saved visualizations.
indexStringOptionalThe saved-object index to search. Default is .kibana.
sizeIntegerOptionalThe number of visualizations to return. Default is 3.

Execute parameters

The following table lists all tool parameters that are available when running the agent.

ParameterTypeRequired/OptionalDescription
questionStringRequiredThe search term matched against saved visualization titles.