Skip to content

Commit f95a873

Browse files
[ML] add rerank to _inference (#2479)
1 parent 141c83e commit f95a873

File tree

6 files changed

+139
-6
lines changed

6 files changed

+139
-6
lines changed

output/openapi/elasticsearch-serverless-openapi.json

Lines changed: 31 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/schema/schema.json

Lines changed: 79 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

output/typescript/types.ts

Lines changed: 9 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

specification/inference/_types/Results.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,17 @@ export class CompletionResult {
6363
result: string
6464
}
6565

66+
/**
67+
* The rerank result object representing a single ranked document
68+
* id: the original index of the document in the request
69+
* score: the score of the document relative to the query
70+
* text: Optional, the text of the document, if requested
71+
*/
72+
export class RankedDocument {
73+
id: string
74+
score: string
75+
text?: string
76+
}
6677
/**
6778
* InferenceResult is an aggregation of mutually exclusive variants
6879
* @variants container
@@ -72,4 +83,5 @@ export class InferenceResult {
7283
text_embedding?: Array<TextEmbeddingResult>
7384
sparse_embedding?: Array<SparseEmbeddingResult>
7485
completion?: Array<CompletionResult>
86+
rerank?: Array<RankedDocument>
7587
}

specification/inference/_types/TaskType.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@
2222
*/
2323
export enum TaskType {
2424
sparse_embedding,
25-
text_embedding
25+
text_embedding,
26+
rerank,
27+
completion
2628
}

specification/inference/inference/InferenceRequest.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ export interface Request extends RequestBase {
4040
inference_id: Id
4141
}
4242
body: {
43+
/**
44+
* Query input, required for rerank task.
45+
* Not required for other tasks.
46+
*/
47+
query?: string
4348
/**
4449
* Text input to the model.
4550
* Either a string or an array of strings.

0 commit comments

Comments
 (0)