mirror of
https://github.com/elastic/kibana.git
synced 2025-06-27 18:51:07 -04:00
[ML] Inference endpoints UI: adds tech preview badge for preconfigured ELSER endpoint (#223299)
## Summary Fixes https://github.com/elastic/kibana/issues/223263 Adds tech preview badge to preconfigured ELSER endpoint  ### Checklist Check the PR satisfies following conditions. Reviewers should verify this PR satisfies this list as well. - [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md) - [ ] [Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html) was added for features that require explanation or tutorials - [ ] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios - [ ] If a plugin configuration key changed, check if it needs to be allowlisted in the cloud and added to the [docker list](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker) - [ ] This was checked for breaking HTTP API changes, and any breaking changes have been approved by the breaking-change committee. The `release_note:breaking` label should be applied in these situations. - [ ] [Flaky Test Runner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1) was used on any tests changed - [ ] The PR description includes the appropriate Release Notes section, and the correct `release_note:*` label is applied per the [guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process) ### Identify risks Does this PR introduce any risks? For example, consider risks like hard to test bugs, performance regression, potential of data loss. Describe the risk, its severity, and mitigation for each identified risk. Invite stakeholders and evaluate how to proceed before merging. - [ ] [See some risk examples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx) - [ ] ... --------- Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
474f8480b7
commit
15ee621d10
2 changed files with 64 additions and 23 deletions
|
@ -88,6 +88,22 @@ const inferenceEndpoints = [
|
|||
model_id: 'rainbow-sprinkles',
|
||||
},
|
||||
},
|
||||
{
|
||||
inference_id: '.elser-v2-elastic',
|
||||
task_type: 'sparse_embedding',
|
||||
service: 'elastic',
|
||||
service_settings: {
|
||||
model_id: 'elser-v2',
|
||||
},
|
||||
},
|
||||
{
|
||||
inference_id: 'custom-inference-id',
|
||||
task_type: 'sparse_embedding',
|
||||
service: 'elastic',
|
||||
service_settings: {
|
||||
model_id: 'elser-v2',
|
||||
},
|
||||
},
|
||||
] as InferenceAPIConfigResponse[];
|
||||
|
||||
jest.mock('../../hooks/use_delete_endpoint', () => ({
|
||||
|
@ -102,12 +118,14 @@ describe('When the tabular page is loaded', () => {
|
|||
|
||||
const rows = screen.getAllByRole('row');
|
||||
expect(rows[1]).toHaveTextContent('.elser-2-elasticsearch');
|
||||
expect(rows[2]).toHaveTextContent('.multilingual-e5-small-elasticsearch');
|
||||
expect(rows[3]).toHaveTextContent('.sparkles');
|
||||
expect(rows[4]).toHaveTextContent('elastic-rerank');
|
||||
expect(rows[5]).toHaveTextContent('local-model');
|
||||
expect(rows[6]).toHaveTextContent('my-elser-model-05');
|
||||
expect(rows[7]).toHaveTextContent('third-party-model');
|
||||
expect(rows[2]).toHaveTextContent('.elser-v2-elastic');
|
||||
expect(rows[3]).toHaveTextContent('.multilingual-e5-small-elasticsearch');
|
||||
expect(rows[4]).toHaveTextContent('.sparkles');
|
||||
expect(rows[5]).toHaveTextContent('custom-inference-id');
|
||||
expect(rows[6]).toHaveTextContent('elastic-rerank');
|
||||
expect(rows[7]).toHaveTextContent('local-model');
|
||||
expect(rows[8]).toHaveTextContent('my-elser-model-05');
|
||||
expect(rows[9]).toHaveTextContent('third-party-model');
|
||||
});
|
||||
|
||||
it('should display all service and model ids in the table', () => {
|
||||
|
@ -117,23 +135,29 @@ describe('When the tabular page is loaded', () => {
|
|||
expect(rows[1]).toHaveTextContent('Elasticsearch');
|
||||
expect(rows[1]).toHaveTextContent('.elser_model_2');
|
||||
|
||||
expect(rows[2]).toHaveTextContent('Elasticsearch');
|
||||
expect(rows[2]).toHaveTextContent('.multilingual-e5-small');
|
||||
expect(rows[2]).toHaveTextContent('Elastic');
|
||||
expect(rows[2]).toHaveTextContent('.elser-v2-elastic');
|
||||
|
||||
expect(rows[3]).toHaveTextContent('Elastic');
|
||||
expect(rows[3]).toHaveTextContent('rainbow-sprinkles');
|
||||
expect(rows[3]).toHaveTextContent('Elasticsearch');
|
||||
expect(rows[3]).toHaveTextContent('.multilingual-e5-small');
|
||||
|
||||
expect(rows[4]).toHaveTextContent('Elasticsearch');
|
||||
expect(rows[4]).toHaveTextContent('.rerank-v1');
|
||||
expect(rows[4]).toHaveTextContent('Elastic');
|
||||
expect(rows[4]).toHaveTextContent('rainbow-sprinkles');
|
||||
|
||||
expect(rows[5]).toHaveTextContent('Elasticsearch');
|
||||
expect(rows[5]).toHaveTextContent('.own_model');
|
||||
expect(rows[5]).toHaveTextContent('Elastic');
|
||||
expect(rows[5]).toHaveTextContent('elser-v2');
|
||||
|
||||
expect(rows[6]).toHaveTextContent('Elasticsearch');
|
||||
expect(rows[6]).toHaveTextContent('.elser_model_2');
|
||||
expect(rows[6]).toHaveTextContent('.rerank-v1');
|
||||
|
||||
expect(rows[7]).toHaveTextContent('OpenAI');
|
||||
expect(rows[7]).toHaveTextContent('Elasticsearch');
|
||||
expect(rows[7]).toHaveTextContent('.own_model');
|
||||
|
||||
expect(rows[8]).toHaveTextContent('Elasticsearch');
|
||||
expect(rows[8]).toHaveTextContent('.elser_model_2');
|
||||
|
||||
expect(rows[9]).toHaveTextContent('OpenAI');
|
||||
expect(rows[9]).toHaveTextContent('.own_model');
|
||||
});
|
||||
|
||||
it('should only disable delete action for preconfigured endpoints', () => {
|
||||
|
@ -169,23 +193,28 @@ describe('When the tabular page is loaded', () => {
|
|||
expect(rows[1]).toHaveTextContent(preconfigured);
|
||||
expect(rows[2]).toHaveTextContent(preconfigured);
|
||||
expect(rows[3]).toHaveTextContent(preconfigured);
|
||||
expect(rows[4]).not.toHaveTextContent(preconfigured);
|
||||
expect(rows[4]).toHaveTextContent(preconfigured);
|
||||
expect(rows[5]).not.toHaveTextContent(preconfigured);
|
||||
expect(rows[6]).not.toHaveTextContent(preconfigured);
|
||||
expect(rows[7]).not.toHaveTextContent(preconfigured);
|
||||
expect(rows[8]).not.toHaveTextContent(preconfigured);
|
||||
expect(rows[9]).not.toHaveTextContent(preconfigured);
|
||||
});
|
||||
|
||||
it('should show tech preview badge only for reranker-v1 model', () => {
|
||||
it('should show tech preview badge only for reranker-v1 model, rainbow-sprinkles, and preconfigured elser-v2', () => {
|
||||
render(<TabularPage inferenceEndpoints={inferenceEndpoints} />);
|
||||
|
||||
const techPreview = 'TECH PREVIEW';
|
||||
|
||||
const rows = screen.getAllByRole('row');
|
||||
expect(rows[1]).not.toHaveTextContent(techPreview);
|
||||
expect(rows[2]).not.toHaveTextContent(techPreview);
|
||||
expect(rows[3]).toHaveTextContent(techPreview);
|
||||
expect(rows[2]).toHaveTextContent(techPreview);
|
||||
expect(rows[3]).not.toHaveTextContent(techPreview);
|
||||
expect(rows[4]).toHaveTextContent(techPreview);
|
||||
expect(rows[5]).not.toHaveTextContent(techPreview);
|
||||
expect(rows[6]).not.toHaveTextContent(techPreview);
|
||||
expect(rows[6]).toHaveTextContent(techPreview);
|
||||
expect(rows[7]).not.toHaveTextContent(techPreview);
|
||||
expect(rows[8]).not.toHaveTextContent(techPreview);
|
||||
expect(rows[9]).not.toHaveTextContent(techPreview);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,8 +6,14 @@
|
|||
*/
|
||||
|
||||
import { InferenceInferenceEndpointInfo } from '@elastic/elasticsearch/lib/api/types';
|
||||
import { ServiceProviderKeys } from '@kbn/inference-endpoint-ui-common';
|
||||
export const isProviderTechPreview = (provider: InferenceInferenceEndpointInfo) => {
|
||||
const { service_settings: serviceSettings, task_type: taskType } = provider;
|
||||
const {
|
||||
inference_id: inferenceId,
|
||||
service,
|
||||
service_settings: serviceSettings,
|
||||
task_type: taskType,
|
||||
} = provider;
|
||||
const modelId = serviceSettings?.model_id;
|
||||
|
||||
// If there's no model ID in service settings, it's not a tech preview
|
||||
|
@ -19,7 +25,13 @@ export const isProviderTechPreview = (provider: InferenceInferenceEndpointInfo)
|
|||
For rerank task type, model ID starting with '.' indicates tech preview
|
||||
Special case for 'rainbow-sprinkles' model
|
||||
*/
|
||||
if ((taskType === 'rerank' && modelId.startsWith('.')) || modelId === 'rainbow-sprinkles') {
|
||||
if (
|
||||
(taskType === 'rerank' && modelId.startsWith('.')) ||
|
||||
modelId === 'rainbow-sprinkles' ||
|
||||
(modelId === 'elser-v2' &&
|
||||
inferenceId.startsWith('.') &&
|
||||
service === ServiceProviderKeys.elastic)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue