@@ -73,6 +73,9 @@ public class CustomServiceSettings extends FilteredXContentObject implements Ser
73
73
public static final TransportVersionSet ML_INFERENCE_CUSTOM_SERVICE_EMBEDDING_TYPE = TransportVersionSet .get (
74
74
"ml-inference-custom-service-embedding-type"
75
75
);
76
+ public static final TransportVersionSet ML_INFERENCE_CUSTOM_SERVICE_EMBEDDING_BATCH_SIZE = TransportVersionSet .get (
77
+ "ml-inference-custom-service-embedding-batch-size"
78
+ );
76
79
77
80
public static CustomServiceSettings fromMap (Map <String , Object > map , ConfigurationParseContext context , TaskType taskType ) {
78
81
ValidationException validationException = new ValidationException ();
@@ -286,15 +289,13 @@ public CustomServiceSettings(StreamInput in) throws IOException {
286
289
responseJsonParser = in .readNamedWriteable (CustomResponseParser .class );
287
290
rateLimitSettings = new RateLimitSettings (in );
288
291
289
- if (in .getTransportVersion ().before (TransportVersions .ML_INFERENCE_CUSTOM_SERVICE_REMOVE_ERROR_PARSING )
290
- && in .getTransportVersion ().isPatchFrom (TransportVersions .ML_INFERENCE_CUSTOM_SERVICE_REMOVE_ERROR_PARSING_8_19 ) == false ) {
292
+ if (ML_INFERENCE_CUSTOM_SERVICE_EMBEDDING_BATCH_SIZE .isNotCompatible (in .getTransportVersion ())) {
291
293
// Read the error parsing fields for backwards compatibility
292
294
in .readString ();
293
295
in .readString ();
294
296
}
295
297
296
- if (in .getTransportVersion ().onOrAfter (TransportVersions .ML_INFERENCE_CUSTOM_SERVICE_EMBEDDING_BATCH_SIZE )
297
- || in .getTransportVersion ().isPatchFrom (TransportVersions .ML_INFERENCE_CUSTOM_SERVICE_EMBEDDING_BATCH_SIZE_8_19 )) {
298
+ if (ML_INFERENCE_CUSTOM_SERVICE_EMBEDDING_BATCH_SIZE .isCompatible (in .getTransportVersion ())) {
298
299
batchSize = in .readVInt ();
299
300
} else {
300
301
batchSize = DEFAULT_EMBEDDING_BATCH_SIZE ;
@@ -444,15 +445,13 @@ public void writeTo(StreamOutput out) throws IOException {
444
445
out .writeNamedWriteable (responseJsonParser );
445
446
rateLimitSettings .writeTo (out );
446
447
447
- if (out .getTransportVersion ().before (TransportVersions .ML_INFERENCE_CUSTOM_SERVICE_REMOVE_ERROR_PARSING )
448
- && out .getTransportVersion ().isPatchFrom (TransportVersions .ML_INFERENCE_CUSTOM_SERVICE_REMOVE_ERROR_PARSING_8_19 ) == false ) {
448
+ if (ML_INFERENCE_CUSTOM_SERVICE_EMBEDDING_BATCH_SIZE .isNotCompatible (out .getTransportVersion ())) {
449
449
// Write empty strings for backwards compatibility for the error parsing fields
450
450
out .writeString ("" );
451
451
out .writeString ("" );
452
452
}
453
453
454
- if (out .getTransportVersion ().onOrAfter (TransportVersions .ML_INFERENCE_CUSTOM_SERVICE_EMBEDDING_BATCH_SIZE )
455
- || out .getTransportVersion ().isPatchFrom (TransportVersions .ML_INFERENCE_CUSTOM_SERVICE_EMBEDDING_BATCH_SIZE_8_19 )) {
454
+ if (ML_INFERENCE_CUSTOM_SERVICE_EMBEDDING_BATCH_SIZE .isCompatible (out .getTransportVersion ())) {
456
455
out .writeVInt (batchSize );
457
456
}
458
457
0 commit comments