Skip to content

Commit

Permalink
[Search] Change model id to inference id in index error message (#190787
Browse files Browse the repository at this point in the history
)

## Summary

Changing 'model_id' to 'inference_id' to align with the new API spec.
See also: #190729
  • Loading branch information
sphilipse authored Aug 21, 2024
1 parent 6cc30f9 commit 8f39bdf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,14 +100,14 @@ export const IndexError: React.FC<IndexErrorProps> = ({ indexName }) => {
const semanticTextFieldsWithErrors = semanticTextFields
.map((field) => {
const model = endpoints.endpoints.find(
(endpoint) => endpoint.model_id === field.source.inference_id
(endpoint) => endpoint.inference_id === field.source.inference_id
);
if (!model) {
return {
error: i18n.translate(
'xpack.enterpriseSearch.indexOverview.indexErrors.missingModelError',
{
defaultMessage: 'Model not found for inference endpoint {inferenceId}',
defaultMessage: 'Inference endpoint {inferenceId} not found',
values: {
inferenceId: field.source.inference_id as string,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ import type { InferenceTaskType } from '@elastic/elasticsearch/lib/api/typesWith
import type { ModelConfig } from '@kbn/inference_integration_flyout/types';
import type { HttpService } from '../http_service';
import { ML_INTERNAL_BASE_PATH } from '../../../../common/constants/app';

// TODO remove inference_id when esType has been updated to include it
export interface GetInferenceEndpointsResponse extends estypes.InferenceModelConfigContainer {
inference_id: string;
}

export function inferenceModelsApiProvider(httpService: HttpService) {
return {
/**
Expand All @@ -36,7 +42,7 @@ export function inferenceModelsApiProvider(httpService: HttpService) {
*/
async getAllInferenceEndpoints() {
const result = await httpService.http<{
endpoints: estypes.InferenceModelConfigContainer[];
endpoints: GetInferenceEndpointsResponse[];
}>({
path: `${ML_INTERNAL_BASE_PATH}/_inference/all`,
method: 'GET',
Expand Down

0 comments on commit 8f39bdf

Please sign in to comment.