Skip to content

Commit a53ef07

Browse files
authored
Adds new parameters to the elasticsearch inference API for the rerank task type (#5476)
* Adds new parameters to the elasticsearch inference rerank API * Adds unique inference chunking settings for elasticsearch * Addresses suggestions
1 parent 1e01263 commit a53ef07

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

specification/inference/_types/CommonTypes.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,24 @@ export class ElasticsearchServiceSettings {
13061306
* The maximum value is 32.
13071307
*/
13081308
num_threads: integer
1309+
/**
1310+
* Available only for the `rerank` task type using the Elastic reranker model.
1311+
* Controls the strategy used for processing long documents during inference.
1312+
*
1313+
* Possible values:
1314+
* - `truncate` (default): Processes only the beginning of each document.
1315+
* - `chunk`: Splits long documents into smaller parts (chunks) before inference.
1316+
*
1317+
* When `long_document_strategy` is set to `chunk`, Elasticsearch splits each document into smaller parts but still returns a single score per document.
1318+
* That score reflects the highest relevance score among all chunks.
1319+
*/
1320+
long_document_strategy?: string
1321+
/**
1322+
* Only for the `rerank` task type.
1323+
* Limits the number of chunks per document that are sent for inference when chunking is enabled.
1324+
* If not set, all chunks generated for the document are processed.
1325+
*/
1326+
max_chunks_per_doc?: integer
13091327
}
13101328

13111329
export class ElasticsearchTaskSettings {

specification/inference/_types/Services.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ import {
5050
*/
5151
export class InferenceEndpoint {
5252
/**
53-
* Chunking configuration object
53+
* The chunking configuration object.
54+
* Applies only to the `sparse_embedding` and `text_embedding` task types.
55+
* Not applicable to the `rerank`, `completion`, or `chat_completion` task types.
5456
*/
5557
chunking_settings?: InferenceChunkingSettings
5658
/**

specification/inference/put_elasticsearch/PutElasticsearchRequest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ export interface Request extends RequestBase {
7979
body: {
8080
/**
8181
* The chunking configuration object.
82+
* Applies only to the `sparse_embedding` and `text_embedding` task types.
83+
* Not applicable to the `rerank`, `completion`, or `chat_completion` task types.
8284
* @ext_doc_id inference-chunking
8385
*/
8486
chunking_settings?: InferenceChunkingSettings

0 commit comments

Comments
 (0)