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

[Search] Consolidate ML model fetch calls #176257

Merged
merged 22 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
723c275
Use new fetch function to get selectable models
demjened Jan 31, 2024
9bef7ca
Remove "no models" panel
demjened Feb 5, 2024
86b139e
Clean up
demjened Feb 5, 2024
92051b0
Update tests
demjened Feb 5, 2024
bd02a99
Remove unused util function
demjened Feb 5, 2024
dfa677c
Fix linter errors
demjened Feb 5, 2024
b1ba5fc
Remove unused API logic
demjened Feb 5, 2024
7658a08
Delete unused i18n keys
demjened Feb 5, 2024
5c7a99b
Add comments to new props
demjened Feb 5, 2024
85efbce
Merge branch 'main' into demjened/remove-ml-model-fetch-redundancy
kibanamachine Feb 5, 2024
32d9885
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Feb 5, 2024
82f3fbf
Fix broken tests
demjened Feb 6, 2024
0177f4e
Merge branch 'demjened/remove-ml-model-fetch-redundancy' of https://g…
demjened Feb 6, 2024
a1db2de
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Feb 6, 2024
4d07414
Fix broken tests
demjened Feb 6, 2024
6b3d808
Merge branch 'demjened/remove-ml-model-fetch-redundancy' of https://g…
demjened Feb 6, 2024
0473769
Move initial fetches to flyout
demjened Feb 7, 2024
92019fd
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Feb 6, 2024
95f0916
Merge branch 'main' into demjened/remove-ml-model-fetch-redundancy
kibanamachine Feb 8, 2024
27bc3b0
Extract type badge from tags
demjened Feb 8, 2024
de34ae5
Merge branch 'demjened/remove-ml-model-fetch-redundancy' of https://g…
demjened Feb 8, 2024
26ff287
Pass-through export type
demjened Feb 8, 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
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
TRAINED_MODEL_TYPE,
BUILT_IN_MODEL_TAG,
} from '@kbn/ml-trained-models-utils';
import { MlModel } from '../types/ml';

import {
MlInferencePipeline,
Expand All @@ -33,7 +34,7 @@ export interface MlInferencePipelineParams {
description?: string;
fieldMappings: FieldMapping[];
inferenceConfig?: InferencePipelineInferenceConfig;
model: MlTrainedModelConfig;
model: MlModel;
pipelineName: string;
}

Expand Down Expand Up @@ -90,7 +91,7 @@ export const generateMlInferencePipelineBody = ({
model_version: model.version,
pipeline: pipelineName,
processed_timestamp: '{{{ _ingest.timestamp }}}',
types: getMlModelTypesForModelConfig(model),
types: model.types,
},
],
},
Expand All @@ -104,19 +105,19 @@ export const getInferenceProcessor = (
sourceField: string,
targetField: string,
inferenceConfig: InferencePipelineInferenceConfig | undefined,
model: MlTrainedModelConfig,
model: MlModel,
pipelineName: string
): IngestInferenceProcessor => {
// If model returned no input field, insert a placeholder
const modelInputField =
model.input?.field_names?.length > 0 ? model.input.field_names[0] : 'MODEL_INPUT_FIELD';
model.inputFieldNames.length > 0 ? model.inputFieldNames[0] : 'MODEL_INPUT_FIELD';

return {
field_map: {
[sourceField]: modelInputField,
},
inference_config: inferenceConfig,
model_id: model.model_id,
model_id: model.modelId,
on_failure: [
{
append: {
Expand Down
5 changes: 5 additions & 0 deletions x-pack/plugins/enterprise_search/common/types/ml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export interface MlModel {
modelId: string;
/** Model inference type, e.g. ner, text_classification */
type: string;
/** Type-related tags: model type (e.g. pytorch), inference type, built-in tag */
types: string[];
/** Field names in inference input configuration */
inputFieldNames: string[];
title: string;
description?: string;
licenseType?: string;
Expand All @@ -44,4 +48,5 @@ export interface MlModel {
isPlaceholder: boolean;
/** Does this model have deployment stats? */
hasStats: boolean;
version?: string;
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading