|
@@ -97,6 +97,8 @@ public class ElasticsearchInternalService extends BaseElasticsearchInternalServi
|
|
|
MULTILINGUAL_E5_SMALL_MODEL_ID_LINUX_X86
|
|
|
);
|
|
|
|
|
|
+ public static final String RERANKER_ID = ".rerank-v1";
|
|
|
+
|
|
|
public static final int EMBEDDING_MAX_BATCH_SIZE = 10;
|
|
|
public static final String DEFAULT_ELSER_ID = ".elser-2-elasticsearch";
|
|
|
public static final String DEFAULT_E5_ID = ".multilingual-e5-small-elasticsearch";
|
|
@@ -223,6 +225,8 @@ public class ElasticsearchInternalService extends BaseElasticsearchInternalServi
|
|
|
)
|
|
|
)
|
|
|
);
|
|
|
+ } else if (RERANKER_ID.equals(modelId)) {
|
|
|
+ rerankerCase(inferenceEntityId, taskType, config, serviceSettingsMap, chunkingSettings, modelListener);
|
|
|
} else {
|
|
|
customElandCase(inferenceEntityId, taskType, serviceSettingsMap, taskSettingsMap, chunkingSettings, modelListener);
|
|
|
}
|
|
@@ -323,6 +327,31 @@ public class ElasticsearchInternalService extends BaseElasticsearchInternalServi
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+ private void rerankerCase(
|
|
|
+ String inferenceEntityId,
|
|
|
+ TaskType taskType,
|
|
|
+ Map<String, Object> config,
|
|
|
+ Map<String, Object> serviceSettingsMap,
|
|
|
+ ChunkingSettings chunkingSettings,
|
|
|
+ ActionListener<Model> modelListener
|
|
|
+ ) {
|
|
|
+
|
|
|
+ var esServiceSettingsBuilder = ElasticsearchInternalServiceSettings.fromRequestMap(serviceSettingsMap);
|
|
|
+
|
|
|
+ throwIfNotEmptyMap(config, name());
|
|
|
+ throwIfNotEmptyMap(serviceSettingsMap, name());
|
|
|
+
|
|
|
+ modelListener.onResponse(
|
|
|
+ new ElasticRerankerModel(
|
|
|
+ inferenceEntityId,
|
|
|
+ taskType,
|
|
|
+ NAME,
|
|
|
+ new ElasticRerankerServiceSettings(esServiceSettingsBuilder.build()),
|
|
|
+ chunkingSettings
|
|
|
+ )
|
|
|
+ );
|
|
|
+ }
|
|
|
+
|
|
|
private void e5Case(
|
|
|
String inferenceEntityId,
|
|
|
TaskType taskType,
|