From c5fc11f44c264437b35b4e2f7103134d2a983896 Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Wed, 13 Nov 2024 12:02:46 +0800 Subject: [PATCH 1/4] Fix alert summary prompt Signed-off-by: Heng Qian --- sample-templates/alert-summary-agent-claude-tested.json | 2 +- sample-templates/alert-summary-agent-claude-tested.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sample-templates/alert-summary-agent-claude-tested.json b/sample-templates/alert-summary-agent-claude-tested.json index ab064f5a4..4250a1026 100644 --- a/sample-templates/alert-summary-agent-claude-tested.json +++ b/sample-templates/alert-summary-agent-claude-tested.json @@ -69,7 +69,7 @@ }, "user_inputs": { "parameters": { - "prompt": "You are an OpenSearch Alert Assistant to help summarize the alerts.\n Here is the detail of alert: ${parameters.context};\n The question is: ${parameters.question}." + "prompt": "\n\nHuman: You are an OpenSearch Alert Assistant to help summarize the alerts.\n Here is the detail of alert: ${parameters.context};\n The question is: ${parameters.question}." }, "name": "MLModelTool", "type": "MLModelTool" diff --git a/sample-templates/alert-summary-agent-claude-tested.yml b/sample-templates/alert-summary-agent-claude-tested.yml index ce596e071..f47f3213a 100644 --- a/sample-templates/alert-summary-agent-claude-tested.yml +++ b/sample-templates/alert-summary-agent-claude-tested.yml @@ -57,7 +57,7 @@ workflows: register_claude_model: model_id user_inputs: parameters: - prompt: "You are an OpenSearch Alert Assistant to help summarize the alerts.\n Here is the detail of alert: ${parameters.context};\n The question is: ${parameters.question}." + prompt: "\n\nHuman: You are an OpenSearch Alert Assistant to help summarize the alerts.\n Here is the detail of alert: ${parameters.context};\n The question is: ${parameters.question}." name: MLModelTool type: MLModelTool - id: create_alert_summary_agent From 6afa3e1980bf9c47bae98eecbec7e8e9e090555a Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Wed, 13 Nov 2024 12:12:51 +0800 Subject: [PATCH 2/4] Update CHANGELOG Signed-off-by: Heng Qian --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b1f657e4..4c876a1e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) ### Features ### Enhancements ### Bug Fixes +- Fix alert summary prompt ([#958](https://github.com/opensearch-project/flow-framework/pull/958)) + ### Infrastructure - Set Java target compatibility to JDK 21 ([#730](https://github.com/opensearch-project/flow-framework/pull/730)) From b32f98bedfbab1c19c225845737c72489789f956 Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Wed, 13 Nov 2024 14:53:05 +0800 Subject: [PATCH 3/4] Revert "Update CHANGELOG" Signed-off-by: Heng Qian --- CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4c876a1e8..7b1f657e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,6 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) ### Features ### Enhancements ### Bug Fixes -- Fix alert summary prompt ([#958](https://github.com/opensearch-project/flow-framework/pull/958)) - ### Infrastructure - Set Java target compatibility to JDK 21 ([#730](https://github.com/opensearch-project/flow-framework/pull/730)) From 9ce16b367fca085f76bb9278bdd7474faa4fa20b Mon Sep 17 00:00:00 2001 From: Heng Qian Date: Thu, 14 Nov 2024 16:07:32 +0800 Subject: [PATCH 4/4] Add prefix and postfix in requestbody Signed-off-by: Heng Qian --- sample-templates/alert-summary-agent-claude-tested.json | 4 ++-- sample-templates/alert-summary-agent-claude-tested.yml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sample-templates/alert-summary-agent-claude-tested.json b/sample-templates/alert-summary-agent-claude-tested.json index 4250a1026..d025fddc0 100644 --- a/sample-templates/alert-summary-agent-claude-tested.json +++ b/sample-templates/alert-summary-agent-claude-tested.json @@ -26,7 +26,7 @@ "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}\" }", + "request_body": "{\"prompt\":\"\\n\\nHuman: ${parameters.prompt}\\n\\nAssistant:\", \"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" } @@ -69,7 +69,7 @@ }, "user_inputs": { "parameters": { - "prompt": "\n\nHuman: You are an OpenSearch Alert Assistant to help summarize the alerts.\n Here is the detail of alert: ${parameters.context};\n The question is: ${parameters.question}." + "prompt": "You are an OpenSearch Alert Assistant to help summarize the alerts.\n Here is the detail of alert: ${parameters.context};\n The question is: ${parameters.question}." }, "name": "MLModelTool", "type": "MLModelTool" diff --git a/sample-templates/alert-summary-agent-claude-tested.yml b/sample-templates/alert-summary-agent-claude-tested.yml index f47f3213a..f1d03d080 100644 --- a/sample-templates/alert-summary-agent-claude-tested.yml +++ b/sample-templates/alert-summary-agent-claude-tested.yml @@ -24,7 +24,7 @@ workflows: 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}, + request_body: '{"prompt":"\n\nHuman: ${parameters.prompt}\n\nAssistant:", "max_tokens_to_sample":${parameters.max_tokens_to_sample}, "temperature":${parameters.temperature}, "anthropic_version":"${parameters.anthropic_version}" }' action_type: predict @@ -57,7 +57,7 @@ workflows: register_claude_model: model_id user_inputs: parameters: - prompt: "\n\nHuman: You are an OpenSearch Alert Assistant to help summarize the alerts.\n Here is the detail of alert: ${parameters.context};\n The question is: ${parameters.question}." + prompt: "You are an OpenSearch Alert Assistant to help summarize the alerts.\n Here is the detail of alert: ${parameters.context};\n The question is: ${parameters.question}." name: MLModelTool type: MLModelTool - id: create_alert_summary_agent