@@ -72,6 +72,7 @@ public class PutTrainedModelRequest extends RequestBase implements JsonpSerializ
7272 @ Nullable
7373 private final String description ;
7474
75+ @ Nullable
7576 private final InferenceConfigCreate inferenceConfig ;
7677
7778 @ Nullable
@@ -98,7 +99,7 @@ private PutTrainedModelRequest(Builder builder) {
9899 this .deferDefinitionDecompression = builder .deferDefinitionDecompression ;
99100 this .definition = builder .definition ;
100101 this .description = builder .description ;
101- this .inferenceConfig = ApiTypeHelper . requireNonNull ( builder .inferenceConfig , this , "inferenceConfig" ) ;
102+ this .inferenceConfig = builder .inferenceConfig ;
102103 this .input = builder .input ;
103104 this .metadata = builder .metadata ;
104105 this .modelId = ApiTypeHelper .requireNonNull (builder .modelId , this , "modelId" );
@@ -158,12 +159,14 @@ public final String description() {
158159 }
159160
160161 /**
161- * Required - The default configuration for inference. This can be either a
162- * regression or classification configuration. It must match the underlying
163- * definition.trained_model's target_type.
162+ * The default configuration for inference. This can be either a regression or
163+ * classification configuration. It must match the underlying
164+ * definition.trained_model's target_type. For pre-packaged models such as ELSER
165+ * the config is not required.
164166 * <p>
165167 * API name: {@code inference_config}
166168 */
169+ @ Nullable
167170 public final InferenceConfigCreate inferenceConfig () {
168171 return this .inferenceConfig ;
169172 }
@@ -254,9 +257,11 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) {
254257 generator .write (this .description );
255258
256259 }
257- generator .writeKey ("inference_config" );
258- this .inferenceConfig .serialize (generator , mapper );
260+ if (this .inferenceConfig != null ) {
261+ generator .writeKey ("inference_config" );
262+ this .inferenceConfig .serialize (generator , mapper );
259263
264+ }
260265 if (this .input != null ) {
261266 generator .writeKey ("input" );
262267 this .input .serialize (generator , mapper );
@@ -310,6 +315,7 @@ public static class Builder extends RequestBase.AbstractBuilder<Builder>
310315 @ Nullable
311316 private String description ;
312317
318+ @ Nullable
313319 private InferenceConfigCreate inferenceConfig ;
314320
315321 @ Nullable
@@ -385,21 +391,23 @@ public final Builder description(@Nullable String value) {
385391 }
386392
387393 /**
388- * Required - The default configuration for inference. This can be either a
389- * regression or classification configuration. It must match the underlying
390- * definition.trained_model's target_type.
394+ * The default configuration for inference. This can be either a regression or
395+ * classification configuration. It must match the underlying
396+ * definition.trained_model's target_type. For pre-packaged models such as ELSER
397+ * the config is not required.
391398 * <p>
392399 * API name: {@code inference_config}
393400 */
394- public final Builder inferenceConfig (InferenceConfigCreate value ) {
401+ public final Builder inferenceConfig (@ Nullable InferenceConfigCreate value ) {
395402 this .inferenceConfig = value ;
396403 return this ;
397404 }
398405
399406 /**
400- * Required - The default configuration for inference. This can be either a
401- * regression or classification configuration. It must match the underlying
402- * definition.trained_model's target_type.
407+ * The default configuration for inference. This can be either a regression or
408+ * classification configuration. It must match the underlying
409+ * definition.trained_model's target_type. For pre-packaged models such as ELSER
410+ * the config is not required.
403411 * <p>
404412 * API name: {@code inference_config}
405413 */
0 commit comments