From 8b12f48a11f22e2e0e40154bf11d983e69194c8e Mon Sep 17 00:00:00 2001 From: Tim Grein Date: Thu, 28 Mar 2024 15:19:55 +0100 Subject: [PATCH] Add Completion result and task type to the Inference API spec (#2471) --- output/schema/schema.json | 38 ++++++++++++++++++++++- output/typescript/types.ts | 5 +++ specification/inference/_types/Results.ts | 8 +++++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/output/schema/schema.json b/output/schema/schema.json index 8fe498a4ee..32eafc851f 100644 --- a/output/schema/schema.json +++ b/output/schema/schema.json @@ -128269,6 +128269,28 @@ }, "specLocation": "indices/validate_query/IndicesValidateQueryResponse.ts#L23-L30" }, + { + "description": "The completion result object", + "kind": "interface", + "name": { + "name": "CompletionResult", + "namespace": "inference._types" + }, + "properties": [ + { + "name": "result", + "required": true, + "type": { + "kind": "instance_of", + "type": { + "name": "string", + "namespace": "_builtins" + } + } + } + ], + "specLocation": "inference/_types/Results.ts#L59-L64" + }, { "description": "Text Embedding results containing bytes are represented as Dense\nVectors of bytes.", "kind": "type_alias", @@ -128356,9 +128378,23 @@ } } } + }, + { + "name": "completion", + "required": false, + "type": { + "kind": "array_of", + "value": { + "kind": "instance_of", + "type": { + "name": "CompletionResult", + "namespace": "inference._types" + } + } + } } ], - "specLocation": "inference/_types/Results.ts#L59-L67", + "specLocation": "inference/_types/Results.ts#L66-L75", "variants": { "kind": "container" } diff --git a/output/typescript/types.ts b/output/typescript/types.ts index afaa4e8841..31517fb04c 100644 --- a/output/typescript/types.ts +++ b/output/typescript/types.ts @@ -11495,6 +11495,10 @@ export interface IndicesValidateQueryResponse { error?: string } +export interface InferenceCompletionResult { + result: string +} + export type InferenceDenseByteVector = byte[] export type InferenceDenseVector = float[] @@ -11503,6 +11507,7 @@ export interface InferenceInferenceResult { text_embedding_bytes?: InferenceTextEmbeddingByteResult[] text_embedding?: InferenceTextEmbeddingResult[] sparse_embedding?: InferenceSparseEmbeddingResult[] + completion?: InferenceCompletionResult[] } export interface InferenceModelConfig { diff --git a/specification/inference/_types/Results.ts b/specification/inference/_types/Results.ts index b7cfd981a4..1b1741a236 100644 --- a/specification/inference/_types/Results.ts +++ b/specification/inference/_types/Results.ts @@ -56,6 +56,13 @@ export class TextEmbeddingResult { embedding: DenseVector } +/** + * The completion result object + */ +export class CompletionResult { + result: string +} + /** * InferenceResult is an aggregation of mutually exclusive variants * @variants container @@ -64,4 +71,5 @@ export class InferenceResult { text_embedding_bytes?: Array text_embedding?: Array sparse_embedding?: Array + completion?: Array }