Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AI Assistant] Set scope and rename to Observability and Search #196322

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
83f2b19
[AI Assistant] Set scope and rename to Observability and Search
sphilipse Oct 15, 2024
e9da40a
[CI] Auto-commit changed files from 'node scripts/lint_packages --fix'
kibanamachine Oct 15, 2024
8f84195
[CI] Auto-commit changed files from 'node scripts/lint_ts_projects --…
kibanamachine Oct 15, 2024
0fed35f
Remove scope UI setting and set default to all
sphilipse Oct 16, 2024
9130251
[CI] Auto-commit changed files from 'node scripts/yarn_deduplicate'
kibanamachine Oct 16, 2024
3b090bc
Make scopes multi-sided on both sides
sphilipse Oct 16, 2024
89b15b0
Filter functions based on required screencontexts as well
sphilipse Oct 16, 2024
9cece08
Fix FTRs
sphilipse Oct 16, 2024
34a5ed0
Remove silly test value from code
sphilipse Oct 16, 2024
5565690
Update kbn ai assistant package with scopes
sphilipse Oct 16, 2024
5f99a45
Fix serverless FTRs
sphilipse Oct 16, 2024
7962241
Fix ES function calling FTR
sphilipse Oct 16, 2024
d768314
fix scopes in more places
sphilipse Oct 17, 2024
7d122e7
Merge branch 'main' into search-assistant-set-scope-ui-setting
sphilipse Oct 17, 2024
3603216
Remove scopes from functiondefinition
sphilipse Oct 18, 2024
2e2bdb9
Make special case for system prompts
sphilipse Oct 18, 2024
08e29c1
Remove unused functionsubscription
sphilipse Oct 18, 2024
2e5b00d
Remove unused functionsubscription
sphilipse Oct 18, 2024
d947279
Remove scopes from registering instruction
sphilipse Oct 18, 2024
224004b
Merge branch 'main' into search-assistant-set-scope-ui-setting
sphilipse Oct 21, 2024
acdc9c8
Remove scope from function registration, use it as a parameter instead
sphilipse Oct 21, 2024
fdefbba
Move function scopes to functions themselves
sphilipse Oct 21, 2024
2902679
Fix test type
sphilipse Oct 21, 2024
7f23587
Fix apm functions
sphilipse Oct 21, 2024
b4b4373
Merge branch 'main' into search-assistant-set-scope-ui-setting
sphilipse Oct 22, 2024
ce0d1ba
Merge branch 'main' into search-assistant-set-scope-ui-setting
sphilipse Oct 23, 2024
117e97e
Merge branch 'main' into search-assistant-set-scope-ui-setting
sphilipse Oct 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/developer/plugin-list.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ Elastic.


|{kib-repo}blob/{branch}/x-pack/plugins/observability_solution/observability_ai_assistant_management/README.md[observabilityAiAssistantManagement]
|The observabilityAiAssistantManagement plugin manages the Ai Assistant for Observability management section.
|The observabilityAiAssistantManagement plugin manages the Ai Assistant for Observability and Search management section.


|{kib-repo}blob/{branch}/x-pack/plugins/observability_solution/observability_logs_explorer/README.md[observabilityLogsExplorer]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@
*/

export const PREFERRED_AI_ASSISTANT_TYPE_SETTING_KEY = 'aiAssistant:preferredAIAssistantType';
export const AI_ASSISTANT_DEFAULT_SCOPE_KEY = 'aiAssistant:defaultScope';
2 changes: 2 additions & 0 deletions src/plugins/ai_assistant_management/selection/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import type {

export { AIAssistantType } from '../common/ai_assistant_type';

export { AI_ASSISTANT_DEFAULT_SCOPE_KEY } from '../common/ui_setting_keys';

export type {
AIAssistantManagementSelectionPluginPublicSetup,
AIAssistantManagementSelectionPluginPublicStart,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ export function AiAssistantSelectionPage() {
isDisabled={!observabilityAIAssistantEnabled}
title={i18n.translate(
'aiAssistantManagementSelection.aiAssistantSelectionPage.observabilityLabel',
{ defaultMessage: 'Elastic AI Assistant for Observability' }
{ defaultMessage: 'Elastic AI Assistant for Observability and Search' }
)}
titleSize="xs"
/>
Expand Down
40 changes: 36 additions & 4 deletions src/plugins/ai_assistant_management/selection/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ import type {
AIAssistantManagementSelectionPluginServerStart,
} from './types';
import { AIAssistantType } from '../common/ai_assistant_type';
import { PREFERRED_AI_ASSISTANT_TYPE_SETTING_KEY } from '../common/ui_setting_keys';
import {
AI_ASSISTANT_DEFAULT_SCOPE_KEY,
PREFERRED_AI_ASSISTANT_TYPE_SETTING_KEY,
} from '../common/ui_setting_keys';

export class AIAssistantManagementSelectionPlugin
implements
Expand All @@ -50,15 +53,15 @@ export class AIAssistantManagementSelectionPlugin
core.uiSettings.register({
[PREFERRED_AI_ASSISTANT_TYPE_SETTING_KEY]: {
name: i18n.translate('aiAssistantManagementSelection.preferredAIAssistantTypeSettingName', {
defaultMessage: 'Observability AI Assistant scope',
defaultMessage: 'AI Assistant for Observability and Search visibility',
}),
category: [DEFAULT_APP_CATEGORIES.observability.id],
value: this.config.preferredAIAssistantType,
description: i18n.translate(
'aiAssistantManagementSelection.preferredAIAssistantTypeSettingDescription',
{
defaultMessage:
'<em>[technical preview]</em> Whether to show the Observability AI Assistant menu item in Observability, everywhere, or nowhere.',
'<em>[technical preview]</em> Whether to show the AI Assistant menu item in Observability and Search, everywhere, or nowhere.',
values: {
em: (chunks) => `<em>${chunks}</em>`,
},
Expand All @@ -77,7 +80,7 @@ export class AIAssistantManagementSelectionPlugin
optionLabels: {
[AIAssistantType.Default]: i18n.translate(
'aiAssistantManagementSelection.preferredAIAssistantTypeSettingValueDefault',
{ defaultMessage: 'Observability only (default)' }
{ defaultMessage: 'Observability and Search only (default)' }
),
[AIAssistantType.Observability]: i18n.translate(
'aiAssistantManagementSelection.preferredAIAssistantTypeSettingValueObservability',
Expand All @@ -90,6 +93,35 @@ export class AIAssistantManagementSelectionPlugin
},
requiresPageReload: true,
},
[AI_ASSISTANT_DEFAULT_SCOPE_KEY]: {
sphilipse marked this conversation as resolved.
Show resolved Hide resolved
category: ['observability'],
name: i18n.translate('aiAssistantManagementSelection.defaultScopeName', {
defaultMessage: 'AI assistant default scope',
}),
value: '',
description: i18n.translate(
'aiAssistantManagementSelection.settingsPage.defaultScopeDescription',
{
defaultMessage:
'Defines the default behavior of the AI assistant in pages outside Observability and Search. This determines which functions are available to the assistant, and the system prompt it uses.',
}
),
schema: schema.oneOf([schema.literal('search'), schema.literal('observability')], {
defaultValue: 'search',
}),
options: ['search', 'observability'],
type: 'select',
optionLabels: {
['observability']: i18n.translate(
'aiAssistantManagementSelection.defaultScopeValueObservability',
{ defaultMessage: 'Observability' }
),
['search']: i18n.translate('aiAssistantManagementSelection.defaultScopeSearch', {
defaultMessage: 'Search',
}),
},
requiresPageReload: true,
},
});

core.capabilities.registerProvider(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,30 @@
"id": "observabilityAIAssistant",
"server": true,
"browser": true,
"configPath": ["xpack", "observabilityAIAssistant"],
"configPath": [
"xpack",
"observabilityAIAssistant"
],
"requiredPlugins": [
"actions",
"features",
"licensing",
"security",
"taskManager",
"dataViews",
"aiAssistantManagementSelection"
],
"requiredBundles": [
"kibanaReact",
"kibanaUtils"
],
"optionalPlugins": [
"cloud",
"serverless"
],
"requiredBundles": ["kibanaReact", "kibanaUtils"],
"optionalPlugins": ["cloud", "serverless"],
"extraPublicDirs": [],
"runtimePluginDependencies": [ "ml" ]
"runtimePluginDependencies": [
"ml"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import type { Logger } from '@kbn/logging';
import { withSuspense } from '@kbn/shared-ux-utility';
import React, { type ComponentType, lazy, type Ref } from 'react';
import { AssistantScope } from '@kbn/ai-assistant-common';
import { AI_ASSISTANT_DEFAULT_SCOPE_KEY } from '@kbn/ai-assistant-management-plugin/public';
import { registerTelemetryEventTypes } from './analytics';
import { ObservabilityAIAssistantChatServiceContext } from './context/observability_ai_assistant_chat_service_context';
import { ObservabilityAIAssistantMultipaneFlyoutContext } from './context/observability_ai_assistant_multipane_flyout_context';
Expand Down Expand Up @@ -60,14 +61,15 @@ export class ObservabilityAIAssistantPlugin
coreStart: CoreStart,
pluginsStart: ObservabilityAIAssistantPluginStartDependencies
): ObservabilityAIAssistantPublicStart {
const scopeFromUiSettings = coreStart.uiSettings.get(AI_ASSISTANT_DEFAULT_SCOPE_KEY);
const service = (this.service = createService({
analytics: coreStart.analytics,
coreStart,
enabled:
coreStart.application.capabilities.observabilityAIAssistant[
aiAssistantCapabilities.show
] === true,
scope: this.scopeFromConfig || 'observability',
scope: this.scopeFromConfig || scopeFromUiSettings || 'search',
sphilipse marked this conversation as resolved.
Show resolved Hide resolved
scopeIsMutable: !!this.scopeFromConfig,
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const registerFunctions: RegistrationCallback = async ({

DO NOT UNDER ANY CIRCUMSTANCES USE ES|QL syntax (\`service.name == "foo"\`) with "kqlFilter" (\`service.name:"foo"\`).

The user is able to change the language which they want you to reply in on the settings page of the AI Assistant for Observability, which can be found in the ${
The user is able to change the language which they want you to reply in on the settings page of the AI Assistant for Observability and Search, which can be found in the ${
isServerless ? `Project settings.` : `Stack Management app under the option AI Assistants`
}.
If the user asks how to change the language, reply in the same language the user asked in.`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
"@kbn/core-ui-settings-server",
"@kbn/inference-plugin",
"@kbn/management-settings-ids",
"@kbn/ai-assistant-common"
"@kbn/ai-assistant-common",
"@kbn/ai-assistant-management-plugin"
],
"exclude": ["target/**/*"]
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# `observabilityAiAssistantManagement` plugin

The `observabilityAiAssistantManagement` plugin manages the `Ai Assistant for Observability` management section.
The `observabilityAiAssistantManagement` plugin manages the `Ai Assistant for Observability and Search` management section.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,25 @@
"id": "observabilityAiAssistantManagement",
"server": true,
"browser": true,
"configPath": ["xpack", "observabilityAiAssistantManagement"],
"requiredPlugins": ["management", "observabilityAIAssistant", "observabilityShared"],
"optionalPlugins": ["actions", "home", "serverless", "enterpriseSearch"],
"requiredBundles": ["kibanaReact", "logsDataAccess"]
"configPath": [
"xpack",
"observabilityAiAssistantManagement"
],
"requiredPlugins": [
"management",
"observabilityAIAssistant",
"observabilityShared",
"aiAssistantManagementSelection"
],
"optionalPlugins": [
"actions",
"home",
"serverless",
"enterpriseSearch"
],
"requiredBundles": [
"kibanaReact",
"logsDataAccess"
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export const mountManagementSection = async ({ core, mountParams }: MountParams)

coreStart.chrome.docTitle.change(
i18n.translate('xpack.observabilityAiAssistantManagement.app.titleBar', {
defaultMessage: 'AI Assistant for Observability Settings',
defaultMessage: 'AI Assistant for Observability and Search Settings',
})
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ export class AiAssistantManagementObservabilityPlugin
{ home, management, observabilityAIAssistant }: SetupDependencies
): AiAssistantManagementObservabilityPluginSetup {
const title = i18n.translate('xpack.observabilityAiAssistantManagement.app.title', {
defaultMessage: 'AI Assistant for Observability',
defaultMessage: 'AI Assistant for Observability and Search',
});

if (home) {
home.featureCatalogue.register({
id: 'ai_assistant_observability',
title,
description: i18n.translate('xpack.observabilityAiAssistantManagement.app.description', {
defaultMessage: 'Manage your AI Assistant for Observability.',
defaultMessage: 'Manage your AI Assistant for Observability and Search.',
}),
icon: 'sparkles',
path: '/app/management/kibana/ai-assistant/observability',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function SettingsPage() {
text: i18n.translate(
'xpack.observabilityAiAssistantManagement.breadcrumb.serverless.observability',
{
defaultMessage: 'AI Assistant for Observability Settings',
defaultMessage: 'AI Assistant for Observability and Search Settings',
}
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function SettingsTab() {
'xpack.observabilityAiAssistantManagement.settingsPage.euiDescribedFormGroup.inOrderToUseLabel',
{
defaultMessage:
'In order to use the Observability AI Assistant you must set up a Generative AI connector.',
'In order to use the AI Assistant you must set up a Generative AI connector.',
}
)}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ import { EuiSpacer } from '@elastic/eui';
import { isEmpty } from 'lodash';
import { i18n } from '@kbn/i18n';
import { LogSourcesSettingSynchronisationInfo } from '@kbn/logs-data-access-plugin/public';
import { AI_ASSISTANT_DEFAULT_SCOPE_KEY } from '@kbn/ai-assistant-management-plugin/public';
import { useKibana } from '../../../hooks/use_kibana';

const settingsKeys = [
aiAssistantSimulatedFunctionCalling,
aiAssistantSearchConnectorIndexPattern,
aiAssistantPreferredAIAssistantType,
AI_ASSISTANT_DEFAULT_SCOPE_KEY,
];

export function UISettings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"@kbn/observability-shared-plugin",
"@kbn/config-schema",
"@kbn/core-ui-settings-common",
"@kbn/logs-data-access-plugin"
"@kbn/logs-data-access-plugin",
"@kbn/ai-assistant-management-plugin"
],
"exclude": ["target/**/*"]
}
2 changes: 1 addition & 1 deletion x-pack/plugins/search_assistant/server/functions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const registerFunctions: (isServerless: boolean) => RegistrationCallback
If you want to call a function or tool, only call it a single time per message. Wait until the function has been executed and its results
returned to you, before executing the same tool or another tool again if needed.

The user is able to change the language which they want you to reply in on the settings page of the AI Assistant for Observability, which can be found in the ${
The user is able to change the language which they want you to reply in on the settings page of the AI Assistant for Observability and Search, which can be found in the ${
isServerless ? `Project settings.` : `Stack Management app under the option AI Assistants`
}.
If the user asks how to change the language, reply in the same language the user asked in.`,
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/serverless_observability/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export class ServerlessObservabilityPlugin
observabilityAiAssistantManagement: {
category: appCategories.OTHER,
title: i18n.translate('xpack.serverlessObservability.aiAssistantManagementTitle', {
defaultMessage: 'AI Assistant for Observability Settings',
defaultMessage: 'AI Assistant for Observability and Search Settings',
}),
description: i18n.translate(
'xpack.serverlessObservability.aiAssistantManagementDescription',
Expand Down