Skip to content

Commit 9509961

Browse files
authored
[Manual backport] Feat: add tests for alert summary, discovery summary and anonymous detect (#1778)
* add assistant tests Signed-off-by: yubonluo <[email protected]> * add monitor confirm Signed-off-by: yubonluo <[email protected]> * fix test stuck Signed-off-by: yubonluo <[email protected]> --------- Signed-off-by: yubonluo <[email protected]>
1 parent 707a4c7 commit 9509961

File tree

17 files changed

+1237
-54
lines changed

17 files changed

+1237
-54
lines changed

.github/workflows/assistant-release-e2e-workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
with:
5757
test-name: dashboards assistant
5858
test-command: env CYPRESS_DISABLE_LOCAL_CLUSTER=true CYPRESS_DATASOURCE_MANAGEMENT_ENABLED=true CYPRESS_DASHBOARDS_ASSISTANT_ENABLED=true CYPRESS_WORKSPACE_ENABLED=true yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/plugins/dashboards-assistant/mds_query_enhancements*.js'
59-
osd-serve-args: --data_source.enabled=true --data_source.ssl.verificationMode=none --data_source.hideLocalCluster=true --assistant.chat.enabled=true --uiSettings.overrides.home:useNewHomePage=true --uiSettings.overrides.query:enhancements:enabled=true --workspace.enabled=true --savedObjects.permission.enabled=true --assistant.text2viz.enabled=true --opensearchDashboards.dashboardAdmin.users='["admin"]' --opensearch_security.multitenancy.enabled=false
59+
osd-serve-args: --data_source.enabled=true --data_source.ssl.verificationMode=none --data_source.hideLocalCluster=true --assistant.chat.enabled=true --assistant.alertInsight.enabled=true --assistant.smartAnomalyDetector.enabled=true --queryEnhancements.queryAssist.summary.enabled=true --uiSettings.overrides.home:useNewHomePage=true --uiSettings.overrides.query:enhancements:enabled=true --workspace.enabled=true --savedObjects.permission.enabled=true --assistant.text2viz.enabled=true --opensearchDashboards.dashboardAdmin.users='["admin"]' --opensearch_security.multitenancy.enabled=false
6060
security-enabled: true
6161
artifact-name-suffix: "-with-query-enhancements"
6262

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
{
2+
"name": "alert_summary_test_monitor",
3+
"type": "monitor",
4+
"monitor_type": "query_level_monitor",
5+
"enabled": true,
6+
"schedule": {
7+
"period": {
8+
"interval": 1,
9+
"unit": "MINUTES"
10+
}
11+
},
12+
"inputs": [
13+
{
14+
"search": {
15+
"indices": [
16+
"opensearch_dashboards_sample_data_ecommerce"
17+
],
18+
"query": {
19+
"size": 0,
20+
"aggregations": {},
21+
"query": {
22+
"bool": {
23+
"filter": [
24+
{
25+
"range": {
26+
"order_date": {
27+
"gte": "{{period_end}}||-1h",
28+
"lte": "{{period_end}}",
29+
"format": "epoch_millis"
30+
}
31+
}
32+
}
33+
]
34+
}
35+
}
36+
}
37+
}
38+
}
39+
],
40+
"triggers": [
41+
{
42+
"name": "alert_summary_test_monitor",
43+
"severity": "1",
44+
"condition": {
45+
"script": {
46+
"lang": "painless",
47+
"source": "ctx.results[0].hits.total.value > 0"
48+
}
49+
},
50+
"min_time_between_executions": null,
51+
"rolling_window_size": null
52+
}
53+
],
54+
"ui_metadata": {
55+
"schedule": {
56+
"timezone": null,
57+
"frequency": "interval",
58+
"period": {
59+
"interval": 1,
60+
"unit": "MINUTES"
61+
},
62+
"daily": 0,
63+
"weekly": {
64+
"mon": false,
65+
"tue": false,
66+
"wed": false,
67+
"thur": false,
68+
"fri": false,
69+
"sat": false,
70+
"sun": false
71+
},
72+
"monthly": {
73+
"type": "day",
74+
"day": 1
75+
},
76+
"cronExpression": "0 */1 * * *"
77+
},
78+
"monitor_type": "query_level_monitor",
79+
"search": {
80+
"searchType": "graph",
81+
"timeField": "order_date",
82+
"aggregations": [],
83+
"groupBy": [],
84+
"bucketValue": 1,
85+
"bucketUnitOfTime": "h",
86+
"filters": []
87+
},
88+
"triggers": {
89+
"asd": {
90+
"value": 0,
91+
"enum": "ABOVE"
92+
}
93+
}
94+
}
95+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"completion":
3+
"The sample data indicates that there was 1 unique customer who placed orders this week. \n 1. The sample data indicates that there was 1 unique customer who placed orders this week. \n 2. The low number of unique customers placing orders in the current week could be affected by factors such as seasonality, promotions, or changes in the customer base, but further analysis of the full data set would be needed to determine if this is a typical trend or an anomaly. \n 3. The data represents a small sample and may not be representative of the overall customer base or order patterns, so additional data would be required to draw more meaningful conclusions.",
4+
"stop_reason": "stop_sequence",
5+
"stop": "\n\nHuman:"
6+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"name": "Cypress-register-data2summary-agent",
3+
"description": "Cypress Flow template",
4+
"use_case": "REGISTER_AGENT",
5+
"version": {
6+
"template": "1.0.0",
7+
"compatibility": ["2.12.0", "3.0.0"]
8+
},
9+
"workflows": {
10+
"provision": {
11+
"user_params": {},
12+
"nodes": [
13+
{
14+
"id": "create_connector_1",
15+
"type": "create_connector",
16+
"previous_node_inputs": {},
17+
"user_inputs": {
18+
"version": "1",
19+
"name": "Claude instant runtime data2summary Connector",
20+
"protocol": "aws_sigv4",
21+
"description": "The connector to BedRock service for claude model",
22+
"actions": [
23+
{
24+
"headers": {
25+
"x-amz-content-sha256": "required",
26+
"content-type": "application/json"
27+
},
28+
"method": "POST",
29+
"request_body": "{\"prompt\":\"${parameters.prompt}\", \"max_tokens_to_sample\":${parameters.max_tokens_to_sample}, \"temperature\":${parameters.temperature}, \"anthropic_version\":\"${parameters.anthropic_version}\" }",
30+
"action_type": "predict",
31+
"url": "http://127.0.0.1:3000"
32+
}
33+
],
34+
"credential": {
35+
"access_key": "<key>",
36+
"secret_key": "<value>"
37+
},
38+
"parameters": {
39+
"endpoint": "bedrock-runtime.us-west-2.amazonaws.com",
40+
"content_type": "application/json",
41+
"auth": "Sig_V4",
42+
"max_tokens_to_sample": "8000",
43+
"service_name": "bedrock",
44+
"temperature": "0.0001",
45+
"response_filter": "$.completion",
46+
"region": "us-west-2",
47+
"anthropic_version": "bedrock-2023-05-31"
48+
}
49+
}
50+
},
51+
{
52+
"id": "register_model_2",
53+
"type": "register_remote_model",
54+
"previous_node_inputs": {
55+
"create_connector_1": "connector_id"
56+
},
57+
"user_inputs": {
58+
"description": "test model",
59+
"deploy": true,
60+
"name": "claude-instant-data2summary"
61+
}
62+
},
63+
{
64+
"id": "ml_model_tool",
65+
"type": "create_tool",
66+
"previous_node_inputs": {
67+
"register_model_2": "model_id"
68+
},
69+
"user_inputs": {
70+
"parameters": {
71+
"prompt": "data2summary instruction agent prompt"
72+
},
73+
"description": "A general tool to answer any question.",
74+
"alias": "language_model_tool",
75+
"include_output_in_agent_response": true,
76+
"name": "data2summaryModelTool",
77+
"type": "MLModelTool"
78+
}
79+
},
80+
{
81+
"id": "os_data2summary",
82+
"type": "register_agent",
83+
"previous_node_inputs": {
84+
"register_model_2": "model_id",
85+
"ml_model_tool": "tools"
86+
},
87+
"user_inputs": {
88+
"parameters": {},
89+
"type": "flow",
90+
"name": "Query discover Summary Agent",
91+
"description": "this is a discover result summary agent",
92+
"tools_order": ["ml_model_tool"]
93+
}
94+
}
95+
]
96+
}
97+
}
98+
}
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
{
2+
"name": "Cypress-register-data2summary-agent",
3+
"description": "Cypress Flow template",
4+
"use_case": "REGISTER_AGENT",
5+
"version": {
6+
"template": "1.0.0",
7+
"compatibility": ["2.12.0", "3.0.0"]
8+
},
9+
"workflows": {
10+
"provision": {
11+
"user_params": {},
12+
"nodes": [
13+
{
14+
"id": "create_connector_1",
15+
"type": "create_connector",
16+
"previous_node_inputs": {},
17+
"user_inputs": {
18+
"version": "1",
19+
"name": "Claude instant runtime suggest ad Connector",
20+
"protocol": "aws_sigv4",
21+
"description": "The connector to BedRock service for claude model",
22+
"actions": [
23+
{
24+
"headers": {
25+
"x-amz-content-sha256": "required",
26+
"content-type": "application/json"
27+
},
28+
"method": "POST",
29+
"request_body": "{\"prompt\":\"${parameters.prompt}\", \"max_tokens_to_sample\":${parameters.max_tokens_to_sample}, \"temperature\":${parameters.temperature}, \"anthropic_version\":\"${parameters.anthropic_version}\" }",
30+
"action_type": "predict",
31+
"url": "http://127.0.0.1:3000"
32+
}
33+
],
34+
"credential": {
35+
"access_key": "<key>",
36+
"secret_key": "<value>"
37+
},
38+
"parameters": {
39+
"endpoint": "bedrock-runtime.us-west-2.amazonaws.com",
40+
"content_type": "application/json",
41+
"auth": "Sig_V4",
42+
"max_tokens_to_sample": "8000",
43+
"service_name": "bedrock",
44+
"temperature": "0.0001",
45+
"response_filter": "$.completion",
46+
"region": "us-west-2",
47+
"anthropic_version": "bedrock-2023-05-31"
48+
}
49+
}
50+
},
51+
{
52+
"id": "register_model_2",
53+
"type": "register_remote_model",
54+
"previous_node_inputs": {
55+
"create_connector_1": "connector_id"
56+
},
57+
"user_inputs": {
58+
"description": "test model",
59+
"deploy": true,
60+
"name": "claude-instant-suggest-ad"
61+
}
62+
},
63+
{
64+
"id": "ml_model_tool",
65+
"type": "create_tool",
66+
"previous_node_inputs": {
67+
"register_model_2": "model_id"
68+
},
69+
"user_inputs": {
70+
"parameters": {
71+
"prompt": "suggest_ad instruction agent prompt"
72+
},
73+
"description": "A general tool to answer any question.",
74+
"alias": "language_model_tool",
75+
"include_output_in_agent_response": true,
76+
"name": "CreateAnomalyDetectorTool",
77+
"type": "MLModelTool"
78+
}
79+
},
80+
{
81+
"id": "os_suggest_ad",
82+
"type": "register_agent",
83+
"previous_node_inputs": {
84+
"register_model_2": "model_id",
85+
"ml_model_tool": "tools"
86+
},
87+
"user_inputs": {
88+
"parameters": {},
89+
"type": "flow",
90+
"name": "Anomaly detector suggestion agent",
91+
"description": "this is the anomaly detector suggestion agent",
92+
"tools_order": ["ml_model_tool"]
93+
}
94+
}
95+
]
96+
}
97+
}
98+
}

0 commit comments

Comments
 (0)