From 767ee1122104077ef0553f0bac52cc2c7267d517 Mon Sep 17 00:00:00 2001 From: Laura Trotta Date: Wed, 8 May 2024 11:31:08 +0200 Subject: [PATCH] [codegen] update to latest api spec --- .../elasticsearch/doc-files/api-spec.html | 20 ++--- ...quest.java => DeleteInferenceRequest.java} | 30 ++++---- ...onse.java => DeleteInferenceResponse.java} | 29 +++---- .../ElasticsearchInferenceAsyncClient.java | 65 ++++++++-------- .../ElasticsearchInferenceClient.java | 60 +++++++-------- ...lRequest.java => GetInferenceRequest.java} | 32 ++++---- ...esponse.java => GetInferenceResponse.java} | 76 ++++++++++--------- ...odelConfig.java => InferenceEndpoint.java} | 37 ++++----- ...tainer.java => InferenceEndpointInfo.java} | 70 ++++++++--------- .../inference/InferenceRequest.java | 6 +- .../{PutModelRequest.java => PutRequest.java} | 62 +++++++-------- ...PutModelResponse.java => PutResponse.java} | 32 ++++---- 12 files changed, 264 insertions(+), 255 deletions(-) rename java-client/src/main/java/co/elastic/clients/elasticsearch/inference/{DeleteModelRequest.java => DeleteInferenceRequest.java} (86%) rename java-client/src/main/java/co/elastic/clients/elasticsearch/inference/{DeleteModelResponse.java => DeleteInferenceResponse.java} (74%) rename java-client/src/main/java/co/elastic/clients/elasticsearch/inference/{GetModelRequest.java => GetInferenceRequest.java} (87%) rename java-client/src/main/java/co/elastic/clients/elasticsearch/inference/{GetModelResponse.java => GetInferenceResponse.java} (59%) rename java-client/src/main/java/co/elastic/clients/elasticsearch/inference/{ModelConfig.java => InferenceEndpoint.java} (82%) rename java-client/src/main/java/co/elastic/clients/elasticsearch/inference/{ModelConfigContainer.java => InferenceEndpointInfo.java} (67%) rename java-client/src/main/java/co/elastic/clients/elasticsearch/inference/{PutModelRequest.java => PutRequest.java} (76%) rename java-client/src/main/java/co/elastic/clients/elasticsearch/inference/{PutModelResponse.java => PutResponse.java} (71%) diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html b/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html index f8847a845..742e8df76 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/doc-files/api-spec.html @@ -1509,22 +1509,22 @@ 'indices.validate_query.Request': 'indices/validate_query/IndicesValidateQueryRequest.ts#L25-L111', 'indices.validate_query.Response': 'indices/validate_query/IndicesValidateQueryResponse.ts#L23-L30', 'inference._types.CompletionResult': 'inference/_types/Results.ts#L59-L64', +'inference._types.InferenceEndpoint': 'inference/_types/Services.ts#L23-L39', +'inference._types.InferenceEndpointInfo': 'inference/_types/Services.ts#L41-L53', 'inference._types.InferenceResult': 'inference/_types/Results.ts#L77-L87', -'inference._types.ModelConfig': 'inference/_types/Services.ts#L23-L39', -'inference._types.ModelConfigContainer': 'inference/_types/Services.ts#L41-L53', 'inference._types.RankedDocument': 'inference/_types/Results.ts#L66-L76', 'inference._types.SparseEmbeddingResult': 'inference/_types/Results.ts#L35-L37', 'inference._types.TaskType': 'inference/_types/TaskType.ts#L20-L28', 'inference._types.TextEmbeddingByteResult': 'inference/_types/Results.ts#L45-L50', 'inference._types.TextEmbeddingResult': 'inference/_types/Results.ts#L52-L57', -'inference.delete_model.Request': 'inference/delete_model/DeleteModelRequest.ts#L24-L41', -'inference.delete_model.Response': 'inference/delete_model/DeleteModelResponse.ts#L22-L24', -'inference.get_model.Request': 'inference/get_model/GetModelRequest.ts#L24-L41', -'inference.get_model.Response': 'inference/get_model/GetModelResponse.ts#L22-L26', +'inference.delete.Request': 'inference/delete/DeleteRequest.ts#L24-L41', +'inference.delete.Response': 'inference/delete/DeleteResponse.ts#L22-L24', +'inference.get.Request': 'inference/get/GetRequest.ts#L24-L41', +'inference.get.Response': 'inference/get/GetResponse.ts#L22-L26', 'inference.inference.Request': 'inference/inference/InferenceRequest.ts#L26-L66', 'inference.inference.Response': 'inference/inference/InferenceResponse.ts#L22-L24', -'inference.put_model.Request': 'inference/put_model/PutModelRequest.ts#L25-L44', -'inference.put_model.Response': 'inference/put_model/PutModelResponse.ts#L22-L24', +'inference.put.Request': 'inference/put/PutRequest.ts#L25-L44', +'inference.put.Response': 'inference/put/PutResponse.ts#L22-L24', 'ingest._types.AppendProcessor': 'ingest/_types/Processors.ts#L279-L294', 'ingest._types.AttachmentProcessor': 'ingest/_types/Processors.ts#L296-L337', 'ingest._types.BytesProcessor': 'ingest/_types/Processors.ts#L392-L408', @@ -2714,10 +2714,10 @@ if (hash.length > 1) { hash = hash.substring(1); } - window.location = "https://github.com/elastic/elasticsearch-specification/tree/0bdc82a1d8e22d0479d280a2e0e9ba1ffeb86d05/specification/" + (paths[hash] || ""); + window.location = "https://github.com/elastic/elasticsearch-specification/tree/8d0b9be127b5ca759345e10ea9d571a7ea352b6f/specification/" + (paths[hash] || ""); - Please see the Elasticsearch API specification. + Please see the Elasticsearch API specification. diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteModelRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteInferenceRequest.java similarity index 86% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteModelRequest.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteInferenceRequest.java index 58a8f73c6..b89213a74 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteModelRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteInferenceRequest.java @@ -53,16 +53,16 @@ // //---------------------------------------------------------------- -// typedef: inference.delete_model.Request +// typedef: inference.delete.Request /** - * Delete an inference service model + * Delete an inference endpoint * - * @see API + * @see API * specification */ -public class DeleteModelRequest extends RequestBase { +public class DeleteInferenceRequest extends RequestBase { private final String inferenceId; @Nullable @@ -70,14 +70,14 @@ public class DeleteModelRequest extends RequestBase { // --------------------------------------------------------------------------------------------- - private DeleteModelRequest(Builder builder) { + private DeleteInferenceRequest(Builder builder) { this.inferenceId = ApiTypeHelper.requireNonNull(builder.inferenceId, this, "inferenceId"); this.taskType = builder.taskType; } - public static DeleteModelRequest of(Function> fn) { + public static DeleteInferenceRequest of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -103,12 +103,12 @@ public final TaskType taskType() { // --------------------------------------------------------------------------------------------- /** - * Builder for {@link DeleteModelRequest}. + * Builder for {@link DeleteInferenceRequest}. */ public static class Builder extends RequestBase.AbstractBuilder implements - ObjectBuilder { + ObjectBuilder { private String inferenceId; @Nullable @@ -140,25 +140,25 @@ protected Builder self() { } /** - * Builds a {@link DeleteModelRequest}. + * Builds a {@link DeleteInferenceRequest}. * * @throws NullPointerException * if some of the required fields are null. */ - public DeleteModelRequest build() { + public DeleteInferenceRequest build() { _checkSingleUse(); - return new DeleteModelRequest(this); + return new DeleteInferenceRequest(this); } } // --------------------------------------------------------------------------------------------- /** - * Endpoint "{@code inference.delete_model}". + * Endpoint "{@code inference.delete}". */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/inference.delete_model", + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/inference.delete", // Request method request -> { @@ -223,5 +223,5 @@ public DeleteModelRequest build() { request -> { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), false, DeleteModelResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, DeleteInferenceResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteModelResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteInferenceResponse.java similarity index 74% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteModelResponse.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteInferenceResponse.java index b479ad40b..879dde2e7 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteModelResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/DeleteInferenceResponse.java @@ -44,62 +44,63 @@ // //---------------------------------------------------------------- -// typedef: inference.delete_model.Response +// typedef: inference.delete.Response /** * - * @see API + * @see API * specification */ @JsonpDeserializable -public class DeleteModelResponse extends AcknowledgedResponseBase { +public class DeleteInferenceResponse extends AcknowledgedResponseBase { // --------------------------------------------------------------------------------------------- - private DeleteModelResponse(Builder builder) { + private DeleteInferenceResponse(Builder builder) { super(builder); } - public static DeleteModelResponse of(Function> fn) { + public static DeleteInferenceResponse of(Function> fn) { return fn.apply(new Builder()).build(); } // --------------------------------------------------------------------------------------------- /** - * Builder for {@link DeleteModelResponse}. + * Builder for {@link DeleteInferenceResponse}. */ public static class Builder extends AcknowledgedResponseBase.AbstractBuilder implements - ObjectBuilder { + ObjectBuilder { @Override protected Builder self() { return this; } /** - * Builds a {@link DeleteModelResponse}. + * Builds a {@link DeleteInferenceResponse}. * * @throws NullPointerException * if some of the required fields are null. */ - public DeleteModelResponse build() { + public DeleteInferenceResponse build() { _checkSingleUse(); - return new DeleteModelResponse(this); + return new DeleteInferenceResponse(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link DeleteModelResponse} + * Json deserializer for {@link DeleteInferenceResponse} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, DeleteModelResponse::setupDeleteModelResponseDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, DeleteInferenceResponse::setupDeleteInferenceResponseDeserializer); - protected static void setupDeleteModelResponseDeserializer(ObjectDeserializer op) { + protected static void setupDeleteInferenceResponseDeserializer( + ObjectDeserializer op) { AcknowledgedResponseBase.setupAcknowledgedResponseBaseDeserializer(op); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceAsyncClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceAsyncClient.java index 65bf9a9b5..7e71a572e 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceAsyncClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceAsyncClient.java @@ -67,89 +67,89 @@ public ElasticsearchInferenceAsyncClient withTransportOptions(@Nullable Transpor return new ElasticsearchInferenceAsyncClient(this.transport, transportOptions); } - // ----- Endpoint: inference.delete_model + // ----- Endpoint: inference.delete /** - * Delete model in the Inference API + * Delete an inference endpoint * * @see Documentation * on elastic.co */ - public CompletableFuture deleteModel(DeleteModelRequest request) { + public CompletableFuture delete(DeleteInferenceRequest request) { @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeleteModelRequest._ENDPOINT; + JsonEndpoint endpoint = (JsonEndpoint) DeleteInferenceRequest._ENDPOINT; return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } /** - * Delete model in the Inference API + * Delete an inference endpoint * * @param fn * a function that initializes a builder to create the - * {@link DeleteModelRequest} + * {@link DeleteInferenceRequest} * @see Documentation * on elastic.co */ - public final CompletableFuture deleteModel( - Function> fn) { - return deleteModel(fn.apply(new DeleteModelRequest.Builder()).build()); + public final CompletableFuture delete( + Function> fn) { + return delete(fn.apply(new DeleteInferenceRequest.Builder()).build()); } - // ----- Endpoint: inference.get_model + // ----- Endpoint: inference.get /** - * Get a model in the Inference API + * Get an inference endpoint * * @see Documentation * on elastic.co */ - public CompletableFuture getModel(GetModelRequest request) { + public CompletableFuture get(GetInferenceRequest request) { @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetModelRequest._ENDPOINT; + JsonEndpoint endpoint = (JsonEndpoint) GetInferenceRequest._ENDPOINT; return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } /** - * Get a model in the Inference API + * Get an inference endpoint * * @param fn * a function that initializes a builder to create the - * {@link GetModelRequest} + * {@link GetInferenceRequest} * @see Documentation * on elastic.co */ - public final CompletableFuture getModel( - Function> fn) { - return getModel(fn.apply(new GetModelRequest.Builder()).build()); + public final CompletableFuture get( + Function> fn) { + return get(fn.apply(new GetInferenceRequest.Builder()).build()); } /** - * Get a model in the Inference API + * Get an inference endpoint * * @see Documentation * on elastic.co */ - public CompletableFuture getModel() { - return this.transport.performRequestAsync(new GetModelRequest.Builder().build(), GetModelRequest._ENDPOINT, - this.transportOptions); + public CompletableFuture get() { + return this.transport.performRequestAsync(new GetInferenceRequest.Builder().build(), + GetInferenceRequest._ENDPOINT, this.transportOptions); } // ----- Endpoint: inference.inference /** - * Perform inference on a model + * Perform inference * * @see Documentation @@ -164,7 +164,7 @@ public CompletableFuture inference(InferenceRequest request) } /** - * Perform inference on a model + * Perform inference * * @param fn * a function that initializes a builder to create the @@ -179,37 +179,36 @@ public final CompletableFuture inference( return inference(fn.apply(new InferenceRequest.Builder()).build()); } - // ----- Endpoint: inference.put_model + // ----- Endpoint: inference.put /** - * Configure a model for use in the Inference API + * Configure an inference endpoint for use in the Inference API * * @see Documentation * on elastic.co */ - public CompletableFuture putModel(PutModelRequest request) { + public CompletableFuture put(PutRequest request) { @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) PutModelRequest._ENDPOINT; + JsonEndpoint endpoint = (JsonEndpoint) PutRequest._ENDPOINT; return this.transport.performRequestAsync(request, endpoint, this.transportOptions); } /** - * Configure a model for use in the Inference API + * Configure an inference endpoint for use in the Inference API * * @param fn * a function that initializes a builder to create the - * {@link PutModelRequest} + * {@link PutRequest} * @see Documentation * on elastic.co */ - public final CompletableFuture putModel( - Function> fn) { - return putModel(fn.apply(new PutModelRequest.Builder()).build()); + public final CompletableFuture put(Function> fn) { + return put(fn.apply(new PutRequest.Builder()).build()); } } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceClient.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceClient.java index eb499816b..02d56c657 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceClient.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ElasticsearchInferenceClient.java @@ -65,90 +65,90 @@ public ElasticsearchInferenceClient withTransportOptions(@Nullable TransportOpti return new ElasticsearchInferenceClient(this.transport, transportOptions); } - // ----- Endpoint: inference.delete_model + // ----- Endpoint: inference.delete /** - * Delete model in the Inference API + * Delete an inference endpoint * * @see Documentation * on elastic.co */ - public DeleteModelResponse deleteModel(DeleteModelRequest request) throws IOException, ElasticsearchException { + public DeleteInferenceResponse delete(DeleteInferenceRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) DeleteModelRequest._ENDPOINT; + JsonEndpoint endpoint = (JsonEndpoint) DeleteInferenceRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** - * Delete model in the Inference API + * Delete an inference endpoint * * @param fn * a function that initializes a builder to create the - * {@link DeleteModelRequest} + * {@link DeleteInferenceRequest} * @see Documentation * on elastic.co */ - public final DeleteModelResponse deleteModel( - Function> fn) + public final DeleteInferenceResponse delete( + Function> fn) throws IOException, ElasticsearchException { - return deleteModel(fn.apply(new DeleteModelRequest.Builder()).build()); + return delete(fn.apply(new DeleteInferenceRequest.Builder()).build()); } - // ----- Endpoint: inference.get_model + // ----- Endpoint: inference.get /** - * Get a model in the Inference API + * Get an inference endpoint * * @see Documentation * on elastic.co */ - public GetModelResponse getModel(GetModelRequest request) throws IOException, ElasticsearchException { + public GetInferenceResponse get(GetInferenceRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) GetModelRequest._ENDPOINT; + JsonEndpoint endpoint = (JsonEndpoint) GetInferenceRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** - * Get a model in the Inference API + * Get an inference endpoint * * @param fn * a function that initializes a builder to create the - * {@link GetModelRequest} + * {@link GetInferenceRequest} * @see Documentation * on elastic.co */ - public final GetModelResponse getModel(Function> fn) + public final GetInferenceResponse get(Function> fn) throws IOException, ElasticsearchException { - return getModel(fn.apply(new GetModelRequest.Builder()).build()); + return get(fn.apply(new GetInferenceRequest.Builder()).build()); } /** - * Get a model in the Inference API + * Get an inference endpoint * * @see Documentation * on elastic.co */ - public GetModelResponse getModel() throws IOException, ElasticsearchException { - return this.transport.performRequest(new GetModelRequest.Builder().build(), GetModelRequest._ENDPOINT, + public GetInferenceResponse get() throws IOException, ElasticsearchException { + return this.transport.performRequest(new GetInferenceRequest.Builder().build(), GetInferenceRequest._ENDPOINT, this.transportOptions); } // ----- Endpoint: inference.inference /** - * Perform inference on a model + * Perform inference * * @see Documentation @@ -163,7 +163,7 @@ public InferenceResponse inference(InferenceRequest request) throws IOException, } /** - * Perform inference on a model + * Perform inference * * @param fn * a function that initializes a builder to create the @@ -178,37 +178,37 @@ public final InferenceResponse inference(FunctionDocumentation * on elastic.co */ - public PutModelResponse putModel(PutModelRequest request) throws IOException, ElasticsearchException { + public PutResponse put(PutRequest request) throws IOException, ElasticsearchException { @SuppressWarnings("unchecked") - JsonEndpoint endpoint = (JsonEndpoint) PutModelRequest._ENDPOINT; + JsonEndpoint endpoint = (JsonEndpoint) PutRequest._ENDPOINT; return this.transport.performRequest(request, endpoint, this.transportOptions); } /** - * Configure a model for use in the Inference API + * Configure an inference endpoint for use in the Inference API * * @param fn * a function that initializes a builder to create the - * {@link PutModelRequest} + * {@link PutRequest} * @see Documentation * on elastic.co */ - public final PutModelResponse putModel(Function> fn) + public final PutResponse put(Function> fn) throws IOException, ElasticsearchException { - return putModel(fn.apply(new PutModelRequest.Builder()).build()); + return put(fn.apply(new PutRequest.Builder()).build()); } } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetModelRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetInferenceRequest.java similarity index 87% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetModelRequest.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetInferenceRequest.java index 63784862e..8a167a202 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetModelRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetInferenceRequest.java @@ -52,16 +52,16 @@ // //---------------------------------------------------------------- -// typedef: inference.get_model.Request +// typedef: inference.get.Request /** - * Get an inference service model + * Get an inference endpoint * - * @see API + * @see API * specification */ -public class GetModelRequest extends RequestBase { +public class GetInferenceRequest extends RequestBase { @Nullable private final String inferenceId; @@ -70,14 +70,14 @@ public class GetModelRequest extends RequestBase { // --------------------------------------------------------------------------------------------- - private GetModelRequest(Builder builder) { + private GetInferenceRequest(Builder builder) { this.inferenceId = builder.inferenceId; this.taskType = builder.taskType; } - public static GetModelRequest of(Function> fn) { + public static GetInferenceRequest of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -104,10 +104,12 @@ public final TaskType taskType() { // --------------------------------------------------------------------------------------------- /** - * Builder for {@link GetModelRequest}. + * Builder for {@link GetInferenceRequest}. */ - public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends RequestBase.AbstractBuilder + implements + ObjectBuilder { @Nullable private String inferenceId; @@ -140,25 +142,25 @@ protected Builder self() { } /** - * Builds a {@link GetModelRequest}. + * Builds a {@link GetInferenceRequest}. * * @throws NullPointerException * if some of the required fields are null. */ - public GetModelRequest build() { + public GetInferenceRequest build() { _checkSingleUse(); - return new GetModelRequest(this); + return new GetInferenceRequest(this); } } // --------------------------------------------------------------------------------------------- /** - * Endpoint "{@code inference.get_model}". + * Endpoint "{@code inference.get}". */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/inference.get_model", + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/inference.get", // Request method request -> { @@ -232,5 +234,5 @@ public GetModelRequest build() { request -> { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), false, GetModelResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), false, GetInferenceResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetModelResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetInferenceResponse.java similarity index 59% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetModelResponse.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetInferenceResponse.java index 1d02e083a..17a5d4458 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetModelResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/GetInferenceResponse.java @@ -50,34 +50,34 @@ // //---------------------------------------------------------------- -// typedef: inference.get_model.Response +// typedef: inference.get.Response /** * - * @see API + * @see API * specification */ @JsonpDeserializable -public class GetModelResponse implements JsonpSerializable { - private final List models; +public class GetInferenceResponse implements JsonpSerializable { + private final List endpoints; // --------------------------------------------------------------------------------------------- - private GetModelResponse(Builder builder) { + private GetInferenceResponse(Builder builder) { - this.models = ApiTypeHelper.unmodifiableRequired(builder.models, this, "models"); + this.endpoints = ApiTypeHelper.unmodifiableRequired(builder.endpoints, this, "endpoints"); } - public static GetModelResponse of(Function> fn) { + public static GetInferenceResponse of(Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - API name: {@code models} + * Required - API name: {@code endpoints} */ - public final List models() { - return this.models; + public final List endpoints() { + return this.endpoints; } /** @@ -91,10 +91,10 @@ public void serialize(JsonGenerator generator, JsonpMapper mapper) { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { - if (ApiTypeHelper.isDefined(this.models)) { - generator.writeKey("models"); + if (ApiTypeHelper.isDefined(this.endpoints)) { + generator.writeKey("endpoints"); generator.writeStartArray(); - for (ModelConfigContainer item0 : this.models) { + for (InferenceEndpointInfo item0 : this.endpoints) { item0.serialize(generator, mapper); } @@ -112,39 +112,42 @@ public String toString() { // --------------------------------------------------------------------------------------------- /** - * Builder for {@link GetModelResponse}. + * Builder for {@link GetInferenceResponse}. */ - public static class Builder extends WithJsonObjectBuilderBase implements ObjectBuilder { - private List models; + public static class Builder extends WithJsonObjectBuilderBase + implements + ObjectBuilder { + private List endpoints; /** - * Required - API name: {@code models} + * Required - API name: {@code endpoints} *

- * Adds all elements of list to models. + * Adds all elements of list to endpoints. */ - public final Builder models(List list) { - this.models = _listAddAll(this.models, list); + public final Builder endpoints(List list) { + this.endpoints = _listAddAll(this.endpoints, list); return this; } /** - * Required - API name: {@code models} + * Required - API name: {@code endpoints} *

- * Adds one or more values to models. + * Adds one or more values to endpoints. */ - public final Builder models(ModelConfigContainer value, ModelConfigContainer... values) { - this.models = _listAdd(this.models, value, values); + public final Builder endpoints(InferenceEndpointInfo value, InferenceEndpointInfo... values) { + this.endpoints = _listAdd(this.endpoints, value, values); return this; } /** - * Required - API name: {@code models} + * Required - API name: {@code endpoints} *

- * Adds a value to models using a builder lambda. + * Adds a value to endpoints using a builder lambda. */ - public final Builder models(Function> fn) { - return models(fn.apply(new ModelConfigContainer.Builder()).build()); + public final Builder endpoints( + Function> fn) { + return endpoints(fn.apply(new InferenceEndpointInfo.Builder()).build()); } @Override @@ -153,29 +156,30 @@ protected Builder self() { } /** - * Builds a {@link GetModelResponse}. + * Builds a {@link GetInferenceResponse}. * * @throws NullPointerException * if some of the required fields are null. */ - public GetModelResponse build() { + public GetInferenceResponse build() { _checkSingleUse(); - return new GetModelResponse(this); + return new GetInferenceResponse(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link GetModelResponse} + * Json deserializer for {@link GetInferenceResponse} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - GetModelResponse::setupGetModelResponseDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, GetInferenceResponse::setupGetInferenceResponseDeserializer); - protected static void setupGetModelResponseDeserializer(ObjectDeserializer op) { + protected static void setupGetInferenceResponseDeserializer(ObjectDeserializer op) { - op.add(Builder::models, JsonpDeserializer.arrayDeserializer(ModelConfigContainer._DESERIALIZER), "models"); + op.add(Builder::endpoints, JsonpDeserializer.arrayDeserializer(InferenceEndpointInfo._DESERIALIZER), + "endpoints"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ModelConfig.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceEndpoint.java similarity index 82% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ModelConfig.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceEndpoint.java index f7a219e29..89d4b95a9 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ModelConfig.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceEndpoint.java @@ -51,16 +51,17 @@ // //---------------------------------------------------------------- -// typedef: inference._types.ModelConfig +// typedef: inference._types.InferenceEndpoint /** - * Configuration options when storing the model config + * Configuration options when storing the inference endpoint * - * @see API + * @see API * specification */ @JsonpDeserializable -public class ModelConfig implements JsonpSerializable { +public class InferenceEndpoint implements JsonpSerializable { private final String service; private final JsonData serviceSettings; @@ -69,7 +70,7 @@ public class ModelConfig implements JsonpSerializable { // --------------------------------------------------------------------------------------------- - protected ModelConfig(AbstractBuilder builder) { + protected InferenceEndpoint(AbstractBuilder builder) { this.service = ApiTypeHelper.requireNonNull(builder.service, this, "service"); this.serviceSettings = ApiTypeHelper.requireNonNull(builder.serviceSettings, this, "serviceSettings"); @@ -77,7 +78,7 @@ protected ModelConfig(AbstractBuilder builder) { } - public static ModelConfig modelConfigOf(Function> fn) { + public static InferenceEndpoint inferenceEndpointOf(Function> fn) { return fn.apply(new Builder()).build(); } @@ -100,7 +101,7 @@ public final JsonData serviceSettings() { } /** - * Required - Task settings specific to the service and model + * Required - Task settings specific to the service and task type *

* API name: {@code task_settings} */ @@ -138,25 +139,27 @@ public String toString() { // --------------------------------------------------------------------------------------------- /** - * Builder for {@link ModelConfig}. + * Builder for {@link InferenceEndpoint}. */ - public static class Builder extends ModelConfig.AbstractBuilder implements ObjectBuilder { + public static class Builder extends InferenceEndpoint.AbstractBuilder + implements + ObjectBuilder { @Override protected Builder self() { return this; } /** - * Builds a {@link ModelConfig}. + * Builds a {@link InferenceEndpoint}. * * @throws NullPointerException * if some of the required fields are null. */ - public ModelConfig build() { + public InferenceEndpoint build() { _checkSingleUse(); - return new ModelConfig(this); + return new InferenceEndpoint(this); } } @@ -190,7 +193,7 @@ public final BuilderT serviceSettings(JsonData value) { } /** - * Required - Task settings specific to the service and model + * Required - Task settings specific to the service and task type *

* API name: {@code task_settings} */ @@ -206,12 +209,12 @@ public final BuilderT taskSettings(JsonData value) { // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link ModelConfig} + * Json deserializer for {@link InferenceEndpoint} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - ModelConfig::setupModelConfigDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, InferenceEndpoint::setupInferenceEndpointDeserializer); - protected static > void setupModelConfigDeserializer( + protected static > void setupInferenceEndpointDeserializer( ObjectDeserializer op) { op.add(AbstractBuilder::service, JsonpDeserializer.stringDeserializer(), "service"); diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ModelConfigContainer.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceEndpointInfo.java similarity index 67% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ModelConfigContainer.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceEndpointInfo.java index 10677d187..9ec75b927 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/ModelConfigContainer.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceEndpointInfo.java @@ -48,47 +48,47 @@ // //---------------------------------------------------------------- -// typedef: inference._types.ModelConfigContainer +// typedef: inference._types.InferenceEndpointInfo /** - * Represents a model as returned by the GET API + * Represents an inference endpoint as returned by the GET API * * @see API + * "../doc-files/api-spec.html#inference._types.InferenceEndpointInfo">API * specification */ @JsonpDeserializable -public class ModelConfigContainer extends ModelConfig { - private final String modelId; +public class InferenceEndpointInfo extends InferenceEndpoint { + private final String inferenceId; private final TaskType taskType; // --------------------------------------------------------------------------------------------- - protected ModelConfigContainer(AbstractBuilder builder) { + protected InferenceEndpointInfo(AbstractBuilder builder) { super(builder); - this.modelId = ApiTypeHelper.requireNonNull(builder.modelId, this, "modelId"); + this.inferenceId = ApiTypeHelper.requireNonNull(builder.inferenceId, this, "inferenceId"); this.taskType = ApiTypeHelper.requireNonNull(builder.taskType, this, "taskType"); } - public static ModelConfigContainer modelConfigContainerOf( - Function> fn) { + public static InferenceEndpointInfo inferenceEndpointInfoOf( + Function> fn) { return fn.apply(new Builder()).build(); } /** - * Required - The model Id + * Required - The inference Id *

- * API name: {@code model_id} + * API name: {@code inference_id} */ - public final String modelId() { - return this.modelId; + public final String inferenceId() { + return this.inferenceId; } /** - * Required - The model's task type + * Required - The task type *

* API name: {@code task_type} */ @@ -99,8 +99,8 @@ public final TaskType taskType() { protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { super.serializeInternal(generator, mapper); - generator.writeKey("model_id"); - generator.write(this.modelId); + generator.writeKey("inference_id"); + generator.write(this.inferenceId); generator.writeKey("task_type"); this.taskType.serialize(generator, mapper); @@ -110,49 +110,49 @@ protected void serializeInternal(JsonGenerator generator, JsonpMapper mapper) { // --------------------------------------------------------------------------------------------- /** - * Builder for {@link ModelConfigContainer}. + * Builder for {@link InferenceEndpointInfo}. */ - public static class Builder extends ModelConfigContainer.AbstractBuilder + public static class Builder extends InferenceEndpointInfo.AbstractBuilder implements - ObjectBuilder { + ObjectBuilder { @Override protected Builder self() { return this; } /** - * Builds a {@link ModelConfigContainer}. + * Builds a {@link InferenceEndpointInfo}. * * @throws NullPointerException * if some of the required fields are null. */ - public ModelConfigContainer build() { + public InferenceEndpointInfo build() { _checkSingleUse(); - return new ModelConfigContainer(this); + return new InferenceEndpointInfo(this); } } public abstract static class AbstractBuilder> extends - ModelConfig.AbstractBuilder { - private String modelId; + InferenceEndpoint.AbstractBuilder { + private String inferenceId; private TaskType taskType; /** - * Required - The model Id + * Required - The inference Id *

- * API name: {@code model_id} + * API name: {@code inference_id} */ - public final BuilderT modelId(String value) { - this.modelId = value; + public final BuilderT inferenceId(String value) { + this.inferenceId = value; return self(); } /** - * Required - The model's task type + * Required - The task type *

* API name: {@code task_type} */ @@ -166,15 +166,15 @@ public final BuilderT taskType(TaskType value) { // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link ModelConfigContainer} + * Json deserializer for {@link InferenceEndpointInfo} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer - .lazy(Builder::new, ModelConfigContainer::setupModelConfigContainerDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer + .lazy(Builder::new, InferenceEndpointInfo::setupInferenceEndpointInfoDeserializer); - protected static > void setupModelConfigContainerDeserializer( + protected static > void setupInferenceEndpointInfoDeserializer( ObjectDeserializer op) { - ModelConfig.setupModelConfigDeserializer(op); - op.add(AbstractBuilder::modelId, JsonpDeserializer.stringDeserializer(), "model_id"); + InferenceEndpoint.setupInferenceEndpointDeserializer(op); + op.add(AbstractBuilder::inferenceId, JsonpDeserializer.stringDeserializer(), "inference_id"); op.add(AbstractBuilder::taskType, TaskType._DESERIALIZER, "task_type"); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceRequest.java index ab5f6aee7..90fc7c254 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/InferenceRequest.java @@ -110,7 +110,7 @@ public final String inferenceId() { } /** - * Required - Text input to the model. Either a string or an array of strings. + * Required - Inference input. Either a string or an array of strings. *

* API name: {@code input} */ @@ -228,7 +228,7 @@ public final Builder inferenceId(String value) { } /** - * Required - Text input to the model. Either a string or an array of strings. + * Required - Inference input. Either a string or an array of strings. *

* API name: {@code input} *

@@ -240,7 +240,7 @@ public final Builder input(List list) { } /** - * Required - Text input to the model. Either a string or an array of strings. + * Required - Inference input. Either a string or an array of strings. *

* API name: {@code input} *

diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutModelRequest.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutRequest.java similarity index 76% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutModelRequest.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutRequest.java index 30c31115d..3de1fbd28 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutModelRequest.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutRequest.java @@ -56,34 +56,34 @@ // //---------------------------------------------------------------- -// typedef: inference.put_model.Request +// typedef: inference.put.Request /** - * Create an inference service model + * Create an inference endpoint * - * @see API + * @see API * specification */ @JsonpDeserializable -public class PutModelRequest extends RequestBase implements JsonpSerializable { +public class PutRequest extends RequestBase implements JsonpSerializable { private final String inferenceId; @Nullable private final TaskType taskType; - private final ModelConfig modelConfig; + private final InferenceEndpoint inferenceConfig; // --------------------------------------------------------------------------------------------- - private PutModelRequest(Builder builder) { + private PutRequest(Builder builder) { this.inferenceId = ApiTypeHelper.requireNonNull(builder.inferenceId, this, "inferenceId"); this.taskType = builder.taskType; - this.modelConfig = ApiTypeHelper.requireNonNull(builder.modelConfig, this, "modelConfig"); + this.inferenceConfig = ApiTypeHelper.requireNonNull(builder.inferenceConfig, this, "inferenceConfig"); } - public static PutModelRequest of(Function> fn) { + public static PutRequest of(Function> fn) { return fn.apply(new Builder()).build(); } @@ -109,31 +109,31 @@ public final TaskType taskType() { /** * Required - Request body. */ - public final ModelConfig modelConfig() { - return this.modelConfig; + public final InferenceEndpoint inferenceConfig() { + return this.inferenceConfig; } /** * Serialize this value to JSON. */ public void serialize(JsonGenerator generator, JsonpMapper mapper) { - this.modelConfig.serialize(generator, mapper); + this.inferenceConfig.serialize(generator, mapper); } // --------------------------------------------------------------------------------------------- /** - * Builder for {@link PutModelRequest}. + * Builder for {@link PutRequest}. */ - public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { + public static class Builder extends RequestBase.AbstractBuilder implements ObjectBuilder { private String inferenceId; @Nullable private TaskType taskType; - private ModelConfig modelConfig; + private InferenceEndpoint inferenceConfig; /** * Required - The inference Id @@ -158,24 +158,24 @@ public final Builder taskType(@Nullable TaskType value) { /** * Required - Request body. */ - public final Builder modelConfig(ModelConfig value) { - this.modelConfig = value; + public final Builder inferenceConfig(InferenceEndpoint value) { + this.inferenceConfig = value; return this; } /** * Required - Request body. */ - public final Builder modelConfig(Function> fn) { - return this.modelConfig(fn.apply(new ModelConfig.Builder()).build()); + public final Builder inferenceConfig(Function> fn) { + return this.inferenceConfig(fn.apply(new InferenceEndpoint.Builder()).build()); } @Override public Builder withJson(JsonParser parser, JsonpMapper mapper) { @SuppressWarnings("unchecked") - ModelConfig value = (ModelConfig) ModelConfig._DESERIALIZER.deserialize(parser, mapper); - return this.modelConfig(value); + InferenceEndpoint value = (InferenceEndpoint) InferenceEndpoint._DESERIALIZER.deserialize(parser, mapper); + return this.inferenceConfig(value); } @Override @@ -184,34 +184,34 @@ protected Builder self() { } /** - * Builds a {@link PutModelRequest}. + * Builds a {@link PutRequest}. * * @throws NullPointerException * if some of the required fields are null. */ - public PutModelRequest build() { + public PutRequest build() { _checkSingleUse(); - return new PutModelRequest(this); + return new PutRequest(this); } } - public static final JsonpDeserializer _DESERIALIZER = createPutModelRequestDeserializer(); - protected static JsonpDeserializer createPutModelRequestDeserializer() { + public static final JsonpDeserializer _DESERIALIZER = createPutRequestDeserializer(); + protected static JsonpDeserializer createPutRequestDeserializer() { - JsonpDeserializer valueDeserializer = ModelConfig._DESERIALIZER; + JsonpDeserializer valueDeserializer = InferenceEndpoint._DESERIALIZER; return JsonpDeserializer.of(valueDeserializer.acceptedEvents(), (parser, mapper, event) -> new Builder() - .modelConfig(valueDeserializer.deserialize(parser, mapper, event)).build()); + .inferenceConfig(valueDeserializer.deserialize(parser, mapper, event)).build()); } // --------------------------------------------------------------------------------------------- /** - * Endpoint "{@code inference.put_model}". + * Endpoint "{@code inference.put}". */ - public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( - "es/inference.put_model", + public static final Endpoint _ENDPOINT = new SimpleEndpoint<>( + "es/inference.put", // Request method request -> { @@ -276,5 +276,5 @@ protected static JsonpDeserializer createPutModelRequestDeseria request -> { return Collections.emptyMap(); - }, SimpleEndpoint.emptyMap(), true, PutModelResponse._DESERIALIZER); + }, SimpleEndpoint.emptyMap(), true, PutResponse._DESERIALIZER); } diff --git a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutModelResponse.java b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutResponse.java similarity index 71% rename from java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutModelResponse.java rename to java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutResponse.java index 1d25f7476..ec984c519 100644 --- a/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutModelResponse.java +++ b/java-client/src/main/java/co/elastic/clients/elasticsearch/inference/PutResponse.java @@ -43,63 +43,63 @@ // //---------------------------------------------------------------- -// typedef: inference.put_model.Response +// typedef: inference.put.Response /** * - * @see API + * @see API * specification */ @JsonpDeserializable -public class PutModelResponse extends ModelConfigContainer { +public class PutResponse extends InferenceEndpointInfo { // --------------------------------------------------------------------------------------------- - private PutModelResponse(Builder builder) { + private PutResponse(Builder builder) { super(builder); } - public static PutModelResponse of(Function> fn) { + public static PutResponse of(Function> fn) { return fn.apply(new Builder()).build(); } // --------------------------------------------------------------------------------------------- /** - * Builder for {@link PutModelResponse}. + * Builder for {@link PutResponse}. */ - public static class Builder extends ModelConfigContainer.AbstractBuilder + public static class Builder extends InferenceEndpointInfo.AbstractBuilder implements - ObjectBuilder { + ObjectBuilder { @Override protected Builder self() { return this; } /** - * Builds a {@link PutModelResponse}. + * Builds a {@link PutResponse}. * * @throws NullPointerException * if some of the required fields are null. */ - public PutModelResponse build() { + public PutResponse build() { _checkSingleUse(); - return new PutModelResponse(this); + return new PutResponse(this); } } // --------------------------------------------------------------------------------------------- /** - * Json deserializer for {@link PutModelResponse} + * Json deserializer for {@link PutResponse} */ - public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, - PutModelResponse::setupPutModelResponseDeserializer); + public static final JsonpDeserializer _DESERIALIZER = ObjectBuilderDeserializer.lazy(Builder::new, + PutResponse::setupPutResponseDeserializer); - protected static void setupPutModelResponseDeserializer(ObjectDeserializer op) { - ModelConfigContainer.setupModelConfigContainerDeserializer(op); + protected static void setupPutResponseDeserializer(ObjectDeserializer op) { + InferenceEndpointInfo.setupInferenceEndpointInfoDeserializer(op); }