@@ -73,6 +73,9 @@ public class CustomServiceSettings extends FilteredXContentObject implements Ser
7373 public static final TransportVersionSet ML_INFERENCE_CUSTOM_SERVICE_EMBEDDING_TYPE = TransportVersionSet .get (
7474 "ml-inference-custom-service-embedding-type"
7575 );
76+ public static final TransportVersionSet ML_INFERENCE_CUSTOM_SERVICE_EMBEDDING_BATCH_SIZE = TransportVersionSet .get (
77+ "ml-inference-custom-service-embedding-batch-size"
78+ );
7679
7780 public static CustomServiceSettings fromMap (Map <String , Object > map , ConfigurationParseContext context , TaskType taskType ) {
7881 ValidationException validationException = new ValidationException ();
@@ -286,15 +289,13 @@ public CustomServiceSettings(StreamInput in) throws IOException {
286289 responseJsonParser = in .readNamedWriteable (CustomResponseParser .class );
287290 rateLimitSettings = new RateLimitSettings (in );
288291
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 ())) {
291293 // Read the error parsing fields for backwards compatibility
292294 in .readString ();
293295 in .readString ();
294296 }
295297
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 ())) {
298299 batchSize = in .readVInt ();
299300 } else {
300301 batchSize = DEFAULT_EMBEDDING_BATCH_SIZE ;
@@ -444,15 +445,13 @@ public void writeTo(StreamOutput out) throws IOException {
444445 out .writeNamedWriteable (responseJsonParser );
445446 rateLimitSettings .writeTo (out );
446447
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 ())) {
449449 // Write empty strings for backwards compatibility for the error parsing fields
450450 out .writeString ("" );
451451 out .writeString ("" );
452452 }
453453
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 ())) {
456455 out .writeVInt (batchSize );
457456 }
458457
0 commit comments