diff --git a/output/openapi/elasticsearch-serverless-openapi.json b/output/openapi/elasticsearch-serverless-openapi.json index af0b6b3a15..ae3f661524 100644 --- a/output/openapi/elasticsearch-serverless-openapi.json +++ b/output/openapi/elasticsearch-serverless-openapi.json @@ -26343,6 +26343,10 @@ "schema": { "type": "object", "properties": { + "query": { + "description": "Query input, required for rerank task.\nNot required for other tasks.", + "type": "string" + }, "input": { "description": "Text input to the model.\nEither a string or an array of strings.", "oneOf": [ @@ -49592,7 +49596,9 @@ "type": "string", "enum": [ "sparse_embedding", - "text_embedding" + "text_embedding", + "rerank", + "completion" ] }, "inference._types:ModelConfigContainer": { @@ -49671,6 +49677,12 @@ "items": { "$ref": "#/components/schemas/inference._types:CompletionResult" } + }, + "rerank": { + "type": "array", + "items": { + "$ref": "#/components/schemas/inference._types:RankedDocument" + } } }, "minProperties": 1, @@ -49741,6 +49753,24 @@ "result" ] }, + "inference._types:RankedDocument": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "score": { + "type": "string" + }, + "text": { + "type": "string" + } + }, + "required": [ + "id", + "score" + ] + }, "_types:ElasticsearchVersionInfo": { "type": "object", "properties": { diff --git a/output/schema/schema.json b/output/schema/schema.json index 55413ee362..d017fbed03 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -128392,9 +128392,23 @@ } } } + }, + { + "name": "rerank", + "required": false, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "RankedDocument", + "namespace": "inference._types" + } + } + } } ], - "specLocation": "inference/_types/Results.ts#L66-L75", + "specLocation": "inference/_types/Results.ts#L77-L87", "variants": { "kind": "container" } @@ -128487,6 +128501,50 @@ ], "specLocation": "inference/_types/Services.ts#L41-L53" }, + { + "description": "The rerank result object representing a single ranked document\nid: the original index of the document in the request\nscore: the score of the document relative to the query\ntext: Optional, the text of the document, if requested", + "kind": "interface", + "name": { + "name": "RankedDocument", + "namespace": "inference._types" + }, + "properties": [ + { + "name": "id", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "score", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, + { + "name": "text", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "inference/_types/Results.ts#L66-L76" + }, { "kind": "type_alias", "name": { @@ -128565,13 +128623,19 @@ }, { "name": "text_embedding" + }, + { + "name": "rerank" + }, + { + "name": "completion" } ], "name": { "name": "TaskType", "namespace": "inference._types" }, - "specLocation": "inference/_types/TaskType.ts#L20-L26" + "specLocation": "inference/_types/TaskType.ts#L20-L28" }, { "description": "The text embedding result object for byte representation", @@ -128765,6 +128829,18 @@ "body": { "kind": "properties", "properties": [ + { + "description": "Query input, required for rerank task.\nNot required for other tasks.", + "name": "query", + "required": false, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + }, { "description": "Text input to the model.\nEither a string or an array of strings.", "name": "input", @@ -128845,7 +128921,7 @@ } ], "query": [], - "specLocation": "inference/inference/InferenceRequest.ts#L25-L53" + "specLocation": "inference/inference/InferenceRequest.ts#L25-L58" }, { "body": { diff --git a/output/typescript/types.ts b/output/typescript/types.ts index 0c7bb1ef5d..8e7d4596a8 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -11508,6 +11508,7 @@ export interface InferenceInferenceResult { text_embedding?: InferenceTextEmbeddingResult[] sparse_embedding?: InferenceSparseEmbeddingResult[] completion?: InferenceCompletionResult[] + rerank?: InferenceRankedDocument[] } export interface InferenceModelConfig { @@ -11521,6 +11522,12 @@ export interface InferenceModelConfigContainer extends InferenceModelConfig { task_type: InferenceTaskType } +export interface InferenceRankedDocument { + id: string + score: string + text?: string +} + export type InferenceServiceSettings = any export interface InferenceSparseEmbeddingResult { @@ -11531,7 +11538,7 @@ export type InferenceSparseVector = Record export type InferenceTaskSettings = any -export type InferenceTaskType = 'sparse_embedding' | 'text_embedding' +export type InferenceTaskType = 'sparse_embedding' | 'text_embedding' | 'rerank' | 'completion' export interface InferenceTextEmbeddingByteResult { embedding: InferenceDenseByteVector @@ -11561,6 +11568,7 @@ export interface InferenceInferenceRequest extends RequestBase { task_type?: InferenceTaskType inference_id: Id body?: { + query?: string input: string | string[] task_settings?: InferenceTaskSettings } diff --git a/specification/inference/_types/Results.ts b/specification/inference/_types/Results.ts index 1b1741a236..0d5da84fea 100644 --- a/specification/inference/_types/Results.ts +++ b/specification/inference/_types/Results.ts @@ -63,6 +63,17 @@ export class CompletionResult { result: string } +/** + * The rerank result object representing a single ranked document + * id: the original index of the document in the request + * score: the score of the document relative to the query + * text: Optional, the text of the document, if requested + */ +export class RankedDocument { + id: string + score: string + text?: string +} /** * InferenceResult is an aggregation of mutually exclusive variants * @variants container @@ -72,4 +83,5 @@ export class InferenceResult { text_embedding?: Array sparse_embedding?: Array completion?: Array + rerank?: Array } diff --git a/specification/inference/_types/TaskType.ts b/specification/inference/_types/TaskType.ts index c7c2e42a84..8bdc9f3727 100644 --- a/specification/inference/_types/TaskType.ts +++ b/specification/inference/_types/TaskType.ts @@ -22,5 +22,7 @@ */ export enum TaskType { sparse_embedding, - text_embedding + text_embedding, + rerank, + completion } diff --git a/specification/inference/inference/InferenceRequest.ts b/specification/inference/inference/InferenceRequest.ts index b98bb9f6e6..ee7dfe1f2d 100644 --- a/specification/inference/inference/InferenceRequest.ts +++ b/specification/inference/inference/InferenceRequest.ts @@ -40,6 +40,11 @@ export interface Request extends RequestBase { inference_id: Id } body: { + /** + * Query input, required for rerank task. + * Not required for other tasks. + */ + query?: string /** * Text input to the model. * Either a string or an array of strings.