Skip to content

Commit 2b23030

Browse files
committed
Adds new parameters to the elasticsearch inference rerank API
1 parent 7cce59c commit 2b23030

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

specification/inference/_types/CommonTypes.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,23 @@ export class ElasticsearchServiceSettings {
13061306
* The maximum value is 32.
13071307
*/
13081308
num_threads: integer
1309+
/**
1310+
* Only for the `rerank` task type.
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+
* To enable chunking, set this value to `chunk`.
1318+
*/
1319+
long_document_strategy?: string
1320+
/**
1321+
* Only for the `rerank` task type.
1322+
* Limits the number of chunks per document that are sent for inference when chunking is enabled.
1323+
* If not set, all chunks generated for the document are processed.
1324+
*/
1325+
max_chunks_per_doc?: integer
13091326
}
13101327

13111328
export class ElasticsearchTaskSettings {

specification/inference/put_elasticsearch/PutElasticsearchRequest.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
ElasticsearchTaskSettings,
2727
ElasticsearchTaskType
2828
} from '@inference/_types/CommonTypes'
29-
import { InferenceChunkingSettings } from '@inference/_types/Services'
29+
import { ElasticsearchInferenceChunkingSettings } from '@inference/_types/Services'
3030

3131
/**
3232
* Create an Elasticsearch inference endpoint.
@@ -78,10 +78,10 @@ export interface Request extends RequestBase {
7878
}
7979
body: {
8080
/**
81-
* The chunking configuration object.
81+
* The chunking configuration object. For the `rerank` task type, you can enable chunking by setting the `long_document_strategy` parameter to `chunk` in the `service_settings` object.
8282
* @ext_doc_id inference-chunking
8383
*/
84-
chunking_settings?: InferenceChunkingSettings
84+
chunking_settings?: ElasticsearchInferenceChunkingSettings
8585
/**
8686
* The type of service supported for the specified task type. In this case, `elasticsearch`.
8787
*/

0 commit comments

Comments
 (0)