generated from amazon-archives/__template_Custom
-
Notifications
You must be signed in to change notification settings - Fork 183
Open
Labels
Roadmap:Vector Database/GenAIProject-wide roadmap labelProject-wide roadmap labelenhancementNew feature or requestNew feature or requestv3.3.0
Description
Description
We need a flexible and extensible framework for processing outputs from ML models and tools using chainable processors. This is motivated by the different output formats returned by various models (e.g., Bedrock Claude vs OpenAI) and the current complexity of using Painless Script for post-processing.
Proposed Solution
Implement a processor chain framework that allows configuring multiple processors to transform tool/model outputs sequentially.
Built-in Processors
to_string
: Converts input to string formatregex_replace
: Performs regex-based text replacementjsonpath_filter
: Filters JSON using JsonPath expressionsextract_json
: Extracts JSON objects/arrays from textregex_capture
: Captures text using regex groupsremove_jsonpath
: Removes elements at specified JsonPathconditional
: Applies different processors based on conditions
Example Usage
Configure two output processors for ListIndexTool
- Use regex_replace to remove all lines contains index starting with .plugins
- Use regex_replace to remove first column row , since the row number will become wrong after removing lines
{
"name": "Test Agent",
"type": "flow",
"description": "This is a demo agent",
"tools": [
{
"type": "ListIndexTool",
"parameters": {
"output_processors": [
{
"type": "regex_replace",
"pattern": "(?m)^(?!row,health,status).*?,.*?,.*?,\\.plugins[^\\n]*\\n",
"replacement": ""
},
{
"type": "regex_replace",
"pattern": "(?m)^row,|^\\d+,",
"replacement": ""
}
]
}
}
]
}
Sample output
{
"inference_results": [
{
"output": [
{
"name": "response",
"result": """health,status,index,uuid,pri(number of primary shards),rep(number of replica shards),docs.count(number of available documents),docs.deleted(number of deleted documents),store.size(store size of primary and replica shards),pri.store.size(store size of primary shards)
yellow,open,ss4o_logs-otel-2025.09.22,aePQaQvuSmygcLXMZiZMpA,1,1,218380,0,117.8mb,117.8mb
yellow,open,jaeger-service-2025-09-20,W_c332tRQiaYyYA7Q93a5g,1,1,84,7,21.9kb,21.9kb
yellow,open,jaeger-service-2025-09-22,aG2VFQLMSVWcefCBAgo2iQ,1,1,84,0,50kb,50kb
yellow,open,jaeger-service-2025-09-23,rmO1fmMxQI2ovc_n-uHN2w,1,1,84,0,30.4kb,30.4kb
green,open,top_queries-2025.09.22-00440,lMQ-f2xtS4eLbNA19GdD2A,1,0,1755,0,639.2kb,639.2kb
yellow,open,jaeger-service-2025-09-24,zM41TnvyTEWkp1wSCwgPdQ,1,1,84,0,20kb,20kb
green,open,top_queries-2025.09.25-00443,epX66GgQSEeznqQoyglZFg,1,0,218,47,576.2kb,576.2kb
"""
}
]
}
]
}
Metadata
Metadata
Assignees
Labels
Roadmap:Vector Database/GenAIProject-wide roadmap labelProject-wide roadmap labelenhancementNew feature or requestNew feature or requestv3.3.0
Type
Projects
Status
In Progress
Status
New