From 61d5bc37b9fc5cd53380d6ab64e412dab74df75a Mon Sep 17 00:00:00 2001 From: Liyun Xiu Date: Wed, 18 Sep 2024 15:05:39 +0800 Subject: [PATCH 1/3] Add query assist data summary agent template Signed-off-by: Liyun Xiu --- ...sist-data-summary-agent-claude-tested.json | 94 +++++++++++++++++++ ...ssist-data-summary-agent-claude-tested.yml | 71 ++++++++++++++ 2 files changed, 165 insertions(+) create mode 100644 sample-templates/query-assist-data-summary-agent-claude-tested.json create mode 100644 sample-templates/query-assist-data-summary-agent-claude-tested.yml diff --git a/sample-templates/query-assist-data-summary-agent-claude-tested.json b/sample-templates/query-assist-data-summary-agent-claude-tested.json new file mode 100644 index 000000000..281d115ca --- /dev/null +++ b/sample-templates/query-assist-data-summary-agent-claude-tested.json @@ -0,0 +1,94 @@ +{ + "name": "Query Assist Data Summary Agent", + "description": "Create Query Assist Data Summary Agent using Claude on BedRock", + "use_case": "REGISTER_AGENT", + "version": { + "template": "1.0.0", + "compatibility": ["2.17.0", "3.0.0"] + }, + "workflows": { + "provision": { + "user_params": {}, + "nodes": [ + { + "id": "create_claude_connector", + "type": "create_connector", + "previous_node_inputs": {}, + "user_inputs": { + "version": "1", + "name": "Claude instant runtime Connector", + "protocol": "aws_sigv4", + "description": "The connector to BedRock service for Claude model", + "actions": [ + { + "headers": { + "x-amz-content-sha256": "required", + "content-type": "application/json" + }, + "method": "POST", + "request_body": "{\"prompt\":\"${parameters.prompt}\", \"max_tokens_to_sample\":${parameters.max_tokens_to_sample}, \"temperature\":${parameters.temperature}, \"anthropic_version\":\"${parameters.anthropic_version}\" }", + "action_type": "predict", + "url": "https://bedrock-runtime.us-west-2.amazonaws.com/model/anthropic.claude-instant-v1/invoke" + } + ], + "credential": { + "access_key": "", + "secret_key": "", + "session_token": "" + }, + "parameters": { + "region": "us-west-2", + "endpoint": "bedrock-runtime.us-west-2.amazonaws.com", + "content_type": "application/json", + "auth": "Sig_V4", + "max_tokens_to_sample": "8000", + "service_name": "bedrock", + "temperature": "0.0001", + "response_filter": "$.completion", + "anthropic_version": "bedrock-2023-05-31" + } + } + }, + { + "id": "register_claude_model", + "type": "register_remote_model", + "previous_node_inputs": { + "create_claude_connector": "connector_id" + }, + "user_inputs": { + "description": "Claude model", + "deploy": true, + "name": "claude-instant" + } + }, + { + "id": "create_query_assist_data_summary_ml_model_tool", + "type": "create_tool", + "previous_node_inputs": { + "register_claude_model": "model_id" + }, + "user_inputs": { + "parameters": { + "prompt": "Human: You are an assistant that helps to summarize the data and provide data insights.\nThe data are queried from OpenSearch index through user's question which was translated into PPL query.\nHere is a sample PPL query: `source= | where = `.\nNow you are given ${parameters.sample_count} sample data out of ${parameters.total_count} total data.\nThe user's question is `${parameters.question}`, the translated PPL query is `${parameters.ppl}` and sample data are:\n```\n${parameters.sample_data}\n```\nCould you help provide a summary of the sample data and provide some useful insights with precise wording and in plain text format, do not use markdown format.\nYou don't need to echo my requirements in response.\n\nAssistant:" + }, + "name": "MLModelTool", + "type": "MLModelTool" + } + }, + { + "id": "create_query_assist_data_summary_agent", + "type": "register_agent", + "previous_node_inputs": { + "create_query_assist_data_summary_ml_model_tool": "tools" + }, + "user_inputs": { + "parameters": {}, + "type": "flow", + "name": "Query Assist Data Summary Agent", + "description": "this is an query assist data summary agent" + } + } + ] + } + } + } \ No newline at end of file diff --git a/sample-templates/query-assist-data-summary-agent-claude-tested.yml b/sample-templates/query-assist-data-summary-agent-claude-tested.yml new file mode 100644 index 000000000..40f8f4d29 --- /dev/null +++ b/sample-templates/query-assist-data-summary-agent-claude-tested.yml @@ -0,0 +1,71 @@ +--- +name: Query Assist Data Summary Agent +description: Create Query Assist Data Summary Agent using Claude on BedRock +use_case: REGISTER_AGENT +version: + template: 1.0.0 + compatibility: + - 2.17.0 + - 3.0.0 +workflows: + provision: + user_params: {} + nodes: + - id: create_claude_connector + type: create_connector + previous_node_inputs: {} + user_inputs: + version: '1' + name: Claude instant runtime Connector + protocol: aws_sigv4 + description: The connector to BedRock service for Claude model + actions: + - headers: + x-amz-content-sha256: required + content-type: application/json + method: POST + request_body: '{"prompt":"${parameters.prompt}", "max_tokens_to_sample":${parameters.max_tokens_to_sample}, + "temperature":${parameters.temperature}, "anthropic_version":"${parameters.anthropic_version}" + }' + action_type: predict + url: https://bedrock-runtime.us-west-2.amazonaws.com/model/anthropic.claude-instant-v1/invoke + credential: + access_key: "" + secret_key: "" + session_token: "" + parameters: + region: us-west-2 + endpoint: bedrock-runtime.us-west-2.amazonaws.com + content_type: application/json + auth: Sig_V4 + max_tokens_to_sample: '8000' + service_name: bedrock + temperature: '0.0001' + response_filter: "$.completion" + anthropic_version: bedrock-2023-05-31 + - id: register_claude_model + type: register_remote_model + previous_node_inputs: + create_claude_connector: connector_id + user_inputs: + description: Claude model + deploy: true + name: claude-instant + - id: create_query_assist_data_summary_ml_model_tool + type: create_tool + previous_node_inputs: + register_claude_model: model_id + user_inputs: + parameters: + prompt: "Human: You are an assistant that helps to summarize the data and provide data insights.\nThe data are queried from OpenSearch index through user's question which was translated into PPL query.\nHere is a sample PPL query: `source= | where = `.\nNow you are given ${parameters.sample_count} sample data out of ${parameters.total_count} total data.\nThe user's question is `${parameters.question}`, the translated PPL query is `${parameters.ppl}` and sample data are:\n```\n${parameters.sample_data}\n```\nCould you help provide a summary of the sample data and provide some useful insights with precise wording and in plain text format, do not use markdown format.\nYou don't need to echo my requirements in response.\n\nAssistant:" + name: MLModelTool + type: MLModelTool + - id: create_query_assist_data_summary_agent + type: register_agent + previous_node_inputs: + create_alert_summary_ml_model_tool: tools + user_inputs: + parameters: {} + type: flow + name: Query Assist Data Summary Agent + description: this is an query assist data summary agent \ No newline at end of file From 76381b03600be7fae58c71c27eed88ef9de222cf Mon Sep 17 00:00:00 2001 From: Liyun Xiu Date: Wed, 18 Sep 2024 15:16:51 +0800 Subject: [PATCH 2/3] spotlessApply Signed-off-by: Liyun Xiu --- .../query-assist-data-summary-agent-claude-tested.json | 2 +- .../query-assist-data-summary-agent-claude-tested.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sample-templates/query-assist-data-summary-agent-claude-tested.json b/sample-templates/query-assist-data-summary-agent-claude-tested.json index 281d115ca..50c339c56 100644 --- a/sample-templates/query-assist-data-summary-agent-claude-tested.json +++ b/sample-templates/query-assist-data-summary-agent-claude-tested.json @@ -91,4 +91,4 @@ ] } } - } \ No newline at end of file + } diff --git a/sample-templates/query-assist-data-summary-agent-claude-tested.yml b/sample-templates/query-assist-data-summary-agent-claude-tested.yml index 40f8f4d29..16c5036ab 100644 --- a/sample-templates/query-assist-data-summary-agent-claude-tested.yml +++ b/sample-templates/query-assist-data-summary-agent-claude-tested.yml @@ -68,4 +68,4 @@ workflows: parameters: {} type: flow name: Query Assist Data Summary Agent - description: this is an query assist data summary agent \ No newline at end of file + description: this is an query assist data summary agent From a17492f14d36027d8ee1f85413be019574998107 Mon Sep 17 00:00:00 2001 From: Liyun Xiu Date: Thu, 19 Sep 2024 09:09:34 +0800 Subject: [PATCH 3/3] Add changelog Signed-off-by: Liyun Xiu --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e734dbf2..d5a597f5a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,5 +20,6 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) ### Bug Fixes ### Infrastructure ### Documentation +- Add query assist data summary agent into sample templates ([#875](https://github.com/opensearch-project/flow-framework/pull/875)) ### Maintenance ### Refactoring