[Enterprise Search] Remove MlTrainedModelConfigWithDefined interface (#160950)

Issue: https://github.com/elastic/enterprise-search-team/issues/4432

## Summary
This PR resolves the technical debt mentioned in [this
issue](https://github.com/elastic/enterprise-search-team/issues/4432).
The `MlTrainedModelConfig` now includes the `fully_defined` attribute,
allowing us to remove the `MlTrainedModelConfigWithDefined` interface
from Kibana.

### Checklist
- [x] Checked whether the existing [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
are passing.

### For maintainers

- [ ] This was checked for breaking API changes and was [labeled
appropriately](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Saikat Sarkar 2023-07-05 09:15:40 -06:00 committed by GitHub
parent 644356c491
commit 49498399f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 15 deletions

View file

@ -5,8 +5,6 @@
* 2.0.
*/
import { MlTrainedModelConfig } from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
export enum MlModelDeploymentState {
NotDeployed = '',
Downloading = 'downloading',
@ -24,9 +22,3 @@ export interface MlModelDeploymentStatus {
targetAllocationCount: number;
threadsPerAllocation: number;
}
// TODO - we can remove this extension once the new types are available
// in kibana that includes this field
export interface MlTrainedModelConfigWithDefined extends MlTrainedModelConfig {
fully_defined?: boolean;
}

View file

@ -11,11 +11,7 @@ import {
} from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { MlTrainedModels } from '@kbn/ml-plugin/server';
import {
MlModelDeploymentStatus,
MlModelDeploymentState,
MlTrainedModelConfigWithDefined,
} from '../../../common/types/ml';
import { MlModelDeploymentStatus, MlModelDeploymentState } from '../../../common/types/ml';
import { isNotFoundExceptionError } from './ml_model_deployment_common';
@ -41,8 +37,8 @@ export const getMlModelDeploymentStatus = async (
}
const firstTrainedModelConfig = modelDetailsResponse.trained_model_configs
? (modelDetailsResponse.trained_model_configs[0] as MlTrainedModelConfigWithDefined)
: (undefined as unknown as MlTrainedModelConfigWithDefined);
? modelDetailsResponse.trained_model_configs[0]
: undefined;
// are we downloaded?
if (!firstTrainedModelConfig || !firstTrainedModelConfig.fully_defined) {