From 05c39a9dc46e107e4baaf082a6b56aae1ef5901c Mon Sep 17 00:00:00 2001 From: David Kyle Date: Tue, 2 Jan 2024 07:54:31 +0000 Subject: [PATCH] Add prefix_string config option for ML models (#2363) The prefix_strings option was added to support the E5 model in elastic/elasticsearch#102089 --- .../elasticsearch-serverless-openapi.json | 20 +++++ output/schema/schema.json | 83 ++++++++++++++----- output/typescript/types.ts | 6 ++ specification/ml/_types/TrainedModel.ts | 12 +++ 4 files changed, 102 insertions(+), 19 deletions(-) diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index 3ffcbb3d11..17bee8cb14 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -53247,6 +53247,9 @@ }, "location": { "$ref": "#/components/schemas/ml._types:TrainedModelLocation" + }, + "prefix_strings": { + "$ref": "#/components/schemas/ml._types:TrainedModelPrefixStrings" } }, "required": [ @@ -53719,6 +53722,23 @@ "name" ] }, + "ml._types:TrainedModelPrefixStrings": { + "type": "object", + "properties": { + "ingest": { + "description": "String prepended to input at ingest", + "type": "string" + }, + "search": { + "description": "String prepended to input at search", + "type": "string" + } + }, + "required": [ + "ingest", + "search" + ] + }, "ml._types:TrainedModelStats": { "type": "object", "properties": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 9e994b62af..052765732b 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -139606,7 +139606,7 @@ "name": "DeploymentAllocationState", "namespace": "ml._types" }, - "specLocation": "ml/_types/TrainedModel.ts#L288-L301" + "specLocation": "ml/_types/TrainedModel.ts#L289-L302" }, { "kind": "enum", @@ -139628,7 +139628,7 @@ "name": "DeploymentAssignmentState", "namespace": "ml._types" }, - "specLocation": "ml/_types/TrainedModel.ts#L303-L308" + "specLocation": "ml/_types/TrainedModel.ts#L304-L309" }, { "kind": "enum", @@ -139650,7 +139650,7 @@ "name": "DeploymentState", "namespace": "ml._types" }, - "specLocation": "ml/_types/TrainedModel.ts#L273-L286" + "specLocation": "ml/_types/TrainedModel.ts#L274-L287" }, { "kind": "interface", @@ -140415,7 +140415,7 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L216-L230" + "specLocation": "ml/_types/TrainedModel.ts#L217-L231" }, { "kind": "interface", @@ -143708,7 +143708,7 @@ "name": "RoutingState", "namespace": "ml._types" }, - "specLocation": "ml/_types/TrainedModel.ts#L350-L371" + "specLocation": "ml/_types/TrainedModel.ts#L351-L372" }, { "kind": "enum", @@ -144371,7 +144371,7 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L232-L239" + "specLocation": "ml/_types/TrainedModel.ts#L233-L240" }, { "kind": "interface", @@ -144408,7 +144408,7 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L241-L246" + "specLocation": "ml/_types/TrainedModel.ts#L242-L247" }, { "kind": "interface", @@ -144454,7 +144454,7 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L248-L255" + "specLocation": "ml/_types/TrainedModel.ts#L249-L256" }, { "kind": "interface", @@ -144533,7 +144533,7 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L402-L417" + "specLocation": "ml/_types/TrainedModel.ts#L403-L418" }, { "kind": "interface", @@ -144591,7 +144591,7 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L373-L391" + "specLocation": "ml/_types/TrainedModel.ts#L374-L392" }, { "kind": "interface", @@ -144703,7 +144703,7 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L315-L348" + "specLocation": "ml/_types/TrainedModel.ts#L316-L349" }, { "kind": "interface", @@ -144938,9 +144938,20 @@ "namespace": "ml._types" } } + }, + { + "name": "prefix_strings", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "TrainedModelPrefixStrings", + "namespace": "ml._types" + } + } } ], - "specLocation": "ml/_types/TrainedModel.ts#L165-L199" + "specLocation": "ml/_types/TrainedModel.ts#L165-L200" }, { "kind": "interface", @@ -144965,7 +144976,7 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L201-L204" + "specLocation": "ml/_types/TrainedModel.ts#L202-L205" }, { "kind": "interface", @@ -145042,7 +145053,7 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L206-L214" + "specLocation": "ml/_types/TrainedModel.ts#L207-L215" }, { "kind": "interface", @@ -145088,7 +145099,7 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L393-L400" + "specLocation": "ml/_types/TrainedModel.ts#L394-L401" }, { "kind": "interface", @@ -145697,7 +145708,7 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L419-L421" + "specLocation": "ml/_types/TrainedModel.ts#L420-L422" }, { "kind": "interface", @@ -145718,7 +145729,41 @@ } } ], - "specLocation": "ml/_types/TrainedModel.ts#L423-L425" + "specLocation": "ml/_types/TrainedModel.ts#L424-L426" + }, + { + "kind": "interface", + "name": { + "name": "TrainedModelPrefixStrings", + "namespace": "ml._types" + }, + "properties": [ + { + "description": "String prepended to input at ingest", + "name": "ingest", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "description": "String prepended to input at search", + "name": "search", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "ml/_types/TrainedModel.ts#L428-L437" }, { "kind": "interface", @@ -145865,7 +145910,7 @@ "name": "TrainedModelType", "namespace": "ml._types" }, - "specLocation": "ml/_types/TrainedModel.ts#L257-L271" + "specLocation": "ml/_types/TrainedModel.ts#L258-L272" }, { "kind": "enum", @@ -145881,7 +145926,7 @@ "name": "TrainingPriority", "namespace": "ml._types" }, - "specLocation": "ml/_types/TrainedModel.ts#L310-L313" + "specLocation": "ml/_types/TrainedModel.ts#L311-L314" }, { "kind": "interface", diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 041a210e1e..7bf31b4677 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -13246,6 +13246,7 @@ export interface MlTrainedModelConfig { metadata?: MlTrainedModelConfigMetadata model_size_bytes?: ByteSize location?: MlTrainedModelLocation + prefix_strings?: MlTrainedModelPrefixStrings } export interface MlTrainedModelConfigInput { @@ -13333,6 +13334,11 @@ export interface MlTrainedModelLocationIndex { name: IndexName } +export interface MlTrainedModelPrefixStrings { + ingest: string + search: string +} + export interface MlTrainedModelSizeStats { model_size_bytes: ByteSize required_native_memory_bytes: integer diff --git a/specification/ml/_types/TrainedModel.ts b/specification/ml/_types/TrainedModel.ts index 0cb14c14b1..21262132ff 100644 --- a/specification/ml/_types/TrainedModel.ts +++ b/specification/ml/_types/TrainedModel.ts @@ -196,6 +196,7 @@ export class TrainedModelConfig { metadata?: TrainedModelConfigMetadata model_size_bytes?: ByteSize location?: TrainedModelLocation + prefix_strings?: TrainedModelPrefixStrings } export class TrainedModelConfigInput { @@ -423,3 +424,14 @@ export class TrainedModelLocation { export class TrainedModelLocationIndex { name: IndexName } + +export class TrainedModelPrefixStrings { + /** + * String prepended to input at ingest + */ + ingest: string + /** + * String prepended to input at search + */ + search: string +}