|
| 1 | +// Copyright (c) Microsoft Corporation. All rights reserved. |
| 2 | +// Licensed under the MIT License. |
| 3 | +// Code generated by Microsoft (R) TypeSpec Code Generator. |
| 4 | + |
| 5 | +package com._specs_.azure.core.model; |
| 6 | + |
| 7 | +import com._specs_.azure.core.model.implementation.AzureCoreEmbeddingVectorsImpl; |
| 8 | +import com._specs_.azure.core.model.models.AzureEmbeddingModel; |
| 9 | +import com.azure.core.annotation.Generated; |
| 10 | +import com.azure.core.annotation.ReturnType; |
| 11 | +import com.azure.core.annotation.ServiceClient; |
| 12 | +import com.azure.core.annotation.ServiceMethod; |
| 13 | +import com.azure.core.exception.ClientAuthenticationException; |
| 14 | +import com.azure.core.exception.HttpResponseException; |
| 15 | +import com.azure.core.exception.ResourceModifiedException; |
| 16 | +import com.azure.core.exception.ResourceNotFoundException; |
| 17 | +import com.azure.core.http.rest.RequestOptions; |
| 18 | +import com.azure.core.http.rest.Response; |
| 19 | +import com.azure.core.util.BinaryData; |
| 20 | +import com.azure.core.util.FluxUtil; |
| 21 | +import com.azure.core.util.serializer.TypeReference; |
| 22 | +import java.util.List; |
| 23 | +import reactor.core.publisher.Mono; |
| 24 | + |
| 25 | +/** |
| 26 | + * Initializes a new instance of the asynchronous ModelClient type. |
| 27 | + */ |
| 28 | +@ServiceClient(builder = ModelClientBuilder.class, isAsync = true) |
| 29 | +public final class ModelAsyncClient { |
| 30 | + @Generated |
| 31 | + private final AzureCoreEmbeddingVectorsImpl serviceClient; |
| 32 | + |
| 33 | + /** |
| 34 | + * Initializes an instance of ModelAsyncClient class. |
| 35 | + * |
| 36 | + * @param serviceClient the service client implementation. |
| 37 | + */ |
| 38 | + @Generated |
| 39 | + ModelAsyncClient(AzureCoreEmbeddingVectorsImpl serviceClient) { |
| 40 | + this.serviceClient = serviceClient; |
| 41 | + } |
| 42 | + |
| 43 | + /** |
| 44 | + * get an embedding vector. |
| 45 | + * <p><strong>Response Body Schema</strong></p> |
| 46 | + * |
| 47 | + * <pre>{@code |
| 48 | + * [ |
| 49 | + * int (Required) |
| 50 | + * ] |
| 51 | + * }</pre> |
| 52 | + * |
| 53 | + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. |
| 54 | + * @throws HttpResponseException thrown if the request is rejected by server. |
| 55 | + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. |
| 56 | + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. |
| 57 | + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. |
| 58 | + * @return an embedding vector along with {@link Response} on successful completion of {@link Mono}. |
| 59 | + */ |
| 60 | + @Generated |
| 61 | + @ServiceMethod(returns = ReturnType.SINGLE) |
| 62 | + public Mono<Response<BinaryData>> getWithResponse(RequestOptions requestOptions) { |
| 63 | + return this.serviceClient.getWithResponseAsync(requestOptions); |
| 64 | + } |
| 65 | + |
| 66 | + /** |
| 67 | + * put an embedding vector. |
| 68 | + * <p><strong>Request Body Schema</strong></p> |
| 69 | + * |
| 70 | + * <pre>{@code |
| 71 | + * [ |
| 72 | + * int (Required) |
| 73 | + * ] |
| 74 | + * }</pre> |
| 75 | + * |
| 76 | + * @param body _. |
| 77 | + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. |
| 78 | + * @throws HttpResponseException thrown if the request is rejected by server. |
| 79 | + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. |
| 80 | + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. |
| 81 | + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. |
| 82 | + * @return the {@link Response} on successful completion of {@link Mono}. |
| 83 | + */ |
| 84 | + @Generated |
| 85 | + @ServiceMethod(returns = ReturnType.SINGLE) |
| 86 | + public Mono<Response<Void>> putWithResponse(BinaryData body, RequestOptions requestOptions) { |
| 87 | + return this.serviceClient.putWithResponseAsync(body, requestOptions); |
| 88 | + } |
| 89 | + |
| 90 | + /** |
| 91 | + * post a model which has an embeddingVector property. |
| 92 | + * <p><strong>Request Body Schema</strong></p> |
| 93 | + * |
| 94 | + * <pre>{@code |
| 95 | + * { |
| 96 | + * embedding (Required): [ |
| 97 | + * int (Required) |
| 98 | + * ] |
| 99 | + * } |
| 100 | + * }</pre> |
| 101 | + * |
| 102 | + * <p><strong>Response Body Schema</strong></p> |
| 103 | + * |
| 104 | + * <pre>{@code |
| 105 | + * { |
| 106 | + * embedding (Required): [ |
| 107 | + * int (Required) |
| 108 | + * ] |
| 109 | + * } |
| 110 | + * }</pre> |
| 111 | + * |
| 112 | + * @param body _. |
| 113 | + * @param requestOptions The options to configure the HTTP request before HTTP client sends it. |
| 114 | + * @throws HttpResponseException thrown if the request is rejected by server. |
| 115 | + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. |
| 116 | + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. |
| 117 | + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. |
| 118 | + * @return the response body along with {@link Response} on successful completion of {@link Mono}. |
| 119 | + */ |
| 120 | + @Generated |
| 121 | + @ServiceMethod(returns = ReturnType.SINGLE) |
| 122 | + public Mono<Response<BinaryData>> postWithResponse(BinaryData body, RequestOptions requestOptions) { |
| 123 | + return this.serviceClient.postWithResponseAsync(body, requestOptions); |
| 124 | + } |
| 125 | + |
| 126 | + /** |
| 127 | + * get an embedding vector. |
| 128 | + * |
| 129 | + * @throws HttpResponseException thrown if the request is rejected by server. |
| 130 | + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. |
| 131 | + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. |
| 132 | + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. |
| 133 | + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. |
| 134 | + * @return an embedding vector on successful completion of {@link Mono}. |
| 135 | + */ |
| 136 | + @Generated |
| 137 | + @ServiceMethod(returns = ReturnType.SINGLE) |
| 138 | + public Mono<List<Integer>> get() { |
| 139 | + // Generated convenience method for getWithResponse |
| 140 | + RequestOptions requestOptions = new RequestOptions(); |
| 141 | + return getWithResponse(requestOptions).flatMap(FluxUtil::toMono) |
| 142 | + .map(protocolMethodData -> protocolMethodData.toObject(TYPE_REFERENCE_LIST_INTEGER)); |
| 143 | + } |
| 144 | + |
| 145 | + /** |
| 146 | + * put an embedding vector. |
| 147 | + * |
| 148 | + * @param body _. |
| 149 | + * @throws IllegalArgumentException thrown if parameters fail the validation. |
| 150 | + * @throws HttpResponseException thrown if the request is rejected by server. |
| 151 | + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. |
| 152 | + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. |
| 153 | + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. |
| 154 | + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. |
| 155 | + * @return A {@link Mono} that completes when a successful response is received. |
| 156 | + */ |
| 157 | + @Generated |
| 158 | + @ServiceMethod(returns = ReturnType.SINGLE) |
| 159 | + public Mono<Void> put(List<Integer> body) { |
| 160 | + // Generated convenience method for putWithResponse |
| 161 | + RequestOptions requestOptions = new RequestOptions(); |
| 162 | + return putWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono); |
| 163 | + } |
| 164 | + |
| 165 | + /** |
| 166 | + * post a model which has an embeddingVector property. |
| 167 | + * |
| 168 | + * @param body _. |
| 169 | + * @throws IllegalArgumentException thrown if parameters fail the validation. |
| 170 | + * @throws HttpResponseException thrown if the request is rejected by server. |
| 171 | + * @throws ClientAuthenticationException thrown if the request is rejected by server on status code 401. |
| 172 | + * @throws ResourceNotFoundException thrown if the request is rejected by server on status code 404. |
| 173 | + * @throws ResourceModifiedException thrown if the request is rejected by server on status code 409. |
| 174 | + * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent. |
| 175 | + * @return the response body on successful completion of {@link Mono}. |
| 176 | + */ |
| 177 | + @Generated |
| 178 | + @ServiceMethod(returns = ReturnType.SINGLE) |
| 179 | + public Mono<AzureEmbeddingModel> post(AzureEmbeddingModel body) { |
| 180 | + // Generated convenience method for postWithResponse |
| 181 | + RequestOptions requestOptions = new RequestOptions(); |
| 182 | + return postWithResponse(BinaryData.fromObject(body), requestOptions).flatMap(FluxUtil::toMono) |
| 183 | + .map(protocolMethodData -> protocolMethodData.toObject(AzureEmbeddingModel.class)); |
| 184 | + } |
| 185 | + |
| 186 | + @Generated |
| 187 | + private static final TypeReference<List<Integer>> TYPE_REFERENCE_LIST_INTEGER = new TypeReference<List<Integer>>() { |
| 188 | + }; |
| 189 | +} |
0 commit comments