Skip to content

Commit

Permalink
[Inference Endpoints View] Deletion, search and filtering of inferenc…
Browse files Browse the repository at this point in the history
…e endpoints (#186206)

This PR consists of the following changes:
- An option to delete an existing inference endpoint
- Filtering the endpoints based on 'provider' and 'type'
- Search option
- Display the trained models deployment status
- Display additional 3rd party providers (Mistral, Azure OpenAI, Azure
AI Studio)
- Add licensing for gating enterprise licensed users

### Stack Management
![Screenshot 2024-06-24 at 2 38
44 PM](https://github.com/elastic/kibana/assets/132922331/d8072069-2309-40b9-a723-6b34f64b7ef0)

### Serverless
![Screenshot 2024-06-24 at 2 43
36 PM](https://github.com/elastic/kibana/assets/132922331/fe5be2fd-d9ca-41f7-b246-8767e88d2938)

---------

Co-authored-by: Liam Thompson <[email protected]>
(cherry picked from commit ff651f2)
  • Loading branch information
saikatsarkar056 committed Jul 9, 2024
1 parent 2193e94 commit db303e1
Show file tree
Hide file tree
Showing 70 changed files with 2,458 additions and 204 deletions.
2 changes: 1 addition & 1 deletion packages/deeplinks/search/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

export const ENTERPRISE_SEARCH_APP_ID = 'enterpriseSearch';
export const ENTERPRISE_SEARCH_CONTENT_APP_ID = 'enterpriseSearchContent';
export const ENTERPRISE_SEARCH_INFERENCE_ENDPOINTS_APP_ID = 'enterpriseSearchInferenceEndpoints';
export const ENTERPRISE_SEARCH_RELEVANCE_APP_ID = 'enterpriseSearchRelevance';
export const ENTERPRISE_SEARCH_APPLICATIONS_APP_ID = 'enterpriseSearchApplications';
export const ENTERPRISE_SEARCH_ANALYTICS_APP_ID = 'enterpriseSearchAnalytics';
export const ENTERPRISE_SEARCH_APPSEARCH_APP_ID = 'appSearch';
Expand Down
8 changes: 7 additions & 1 deletion packages/deeplinks/search/deep_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
ENTERPRISE_SEARCH_APP_ID,
ENTERPRISE_SEARCH_CONTENT_APP_ID,
ENTERPRISE_SEARCH_APPLICATIONS_APP_ID,
ENTERPRISE_SEARCH_RELEVANCE_APP_ID,
ENTERPRISE_SEARCH_ANALYTICS_APP_ID,
ENTERPRISE_SEARCH_APPSEARCH_APP_ID,
ENTERPRISE_SEARCH_WORKPLACESEARCH_APP_ID,
Expand All @@ -23,6 +24,7 @@ import {
export type EnterpriseSearchApp = typeof ENTERPRISE_SEARCH_APP_ID;
export type EnterpriseSearchContentApp = typeof ENTERPRISE_SEARCH_CONTENT_APP_ID;
export type EnterpriseSearchApplicationsApp = typeof ENTERPRISE_SEARCH_APPLICATIONS_APP_ID;
export type EnterpriseSearchRelevanceApp = typeof ENTERPRISE_SEARCH_RELEVANCE_APP_ID;
export type EnterpriseSearchAnalyticsApp = typeof ENTERPRISE_SEARCH_ANALYTICS_APP_ID;
export type EnterpriseSearchAppsearchApp = typeof ENTERPRISE_SEARCH_APPSEARCH_APP_ID;
export type EnterpriseSearchWorkplaceSearchApp = typeof ENTERPRISE_SEARCH_WORKPLACESEARCH_APP_ID;
Expand All @@ -38,10 +40,13 @@ export type ApplicationsLinkId = 'searchApplications' | 'playground';

export type AppsearchLinkId = 'engines';

export type RelevanceLinkId = 'inferenceEndpoints';

export type DeepLinkId =
| EnterpriseSearchApp
| EnterpriseSearchContentApp
| EnterpriseSearchApplicationsApp
| EnterpriseSearchRelevanceApp
| EnterpriseSearchAnalyticsApp
| EnterpriseSearchAppsearchApp
| EnterpriseSearchWorkplaceSearchApp
Expand All @@ -52,4 +57,5 @@ export type DeepLinkId =
| SearchHomepage
| `${EnterpriseSearchContentApp}:${ContentLinkId}`
| `${EnterpriseSearchApplicationsApp}:${ApplicationsLinkId}`
| `${EnterpriseSearchAppsearchApp}:${AppsearchLinkId}`;
| `${EnterpriseSearchAppsearchApp}:${AppsearchLinkId}`
| `${EnterpriseSearchRelevanceApp}:${RelevanceLinkId}`;
2 changes: 1 addition & 1 deletion packages/deeplinks/search/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
export {
ENTERPRISE_SEARCH_APP_ID,
ENTERPRISE_SEARCH_CONTENT_APP_ID,
ENTERPRISE_SEARCH_INFERENCE_ENDPOINTS_APP_ID,
ENTERPRISE_SEARCH_RELEVANCE_APP_ID,
ENTERPRISE_SEARCH_APPLICATIONS_APP_ID,
ENTERPRISE_SEARCH_ANALYTICS_APP_ID,
ENTERPRISE_SEARCH_APPSEARCH_APP_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const applicationUsageSchema = {
canvas: commonSchema,
enterpriseSearch: commonSchema,
enterpriseSearchContent: commonSchema,
enterpriseSearchInferenceEndpoints: commonSchema,
enterpriseSearchRelevance: commonSchema,
enterpriseSearchAnalytics: commonSchema,
enterpriseSearchApplications: commonSchema,
enterpriseSearchAISearch: commonSchema,
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/telemetry/schema/oss_plugins.json
Original file line number Diff line number Diff line change
Expand Up @@ -2098,7 +2098,7 @@
}
}
},
"enterpriseSearchInferenceEndpoints": {
"enterpriseSearchRelevance": {
"properties": {
"appId": {
"type": "keyword",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,52 @@ export type InferenceServiceSettings =
api_key: string;
organization_id: string;
url: string;
model_id: string;
};
}
| {
service: 'mistral';
service_settings: {
api_key: string;
model: string;
max_input_tokens: string;
rate_limit: {
requests_per_minute: number;
};
};
}
| {
service: 'cohere';
service_settings: {
similarity: string;
dimensions: string;
model_id: string;
embedding_type: string;
};
}
| {
service: 'azureaistudio';
service_settings: {
target: string;
provider: string;
embedding_type: string;
};
}
| {
service: 'azureopenai';
service_settings: {
resource_name: string;
deployment_id: string;
api_version: string;
};
}
| {
service: 'googleaistudio';
service_settings: {
model_id: string;
rate_limit: {
requests_per_minute: number;
};
};
}
| {
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/enterprise_search/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import {
ENTERPRISE_SEARCH_APP_ID,
ENTERPRISE_SEARCH_CONTENT_APP_ID,
ENTERPRISE_SEARCH_INFERENCE_ENDPOINTS_APP_ID,
ENTERPRISE_SEARCH_RELEVANCE_APP_ID,
ENTERPRISE_SEARCH_APPLICATIONS_APP_ID,
ENTERPRISE_SEARCH_ANALYTICS_APP_ID,
ENTERPRISE_SEARCH_APPSEARCH_APP_ID,
Expand Down Expand Up @@ -178,7 +178,7 @@ export const VECTOR_SEARCH_PLUGIN = {
};

export const INFERENCE_ENDPOINTS_PLUGIN = {
ID: ENTERPRISE_SEARCH_INFERENCE_ENDPOINTS_APP_ID,
ID: ENTERPRISE_SEARCH_RELEVANCE_APP_ID,
NAME: i18n.translate('xpack.enterpriseSearch.inferenceEndpoints.productName', {
defaultMessage: 'Inference Endpoints',
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { licensingMock } from '@kbn/licensing-plugin/public/mocks';
export const mockLicensingValues = {
license: licensingMock.createLicense(),
hasPlatinumLicense: false,
hasEnterpriseLicense: true,
hasGoldLicense: false,
isTrial: false,
canManageLicense: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import {
import { INFERENCE_ENDPOINTS_PATH } from '../../enterprise_search_relevance/routes';
import { KibanaLogic } from '../kibana';

import { LicensingLogic } from '../licensing';

import { generateNavLink } from './nav_link_helpers';

/**
Expand All @@ -51,7 +53,11 @@ import { generateNavLink } from './nav_link_helpers';
export const useEnterpriseSearchNav = (alwaysReturn = false) => {
const { isSearchHomepageEnabled, searchHomepage, isSidebarEnabled, productAccess } =
useValues(KibanaLogic);

const { hasEnterpriseLicense } = useValues(LicensingLogic);

const indicesNavItems = useIndicesNav();

if (!isSidebarEnabled && !alwaysReturn) return undefined;

const navItems: Array<EuiSideNavItemTypeEnhanced<unknown>> = [
Expand Down Expand Up @@ -154,25 +160,29 @@ export const useEnterpriseSearchNav = (alwaysReturn = false) => {
defaultMessage: 'Build',
}),
},
{
id: 'relevance',
items: [
{
id: 'inference_endpoints',
name: i18n.translate('xpack.enterpriseSearch.nav.inferenceEndpointsTitle', {
defaultMessage: 'Inference Endpoints',
}),
...generateNavLink({
shouldNotCreateHref: true,
shouldShowActiveForSubroutes: true,
to: INFERENCE_ENDPOINTS_PLUGIN.URL + INFERENCE_ENDPOINTS_PATH,
}),
},
],
name: i18n.translate('xpack.enterpriseSearch.nav.relevanceTitle', {
defaultMessage: 'Relevance',
}),
},
...(hasEnterpriseLicense
? [
{
id: 'relevance',
items: [
{
id: 'inference_endpoints',
name: i18n.translate('xpack.enterpriseSearch.nav.inferenceEndpointsTitle', {
defaultMessage: 'Inference Endpoints',
}),
...generateNavLink({
shouldNotCreateHref: true,
shouldShowActiveForSubroutes: true,
to: INFERENCE_ENDPOINTS_PLUGIN.URL + INFERENCE_ENDPOINTS_PATH,
}),
},
],
name: i18n.translate('xpack.enterpriseSearch.nav.relevanceTitle', {
defaultMessage: 'Relevance',
}),
},
]
: []),
{
id: 'es_getting_started',
items: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,38 @@ describe('LicensingLogic', () => {
});
});

describe('hasEnterpriseLicense', () => {
it('is true for enterprise and trial licenses', () => {
updateLicense({ status: 'active', type: 'enterprise' });
expect(LicensingLogic.values.hasEnterpriseLicense).toEqual(true);

updateLicense({ status: 'active', type: 'trial' });
expect(LicensingLogic.values.hasEnterpriseLicense).toEqual(true);
});

it('is false if the current license is expired', () => {
updateLicense({ status: 'expired', type: 'enterprise' });
expect(LicensingLogic.values.hasEnterpriseLicense).toEqual(false);

updateLicense({ status: 'expired', type: 'trial' });
expect(LicensingLogic.values.hasEnterpriseLicense).toEqual(false);
});

it('is false for licenses below enterprise', () => {
updateLicense({ status: 'active', type: 'gold' });
expect(LicensingLogic.values.hasEnterpriseLicense).toEqual(false);

updateLicense({ status: 'active', type: 'platinum' });
expect(LicensingLogic.values.hasEnterpriseLicense).toEqual(false);

updateLicense({ status: 'active', type: 'basic' });
expect(LicensingLogic.values.hasEnterpriseLicense).toEqual(false);

updateLicense({ status: 'active', type: 'standard' });
expect(LicensingLogic.values.hasEnterpriseLicense).toEqual(false);
});
});

describe('isTrial', () => {
it('is true for active trial license', () => {
updateLicense({ status: 'active', type: 'trial' });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { ILicense } from '@kbn/licensing-plugin/public';
interface LicensingValues {
license: ILicense | null;
licenseSubscription: Subscription | null;
hasEnterpriseLicense: boolean;
hasPlatinumLicense: boolean;
hasGoldLicense: boolean;
isTrial: boolean;
Expand Down Expand Up @@ -52,6 +53,13 @@ export const LicensingLogic = kea<MakeLogicType<LicensingValues, LicensingAction
return license?.isActive && qualifyingLicenses.includes(license?.type);
},
],
hasEnterpriseLicense: [
(selectors) => [selectors.license],
(license) => {
const qualifyingLicenses = ['enterprise', 'trial'];
return license?.isActive && qualifyingLicenses.includes(license?.type);
},
],
hasGoldLicense: [
(selectors) => [selectors.license],
(license) => {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/enterprise_search/public/navigation_tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ export const getNavigationTreeDefinition = ({
}),
},
{
children: [{ link: 'searchInferenceEndpoints' }],
children: [{ link: 'enterpriseSearchRelevance:inferenceEndpoints' }],
id: 'relevance',
title: i18n.translate('xpack.enterpriseSearch.searchNav.relevance', {
defaultMessage: 'Relevance',
Expand Down
Loading

0 comments on commit db303e1

Please sign in to comment.