Skip to content

Commit

Permalink
[ML] add rerank to _inference (#2479)
Browse files Browse the repository at this point in the history
  • Loading branch information
maxhniebergall authored Apr 3, 2024
1 parent 141c83e commit f95a873
Show file tree
Hide file tree
Showing 6 changed files with 139 additions and 6 deletions.
32 changes: 31 additions & 1 deletion output/openapi/elasticsearch-serverless-openapi.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 79 additions & 3 deletions output/schema/schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion output/typescript/types.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions specification/inference/_types/Results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -72,4 +83,5 @@ export class InferenceResult {
text_embedding?: Array<TextEmbeddingResult>
sparse_embedding?: Array<SparseEmbeddingResult>
completion?: Array<CompletionResult>
rerank?: Array<RankedDocument>
}
4 changes: 3 additions & 1 deletion specification/inference/_types/TaskType.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,7 @@
*/
export enum TaskType {
sparse_embedding,
text_embedding
text_embedding,
rerank,
completion
}
5 changes: 5 additions & 0 deletions specification/inference/inference/InferenceRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit f95a873

Please sign in to comment.