From 28cc67b16db3c2640ec20a3266a2fceadbede2ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20Saint-F=C3=A9lix?= Date: Thu, 27 Mar 2025 09:38:18 +0100 Subject: [PATCH] move AdaptiveAllocations to common types to avoid duplicates (#4143) (cherry picked from commit 055139de6e275c13570b8424e502513f637c69d4) --- specification/inference/_types/CommonTypes.ts | 21 ++++++++++++++++++- .../PutElasticsearchRequest.ts | 20 +----------------- .../inference/put_elser/PutElserRequest.ts | 20 +----------------- 3 files changed, 22 insertions(+), 39 deletions(-) diff --git a/specification/inference/_types/CommonTypes.ts b/specification/inference/_types/CommonTypes.ts index 8879466eb3..16250c1159 100644 --- a/specification/inference/_types/CommonTypes.ts +++ b/specification/inference/_types/CommonTypes.ts @@ -23,7 +23,7 @@ import { Message } from '@inference/chat_completion_unified/UnifiedRequest' import { RequestBase } from '@_types/Base' -import { float, long } from '@_types/Numeric' +import { float, integer, long } from '@_types/Numeric' export interface RequestChatCompletionBase extends RequestBase { /** @@ -59,3 +59,22 @@ export interface RequestChatCompletionBase extends RequestBase { */ top_p?: float } + +export class AdaptiveAllocations { + /** + * Turn on `adaptive_allocations`. + * @server_default false + */ + enabled?: boolean + /** + * The maximum number of allocations to scale to. + * If set, it must be greater than or equal to `min_number_of_allocations`. + */ + max_number_of_allocations?: integer + /** + * The minimum number of allocations to scale to. + * If set, it must be greater than or equal to 0. + * If not defined, the deployment scales to 0. + */ + min_number_of_allocations?: integer +} diff --git a/specification/inference/put_elasticsearch/PutElasticsearchRequest.ts b/specification/inference/put_elasticsearch/PutElasticsearchRequest.ts index 5430ebb8e7..0c8794d9f4 100644 --- a/specification/inference/put_elasticsearch/PutElasticsearchRequest.ts +++ b/specification/inference/put_elasticsearch/PutElasticsearchRequest.ts @@ -17,6 +17,7 @@ * under the License. */ +import { AdaptiveAllocations } from '@inference/_types/CommonTypes' import { InferenceChunkingSettings } from '@inference/_types/Services' import { RequestBase } from '@_types/Base' import { Id } from '@_types/common' @@ -95,25 +96,6 @@ export enum ServiceType { elasticsearch } -export class AdaptiveAllocations { - /** - * Turn on `adaptive_allocations`. - * @server_default false - */ - enabled?: boolean - /** - * The maximum number of allocations to scale to. - * If set, it must be greater than or equal to `min_number_of_allocations`. - */ - max_number_of_allocations?: integer - /** - * The minimum number of allocations to scale to. - * If set, it must be greater than or equal to 0. - * If not defined, the deployment scales to 0. - */ - min_number_of_allocations?: integer -} - export class ElasticsearchServiceSettings { /** * Adaptive allocations configuration details. diff --git a/specification/inference/put_elser/PutElserRequest.ts b/specification/inference/put_elser/PutElserRequest.ts index 3a21e01df3..1b03f03bed 100644 --- a/specification/inference/put_elser/PutElserRequest.ts +++ b/specification/inference/put_elser/PutElserRequest.ts @@ -17,6 +17,7 @@ * under the License. */ +import { AdaptiveAllocations } from '@inference/_types/CommonTypes' import { InferenceChunkingSettings } from '@inference/_types/Services' import { RequestBase } from '@_types/Base' import { Id } from '@_types/common' @@ -89,25 +90,6 @@ export enum ServiceType { elser } -export class AdaptiveAllocations { - /** - * Turn on `adaptive_allocations`. - * @server_default false - */ - enabled?: boolean - /** - * The maximum number of allocations to scale to. - * If set, it must be greater than or equal to `min_number_of_allocations`. - */ - max_number_of_allocations?: integer - /** - * The minimum number of allocations to scale to. - * If set, it must be greater than or equal to 0. - * If not defined, the deployment scales to 0. - */ - min_number_of_allocations?: integer -} - export class ElserServiceSettings { /** * Adaptive allocations configuration details.