From 0fc00983c365075f381aa001d68bb2cd2a1203da Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Wed, 21 Aug 2024 16:21:25 +0400 Subject: [PATCH] Fix infer_trained_model API (#2786) It can return list of lists of integers and floats. --- output/openapi/elasticsearch-openapi.json | 12 ++++++++++ .../elasticsearch-serverless-openapi.json | 12 ++++++++++ output/schema/schema-serverless.json | 24 +++++++++++++++++-- output/schema/schema.json | 24 +++++++++++++++++-- output/typescript/types.ts | 2 +- specification/ml/_types/inference.ts | 8 ++++++- 6 files changed, 76 insertions(+), 6 deletions(-) diff --git a/output/openapi/elasticsearch-openapi.json b/output/openapi/elasticsearch-openapi.json index f0c0e95ea9..1e83b803ac 100644 --- a/output/openapi/elasticsearch-openapi.json +++ b/output/openapi/elasticsearch-openapi.json @@ -91226,11 +91226,23 @@ { "type": "number" }, + { + "type": "array", + "items": { + "type": "number" + } + }, { "type": "boolean" }, { "type": "number" + }, + { + "type": "array", + "items": { + "type": "number" + } } ] }, diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index f60fc04203..2a5221afac 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -59282,11 +59282,23 @@ { "type": "number" }, + { + "type": "array", + "items": { + "type": "number" + } + }, { "type": "boolean" }, { "type": "number" + }, + { + "type": "array", + "items": { + "type": "number" + } } ] }, diff --git a/output/schema/schema-serverless.json b/output/schema/schema-serverless.json index 8b54888223..984375b9a6 100644 --- a/output/schema/schema-serverless.json +++ b/output/schema/schema-serverless.json @@ -91187,7 +91187,7 @@ "name": "PredictedValue", "namespace": "ml._types" }, - "specLocation": "ml/_types/inference.ts#L457-L457", + "specLocation": "ml/_types/inference.ts#L457-L463", "type": { "items": [ { @@ -91204,6 +91204,16 @@ "namespace": "_types" } }, + { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "double", + "namespace": "_types" + } + } + }, { "kind": "instance_of", "type": { @@ -91217,6 +91227,16 @@ "name": "integer", "namespace": "_types" } + }, + { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } } ], "kind": "union_of" @@ -129694,7 +129714,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L459-L506" + "specLocation": "ml/_types/inference.ts#L465-L512" }, { "kind": "interface", diff --git a/output/schema/schema.json b/output/schema/schema.json index 14a5b32613..dbe721097b 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -149253,7 +149253,7 @@ } } ], - "specLocation": "ml/_types/inference.ts#L459-L506" + "specLocation": "ml/_types/inference.ts#L465-L512" }, { "kind": "interface", @@ -151654,7 +151654,7 @@ "name": "PredictedValue", "namespace": "ml._types" }, - "specLocation": "ml/_types/inference.ts#L457-L457", + "specLocation": "ml/_types/inference.ts#L457-L463", "type": { "items": [ { @@ -151671,6 +151671,16 @@ "namespace": "_types" } }, + { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "double", + "namespace": "_types" + } + } + }, { "kind": "instance_of", "type": { @@ -151684,6 +151694,16 @@ "name": "integer", "namespace": "_types" } + }, + { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "integer", + "namespace": "_types" + } + } } ], "kind": "union_of" diff --git a/output/typescript/types.ts b/output/typescript/types.ts index d93fa3c4a8..9f426d0c1c 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -13903,7 +13903,7 @@ export interface MlPerPartitionCategorization { stop_on_warn?: boolean } -export type MlPredictedValue = string | double | boolean | integer +export type MlPredictedValue = string | double | double[] | boolean | integer | integer[] export interface MlQuestionAnsweringInferenceOptions { num_top_classes?: integer diff --git a/specification/ml/_types/inference.ts b/specification/ml/_types/inference.ts index 1782fa5371..97bd3f01c0 100644 --- a/specification/ml/_types/inference.ts +++ b/specification/ml/_types/inference.ts @@ -454,7 +454,13 @@ export class TrainedModelInferenceFeatureImportance { classes?: TrainedModelInferenceClassImportance[] } -export type PredictedValue = string | double | boolean | integer +export type PredictedValue = + | string + | double + | double[] + | boolean + | integer + | integer[] export class InferenceResponseResult { /**