From 7ee81552f9a7666da671d0ee68ae1f2696f365bf Mon Sep 17 00:00:00 2001 From: Samiul Monir Date: Fri, 7 Feb 2025 13:37:52 -0500 Subject: [PATCH 1/4] Refacto add inference endpoint with direct api call --- .../src/constants/trained_models.ts | 2 +- .../server/lib/add_inference_endpoint.test.ts | 50 ------------- .../server/lib/add_inference_endpoint.ts | 36 --------- .../inference_endpoint/server/routes/index.ts | 24 +++++- .../filter/service_provider_filter.tsx | 4 +- .../service_provider.tsx | 73 +------------------ .../tabular_page.test.tsx | 2 +- .../all_inference_endpoints/types.ts | 17 +---- .../public/hooks/use_table_data.test.tsx | 17 ++--- .../public/hooks/use_table_data.tsx | 2 +- 10 files changed, 37 insertions(+), 190 deletions(-) delete mode 100644 x-pack/platform/plugins/shared/inference_endpoint/server/lib/add_inference_endpoint.test.ts delete mode 100644 x-pack/platform/plugins/shared/inference_endpoint/server/lib/add_inference_endpoint.ts diff --git a/x-pack/platform/packages/shared/ml/trained_models_utils/src/constants/trained_models.ts b/x-pack/platform/packages/shared/ml/trained_models_utils/src/constants/trained_models.ts index e634cf37b27c0..1e5073d803093 100644 --- a/x-pack/platform/packages/shared/ml/trained_models_utils/src/constants/trained_models.ts +++ b/x-pack/platform/packages/shared/ml/trained_models_utils/src/constants/trained_models.ts @@ -223,7 +223,7 @@ export interface GetModelDownloadConfigOptions { } export interface LocalInferenceServiceSettings { - service: 'elser' | 'elasticsearch'; + service: 'elasticsearch'; service_settings: { num_allocations: number; num_threads: number; diff --git a/x-pack/platform/plugins/shared/inference_endpoint/server/lib/add_inference_endpoint.test.ts b/x-pack/platform/plugins/shared/inference_endpoint/server/lib/add_inference_endpoint.test.ts deleted file mode 100644 index 92f3cc23da75b..0000000000000 --- a/x-pack/platform/plugins/shared/inference_endpoint/server/lib/add_inference_endpoint.test.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { addInferenceEndpoint } from './add_inference_endpoint'; - -describe('addInferenceEndpoint', () => { - const mockClient: any = { - inference: { - put: jest.fn(), - }, - }; - - const config: any = { - provider: 'elasticsearch', - taskType: 'text_embedding', - inferenceId: 'es-endpoint-1', - providerConfig: { - num_allocations: 1, - num_threads: 2, - model_id: '.multilingual-e5-small', - }, - }; - const secrets: any = { providerSecrets: {} }; - - beforeEach(() => { - jest.clearAllMocks(); - }); - - it('should call the ES client with correct PUT request', async () => { - await addInferenceEndpoint(mockClient, config, secrets); - - expect(mockClient.inference.put).toHaveBeenCalledWith({ - inference_id: config.inferenceId, - task_type: config.taskType, - inference_config: { - service: 'elasticsearch', - service_settings: { - num_allocations: 1, - num_threads: 2, - model_id: '.multilingual-e5-small', - }, - task_settings: {}, - }, - }); - }); -}); diff --git a/x-pack/platform/plugins/shared/inference_endpoint/server/lib/add_inference_endpoint.ts b/x-pack/platform/plugins/shared/inference_endpoint/server/lib/add_inference_endpoint.ts deleted file mode 100644 index cf36c9bad197d..0000000000000 --- a/x-pack/platform/plugins/shared/inference_endpoint/server/lib/add_inference_endpoint.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ - -import { InferenceTaskType } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; -import type { Config, Secrets } from '@kbn/inference-endpoint-ui-common'; -import { ElasticsearchClient } from '@kbn/core/server'; -import { unflattenObject } from '../utils/unflatten_object'; - -export const addInferenceEndpoint = async ( - esClient: ElasticsearchClient, - config: Config, - secrets: Secrets -) => { - /* task settings property is required in the API call - but no needed for inference or connector creation - */ - const taskSettings = {}; - const serviceSettings = { - ...unflattenObject(config?.providerConfig ?? {}), - ...unflattenObject(secrets?.providerSecrets ?? {}), - }; - - return await esClient.inference.put({ - inference_id: config?.inferenceId ?? '', - task_type: config?.taskType as InferenceTaskType, - inference_config: { - service: config?.provider, - service_settings: serviceSettings, - task_settings: taskSettings, - }, - }); -}; diff --git a/x-pack/platform/plugins/shared/inference_endpoint/server/routes/index.ts b/x-pack/platform/plugins/shared/inference_endpoint/server/routes/index.ts index 17d1715f91fc6..3ba625d05e84e 100644 --- a/x-pack/platform/plugins/shared/inference_endpoint/server/routes/index.ts +++ b/x-pack/platform/plugins/shared/inference_endpoint/server/routes/index.ts @@ -12,8 +12,8 @@ import { InferenceInferenceEndpointInfo } from '@elastic/elasticsearch/lib/api/t import { InferenceServicesGetResponse } from '../types'; import { INFERENCE_ENDPOINT_INTERNAL_API_VERSION } from '../../common'; -import { addInferenceEndpoint } from '../lib/add_inference_endpoint'; import { inferenceEndpointExists } from '../lib/inference_endpoint_exists'; +import { unflattenObject } from '../utils/unflatten_object'; const inferenceEndpointSchema = schema.object({ config: schema.object({ @@ -90,7 +90,27 @@ export const getInferenceServicesRoute = ( const esClient = (await context.core).elasticsearch.client.asCurrentUser; const { config, secrets } = request.body; - const result = await addInferenceEndpoint(esClient, config, secrets); + + const inferenceBody = { + service: config.provider, + service_settings: { + ...unflattenObject(config?.providerConfig ?? {}), + ...unflattenObject(secrets?.providerSecrets ?? {}), + }, + }; + + const result = await esClient.transport.request( + { + method: 'PUT', + path: `/_inference/${config.taskType}/${config.inferenceId}`, + body: JSON.stringify(inferenceBody), + }, + { + headers: { + 'content-type': 'application/json', + }, + } + ); return response.ok({ body: result, diff --git a/x-pack/solutions/search/plugins/search_inference_endpoints/public/components/all_inference_endpoints/filter/service_provider_filter.tsx b/x-pack/solutions/search/plugins/search_inference_endpoints/public/components/all_inference_endpoints/filter/service_provider_filter.tsx index 56420f98bfac7..ebc795258245a 100644 --- a/x-pack/solutions/search/plugins/search_inference_endpoints/public/components/all_inference_endpoints/filter/service_provider_filter.tsx +++ b/x-pack/solutions/search/plugins/search_inference_endpoints/public/components/all_inference_endpoints/filter/service_provider_filter.tsx @@ -6,8 +6,8 @@ */ import React from 'react'; -import { SERVICE_PROVIDERS } from '../render_table_columns/render_service_provider/service_provider'; -import type { FilterOptions, ServiceProviderKeys } from '../types'; +import { SERVICE_PROVIDERS, ServiceProviderKeys } from '@kbn/inference-endpoint-ui-common'; +import type { FilterOptions } from '../types'; import { MultiSelectFilter, MultiSelectFilterOption } from './multi_select_filter'; import * as i18n from './translations'; diff --git a/x-pack/solutions/search/plugins/search_inference_endpoints/public/components/all_inference_endpoints/render_table_columns/render_service_provider/service_provider.tsx b/x-pack/solutions/search/plugins/search_inference_endpoints/public/components/all_inference_endpoints/render_table_columns/render_service_provider/service_provider.tsx index 60be14246d522..bd5f330431a88 100644 --- a/x-pack/solutions/search/plugins/search_inference_endpoints/public/components/all_inference_endpoints/render_table_columns/render_service_provider/service_provider.tsx +++ b/x-pack/solutions/search/plugins/search_inference_endpoints/public/components/all_inference_endpoints/render_table_columns/render_service_provider/service_provider.tsx @@ -11,84 +11,13 @@ import { ELASTIC_MODEL_DEFINITIONS, InferenceAPIConfigResponse, } from '@kbn/ml-trained-models-utils'; -import elasticIcon from '../../../../assets/images/providers/elastic.svg'; -import huggingFaceIcon from '../../../../assets/images/providers/hugging_face.svg'; -import cohereIcon from '../../../../assets/images/providers/cohere.svg'; -import openAIIcon from '../../../../assets/images/providers/open_ai.svg'; -import azureAIStudioIcon from '../../../../assets/images/providers/azure_ai_studio.svg'; -import azureOpenAIIcon from '../../../../assets/images/providers/azure_open_ai.svg'; -import googleAIStudioIcon from '../../../../assets/images/providers/google_ai_studio.svg'; -import mistralIcon from '../../../../assets/images/providers/mistral.svg'; -import amazonBedrockIcon from '../../../../assets/images/providers/amazon_bedrock.svg'; -import alibabaCloudAISearchIcon from '../../../../assets/images/providers/alibaba_cloud_ai_search.svg'; -import watsonxAIIcon from '../../../../assets/images/providers/watsonx_ai.svg'; -import { ServiceProviderKeys } from '../../types'; +import { SERVICE_PROVIDERS, ServiceProviderKeys } from '@kbn/inference-endpoint-ui-common'; import * as i18n from './translations'; interface ServiceProviderProps { providerEndpoint: InferenceAPIConfigResponse; } -interface ServiceProviderRecord { - icon: string; - name: string; -} - -export const SERVICE_PROVIDERS: Record = { - [ServiceProviderKeys['alibabacloud-ai-search']]: { - icon: alibabaCloudAISearchIcon, - name: 'AlibabaCloud AI Search', - }, - [ServiceProviderKeys.amazonbedrock]: { - icon: amazonBedrockIcon, - name: 'Amazon Bedrock', - }, - [ServiceProviderKeys.azureaistudio]: { - icon: azureAIStudioIcon, - name: 'Azure AI Studio', - }, - [ServiceProviderKeys.azureopenai]: { - icon: azureOpenAIIcon, - name: 'Azure OpenAI', - }, - [ServiceProviderKeys.cohere]: { - icon: cohereIcon, - name: 'Cohere', - }, - [ServiceProviderKeys.elasticsearch]: { - icon: elasticIcon, - name: 'Elasticsearch', - }, - [ServiceProviderKeys.elastic]: { - icon: elasticIcon, - name: 'Elastic', - }, - [ServiceProviderKeys.elser]: { - icon: elasticIcon, - name: 'Elasticsearch', - }, - [ServiceProviderKeys.googleaistudio]: { - icon: googleAIStudioIcon, - name: 'Google AI Studio', - }, - [ServiceProviderKeys.hugging_face]: { - icon: huggingFaceIcon, - name: 'Hugging Face', - }, - [ServiceProviderKeys.mistral]: { - icon: mistralIcon, - name: 'Mistral', - }, - [ServiceProviderKeys.openai]: { - icon: openAIIcon, - name: 'OpenAI', - }, - [ServiceProviderKeys.watsonxai]: { - icon: watsonxAIIcon, - name: 'WatsonxAI', - }, -}; - export const ServiceProvider: React.FC = ({ providerEndpoint }) => { const { service } = providerEndpoint; const provider = SERVICE_PROVIDERS[service]; diff --git a/x-pack/solutions/search/plugins/search_inference_endpoints/public/components/all_inference_endpoints/tabular_page.test.tsx b/x-pack/solutions/search/plugins/search_inference_endpoints/public/components/all_inference_endpoints/tabular_page.test.tsx index 09e1844077c23..a026088044e0a 100644 --- a/x-pack/solutions/search/plugins/search_inference_endpoints/public/components/all_inference_endpoints/tabular_page.test.tsx +++ b/x-pack/solutions/search/plugins/search_inference_endpoints/public/components/all_inference_endpoints/tabular_page.test.tsx @@ -15,7 +15,7 @@ const inferenceEndpoints = [ { inference_id: 'my-elser-model-05', task_type: 'sparse_embedding', - service: 'elser', + service: 'elasticsearch', service_settings: { num_allocations: 1, num_threads: 1, diff --git a/x-pack/solutions/search/plugins/search_inference_endpoints/public/components/all_inference_endpoints/types.ts b/x-pack/solutions/search/plugins/search_inference_endpoints/public/components/all_inference_endpoints/types.ts index 4fe526b2bbf1b..2d2a8af8da177 100644 --- a/x-pack/solutions/search/plugins/search_inference_endpoints/public/components/all_inference_endpoints/types.ts +++ b/x-pack/solutions/search/plugins/search_inference_endpoints/public/components/all_inference_endpoints/types.ts @@ -6,25 +6,10 @@ */ import { InferenceAPIConfigResponse } from '@kbn/ml-trained-models-utils'; +import { ServiceProviderKeys } from '@kbn/inference-endpoint-ui-common'; import { TaskTypes } from '../../types'; export const INFERENCE_ENDPOINTS_TABLE_PER_PAGE_VALUES = [25, 50, 100]; -export enum ServiceProviderKeys { - 'alibabacloud-ai-search' = 'alibabacloud-ai-search', - amazonbedrock = 'amazonbedrock', - azureopenai = 'azureopenai', - azureaistudio = 'azureaistudio', - cohere = 'cohere', - elasticsearch = 'elasticsearch', - elastic = 'elastic', - elser = 'elser', - googleaistudio = 'googleaistudio', - hugging_face = 'hugging_face', - mistral = 'mistral', - openai = 'openai', - watsonxai = 'watsonxai', -} - export enum SortFieldInferenceEndpoint { endpoint = 'endpoint', } diff --git a/x-pack/solutions/search/plugins/search_inference_endpoints/public/hooks/use_table_data.test.tsx b/x-pack/solutions/search/plugins/search_inference_endpoints/public/hooks/use_table_data.test.tsx index c5d3cf15f1407..ce972a7d04ad4 100644 --- a/x-pack/solutions/search/plugins/search_inference_endpoints/public/hooks/use_table_data.test.tsx +++ b/x-pack/solutions/search/plugins/search_inference_endpoints/public/hooks/use_table_data.test.tsx @@ -18,7 +18,7 @@ const inferenceEndpoints = [ { inference_id: 'my-elser-model-04', task_type: 'sparse_embedding', - service: 'elser', + service: 'elasticsearch', service_settings: { num_allocations: 1, num_threads: 1, @@ -29,7 +29,7 @@ const inferenceEndpoints = [ { inference_id: 'my-elser-model-01', task_type: 'sparse_embedding', - service: 'elser', + service: 'elasticsearch', service_settings: { num_allocations: 1, num_threads: 1, @@ -38,13 +38,12 @@ const inferenceEndpoints = [ task_settings: {}, }, { - inference_id: 'my-elser-model-05', + inference_id: 'my-openai-model-05', task_type: 'text_embedding', - service: 'elasticsearch', + service: 'openai', service_settings: { - num_allocations: 1, - num_threads: 1, - model_id: '.elser_model_2', + url: 'https://somewhere.com', + model_id: 'third-party-model', }, task_settings: {}, }, @@ -58,7 +57,7 @@ const queryParams = { } as QueryParams; const filterOptions = { - provider: ['elser', 'elasticsearch'], + provider: ['elasticsearch', 'openai'], type: ['sparse_embedding', 'text_embedding'], } as any; @@ -126,7 +125,7 @@ describe('useTableData', () => { it('should filter data based on provider and type from filterOptions', () => { const filterOptions2 = { - provider: ['elser'], + provider: ['elasticsearch'], type: ['text_embedding'], } as any; const { result } = renderHook( diff --git a/x-pack/solutions/search/plugins/search_inference_endpoints/public/hooks/use_table_data.tsx b/x-pack/solutions/search/plugins/search_inference_endpoints/public/hooks/use_table_data.tsx index 775bea270559d..c2d54dd738eac 100644 --- a/x-pack/solutions/search/plugins/search_inference_endpoints/public/hooks/use_table_data.tsx +++ b/x-pack/solutions/search/plugins/search_inference_endpoints/public/hooks/use_table_data.tsx @@ -9,6 +9,7 @@ import type { EuiTableSortingType } from '@elastic/eui'; import { Pagination } from '@elastic/eui'; import { InferenceAPIConfigResponse } from '@kbn/ml-trained-models-utils'; import { useMemo } from 'react'; +import { ServiceProviderKeys } from '@kbn/inference-endpoint-ui-common'; import { TaskTypes } from '../../common/types'; import { DEFAULT_TABLE_LIMIT } from '../components/all_inference_endpoints/constants'; import { @@ -17,7 +18,6 @@ import { InferenceEndpointUI, QueryParams, SortOrder, - ServiceProviderKeys, } from '../components/all_inference_endpoints/types'; interface UseTableDataReturn { From 304ad5d6bd1dfebe8a5217cbfc212e996c92f586 Mon Sep 17 00:00:00 2001 From: Samiul Monir Date: Fri, 7 Feb 2025 13:38:17 -0500 Subject: [PATCH 2/4] remove duplicate svgs --- .../providers/alibaba_cloud_ai_search.svg | 46 ------------------- .../images/providers/amazon_bedrock.svg | 11 ----- .../images/providers/azure_ai_studio.svg | 44 ------------------ .../assets/images/providers/azure_open_ai.svg | 9 ---- .../public/assets/images/providers/cohere.svg | 9 ---- .../assets/images/providers/elastic.svg | 16 ------- .../images/providers/google_ai_studio.svg | 6 --- .../assets/images/providers/hugging_face.svg | 10 ---- .../public/assets/images/providers/jinaai.svg | 13 ------ .../assets/images/providers/mistral.svg | 34 -------------- .../assets/images/providers/open_ai.svg | 3 -- .../assets/images/providers/watsonx_ai.svg | 3 -- 12 files changed, 204 deletions(-) delete mode 100644 x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/alibaba_cloud_ai_search.svg delete mode 100644 x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/amazon_bedrock.svg delete mode 100644 x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/azure_ai_studio.svg delete mode 100644 x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/azure_open_ai.svg delete mode 100644 x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/cohere.svg delete mode 100644 x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/elastic.svg delete mode 100644 x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/google_ai_studio.svg delete mode 100644 x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/hugging_face.svg delete mode 100644 x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/jinaai.svg delete mode 100644 x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/mistral.svg delete mode 100644 x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/open_ai.svg delete mode 100644 x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/watsonx_ai.svg diff --git a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/alibaba_cloud_ai_search.svg b/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/alibaba_cloud_ai_search.svg deleted file mode 100644 index 18534e2d0b3a1..0000000000000 --- a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/alibaba_cloud_ai_search.svg +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - diff --git a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/amazon_bedrock.svg b/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/amazon_bedrock.svg deleted file mode 100644 index f8815d4f75ec5..0000000000000 --- a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/amazon_bedrock.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/azure_ai_studio.svg b/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/azure_ai_studio.svg deleted file mode 100644 index 405e182a10394..0000000000000 --- a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/azure_ai_studio.svg +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/azure_open_ai.svg b/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/azure_open_ai.svg deleted file mode 100644 index 122c0c65af13c..0000000000000 --- a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/azure_open_ai.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/cohere.svg b/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/cohere.svg deleted file mode 100644 index 69953809fec35..0000000000000 --- a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/cohere.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/elastic.svg b/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/elastic.svg deleted file mode 100644 index e763c2e2f2ab6..0000000000000 --- a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/elastic.svg +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - diff --git a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/google_ai_studio.svg b/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/google_ai_studio.svg deleted file mode 100644 index b6e34ae15c9e4..0000000000000 --- a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/google_ai_studio.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/hugging_face.svg b/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/hugging_face.svg deleted file mode 100644 index 87ac70c5a18f4..0000000000000 --- a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/hugging_face.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/jinaai.svg b/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/jinaai.svg deleted file mode 100644 index 605c0cff86942..0000000000000 --- a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/jinaai.svg +++ /dev/null @@ -1,13 +0,0 @@ - - - Jina-color - - - - - - - - - - \ No newline at end of file diff --git a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/mistral.svg b/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/mistral.svg deleted file mode 100644 index f62258a327594..0000000000000 --- a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/mistral.svg +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/open_ai.svg b/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/open_ai.svg deleted file mode 100644 index 9ddc8f8fd63b8..0000000000000 --- a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/open_ai.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/watsonx_ai.svg b/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/watsonx_ai.svg deleted file mode 100644 index 29f7a735e6614..0000000000000 --- a/x-pack/solutions/search/plugins/search_inference_endpoints/public/assets/images/providers/watsonx_ai.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - From 57e59a15c459bfae42c23da9812446be1ec4fec7 Mon Sep 17 00:00:00 2001 From: Samiul Monir Date: Fri, 7 Feb 2025 14:41:43 -0500 Subject: [PATCH 3/4] remove elser service check from index_management --- .../public/hooks/use_details_page_mappings_model_management.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/platform/plugins/shared/index_management/public/hooks/use_details_page_mappings_model_management.ts b/x-pack/platform/plugins/shared/index_management/public/hooks/use_details_page_mappings_model_management.ts index 7a8d9f526b9f0..411e0bc8bde39 100644 --- a/x-pack/platform/plugins/shared/index_management/public/hooks/use_details_page_mappings_model_management.ts +++ b/x-pack/platform/plugins/shared/index_management/public/hooks/use_details_page_mappings_model_management.ts @@ -33,7 +33,7 @@ const getCustomInferenceIdMap = ( const inferenceEntry = isLocalModel(model) ? { trainedModelId: model.service_settings.model_id, - isDeployable: model.service === Service.elser || model.service === Service.elasticsearch, + isDeployable: model.service === Service.elasticsearch, isDeployed: modelStatsById[model.inference_id]?.state === 'started', isDownloading: Boolean(downloadStates[model.service_settings.model_id]), modelStats: modelStatsById[model.inference_id], From c26972a21ae1fbca12d3a9909dbf704187a9be6b Mon Sep 17 00:00:00 2001 From: Samiul Monir Date: Mon, 10 Feb 2025 20:42:59 -0500 Subject: [PATCH 4/4] bring back the library call and removing task_settings --- .../inference_endpoint/server/routes/index.ts | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/x-pack/platform/plugins/shared/inference_endpoint/server/routes/index.ts b/x-pack/platform/plugins/shared/inference_endpoint/server/routes/index.ts index 3ba625d05e84e..e634910300ae4 100644 --- a/x-pack/platform/plugins/shared/inference_endpoint/server/routes/index.ts +++ b/x-pack/platform/plugins/shared/inference_endpoint/server/routes/index.ts @@ -8,7 +8,10 @@ import type { IKibanaResponse, IRouter, RequestHandlerContext } from '@kbn/core/server'; import { Logger } from '@kbn/logging'; import { schema } from '@kbn/config-schema'; -import { InferenceInferenceEndpointInfo } from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; +import { + InferenceInferenceEndpointInfo, + InferenceTaskType, +} from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; import { InferenceServicesGetResponse } from '../types'; import { INFERENCE_ENDPOINT_INTERNAL_API_VERSION } from '../../common'; @@ -91,26 +94,19 @@ export const getInferenceServicesRoute = ( const { config, secrets } = request.body; - const inferenceBody = { - service: config.provider, - service_settings: { - ...unflattenObject(config?.providerConfig ?? {}), - ...unflattenObject(secrets?.providerSecrets ?? {}), - }, + const serviceSettings = { + ...unflattenObject(config?.providerConfig ?? {}), + ...unflattenObject(secrets?.providerSecrets ?? {}), }; - const result = await esClient.transport.request( - { - method: 'PUT', - path: `/_inference/${config.taskType}/${config.inferenceId}`, - body: JSON.stringify(inferenceBody), + const result = await esClient.inference.put({ + inference_id: config?.inferenceId ?? '', + task_type: config?.taskType as InferenceTaskType, + inference_config: { + service: config?.provider, + service_settings: serviceSettings, }, - { - headers: { - 'content-type': 'application/json', - }, - } - ); + }); return response.ok({ body: result,