Skip to content

Commit 2d36c65

Browse files
[8.18] [Observability AI Assistant] rule connector - handle multiple prompt (#209221) (#210050)
# Backport This will backport the following commits from `main` to `8.18`: - [[Observability AI Assistant] rule connector - handle multiple prompt (#209221)](#209221) <!--- Backport version: 9.6.4 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Arturo Lidueña","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-02-05T09:16:42Z","message":"[Observability AI Assistant] rule connector - handle multiple prompt (#209221)\n\nIntermediate releases to change rule or connector schemas in serverless\r\nfor #185032\r\n\r\n## Summary\r\n\r\nAn Observability AI Assistant connector is available to be set as action\r\nfor Observability rules. When an alert is triggered, a conversation with\r\nthe AI assistant will be created sending the initial prompt set by the\r\nuser in the rule action. The conversation is then stored and can be\r\nretrieved from the AI Assistant interface. the action is triggered on\r\nany status change of the alert (active, recovered, untracked), creating\r\na new conversation for each of them using the same initial prompt which\r\nmay not be suitable for the 3 cases.\r\n\r\nImprovement\r\nThe user is able to choose in when the action should be run (active,\r\nrecovered, untracked, all),. That would allow the user to specify more\r\nthan one AI Assistant action, with a different and more suitable prompt\r\nin each case.","sha":"3924e095c5d9791e7a83208fdde6e542de1475bb","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["backport missing","release_note:feature","Team:Obs AI Assistant","backport:version","v8.18.0","v9.1.0"],"title":"[Observability AI Assistant] rule connector - handle multiple prompt ","number":209221,"url":"https://github.com/elastic/kibana/pull/209221","mergeCommit":{"message":"[Observability AI Assistant] rule connector - handle multiple prompt (#209221)\n\nIntermediate releases to change rule or connector schemas in serverless\r\nfor #185032\r\n\r\n## Summary\r\n\r\nAn Observability AI Assistant connector is available to be set as action\r\nfor Observability rules. When an alert is triggered, a conversation with\r\nthe AI assistant will be created sending the initial prompt set by the\r\nuser in the rule action. The conversation is then stored and can be\r\nretrieved from the AI Assistant interface. the action is triggered on\r\nany status change of the alert (active, recovered, untracked), creating\r\na new conversation for each of them using the same initial prompt which\r\nmay not be suitable for the 3 cases.\r\n\r\nImprovement\r\nThe user is able to choose in when the action should be run (active,\r\nrecovered, untracked, all),. That would allow the user to specify more\r\nthan one AI Assistant action, with a different and more suitable prompt\r\nin each case.","sha":"3924e095c5d9791e7a83208fdde6e542de1475bb"}},"sourceBranch":"main","suggestedTargetBranches":["8.18"],"targetPullRequestStates":[{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/209221","number":209221,"mergeCommit":{"message":"[Observability AI Assistant] rule connector - handle multiple prompt (#209221)\n\nIntermediate releases to change rule or connector schemas in serverless\r\nfor #185032\r\n\r\n## Summary\r\n\r\nAn Observability AI Assistant connector is available to be set as action\r\nfor Observability rules. When an alert is triggered, a conversation with\r\nthe AI assistant will be created sending the initial prompt set by the\r\nuser in the rule action. The conversation is then stored and can be\r\nretrieved from the AI Assistant interface. the action is triggered on\r\nany status change of the alert (active, recovered, untracked), creating\r\na new conversation for each of them using the same initial prompt which\r\nmay not be suitable for the 3 cases.\r\n\r\nImprovement\r\nThe user is able to choose in when the action should be run (active,\r\nrecovered, untracked, all),. That would allow the user to specify more\r\nthan one AI Assistant action, with a different and more suitable prompt\r\nin each case.","sha":"3924e095c5d9791e7a83208fdde6e542de1475bb"}}]}] BACKPORT-->
1 parent 4ffa5a5 commit 2d36c65

File tree

7 files changed

+399
-146
lines changed

7 files changed

+399
-146
lines changed

x-pack/platform/plugins/shared/actions/server/integration_tests/__snapshots__/connector_types.test.ts.snap

Lines changed: 59 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License
4+
* 2.0; you may not use this file except in compliance with the Elastic License
5+
* 2.0.
6+
*/
7+
8+
import {
9+
ALERT_STATUS_ACTIVE,
10+
ALERT_STATUS_RECOVERED,
11+
ALERT_STATUS_UNTRACKED,
12+
} from '@kbn/rule-data-utils';
13+
14+
export const ALERT_STATUSES = [ALERT_STATUS_ACTIVE, ALERT_STATUS_RECOVERED, ALERT_STATUS_UNTRACKED];

x-pack/solutions/observability/plugins/observability_ai_assistant_app/public/rule_connector/ai_assistant.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ export function getConnectorType(
3636
actionParams: ObsAIAssistantActionParams
3737
): Promise<GenericValidationResult<ObsAIAssistantActionParams>> => {
3838
const validationResult = {
39-
errors: { connector: new Array<string>(), message: new Array<string>() },
39+
errors: {
40+
connector: [] as string[],
41+
message: [] as string[],
42+
prompts: [] as string[],
43+
},
4044
};
4145

4246
if (!actionParams.connector) {

x-pack/solutions/observability/plugins/observability_ai_assistant_app/public/rule_connector/types.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,9 @@
77

88
export interface ObsAIAssistantActionParams {
99
connector: string;
10-
message: string;
10+
prompts?: Array<{
11+
message: string;
12+
statuses: string[];
13+
}>;
14+
message?: string; // this is a legacy field
1115
}

0 commit comments

Comments
 (0)