|
1 | 1 | /*
|
2 |
| - * (C) Copyright IBM Corp. 2019, 2020. |
| 2 | + * (C) Copyright IBM Corp. 2020. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
|
5 | 5 | * the License. You may obtain a copy of the License at
|
@@ -259,6 +259,47 @@ public ServiceCall<MessageResponse> message(MessageOptions messageOptions) {
|
259 | 259 | return createServiceCall(builder.build(), responseConverter);
|
260 | 260 | }
|
261 | 261 |
|
| 262 | + /** |
| 263 | + * Identify intents and entities in multiple user utterances. |
| 264 | + * |
| 265 | + * <p>Send multiple user inputs to a workspace in a single request and receive information about |
| 266 | + * the intents and entities recognized in each input. This method is useful for testing and |
| 267 | + * comparing the performance of different workspaces. |
| 268 | + * |
| 269 | + * <p>This method is available only with Premium plans. |
| 270 | + * |
| 271 | + * @param bulkClassifyOptions the {@link BulkClassifyOptions} containing the options for the call |
| 272 | + * @return a {@link ServiceCall} with a result of type {@link BulkClassifyResponse} |
| 273 | + */ |
| 274 | + public ServiceCall<BulkClassifyResponse> bulkClassify(BulkClassifyOptions bulkClassifyOptions) { |
| 275 | + com.ibm.cloud.sdk.core.util.Validator.notNull( |
| 276 | + bulkClassifyOptions, "bulkClassifyOptions cannot be null"); |
| 277 | + Map<String, String> pathParamsMap = new HashMap<String, String>(); |
| 278 | + pathParamsMap.put("workspace_id", bulkClassifyOptions.workspaceId()); |
| 279 | + RequestBuilder builder = |
| 280 | + RequestBuilder.post( |
| 281 | + RequestBuilder.resolveRequestUrl( |
| 282 | + getServiceUrl(), "/v1/workspaces/{workspace_id}/bulk_classify", pathParamsMap)); |
| 283 | + Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "bulkClassify"); |
| 284 | + for (Entry<String, String> header : sdkHeaders.entrySet()) { |
| 285 | + builder.header(header.getKey(), header.getValue()); |
| 286 | + } |
| 287 | + builder.header("Accept", "application/json"); |
| 288 | + builder.query("version", String.valueOf(this.version)); |
| 289 | + final JsonObject contentJson = new JsonObject(); |
| 290 | + if (bulkClassifyOptions.input() != null) { |
| 291 | + contentJson.add( |
| 292 | + "input", |
| 293 | + com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() |
| 294 | + .toJsonTree(bulkClassifyOptions.input())); |
| 295 | + } |
| 296 | + builder.bodyJson(contentJson); |
| 297 | + ResponseConverter<BulkClassifyResponse> responseConverter = |
| 298 | + ResponseConverterUtils.getValue( |
| 299 | + new com.google.gson.reflect.TypeToken<BulkClassifyResponse>() {}.getType()); |
| 300 | + return createServiceCall(builder.build(), responseConverter); |
| 301 | + } |
| 302 | + |
262 | 303 | /**
|
263 | 304 | * List workspaces.
|
264 | 305 | *
|
@@ -2387,45 +2428,4 @@ public ServiceCall<Void> deleteUserData(DeleteUserDataOptions deleteUserDataOpti
|
2387 | 2428 | ResponseConverter<Void> responseConverter = ResponseConverterUtils.getVoid();
|
2388 | 2429 | return createServiceCall(builder.build(), responseConverter);
|
2389 | 2430 | }
|
2390 |
| - |
2391 |
| - /** |
2392 |
| - * Identify intents and entities in multiple user utterances. |
2393 |
| - * |
2394 |
| - * <p>Send multiple user inputs to a workspace in a single request and receive information about |
2395 |
| - * the intents and entities recognized in each input. This method is useful for testing and |
2396 |
| - * comparing the performance of different workspaces. |
2397 |
| - * |
2398 |
| - * <p>This method is available only with Premium plans. |
2399 |
| - * |
2400 |
| - * @param bulkClassifyOptions the {@link BulkClassifyOptions} containing the options for the call |
2401 |
| - * @return a {@link ServiceCall} with a result of type {@link BulkClassifyResponse} |
2402 |
| - */ |
2403 |
| - public ServiceCall<BulkClassifyResponse> bulkClassify(BulkClassifyOptions bulkClassifyOptions) { |
2404 |
| - com.ibm.cloud.sdk.core.util.Validator.notNull( |
2405 |
| - bulkClassifyOptions, "bulkClassifyOptions cannot be null"); |
2406 |
| - Map<String, String> pathParamsMap = new HashMap<String, String>(); |
2407 |
| - pathParamsMap.put("workspace_id", bulkClassifyOptions.workspaceId()); |
2408 |
| - RequestBuilder builder = |
2409 |
| - RequestBuilder.post( |
2410 |
| - RequestBuilder.resolveRequestUrl( |
2411 |
| - getServiceUrl(), "/v1/workspaces/{workspace_id}/bulk_classify", pathParamsMap)); |
2412 |
| - Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v1", "bulkClassify"); |
2413 |
| - for (Entry<String, String> header : sdkHeaders.entrySet()) { |
2414 |
| - builder.header(header.getKey(), header.getValue()); |
2415 |
| - } |
2416 |
| - builder.header("Accept", "application/json"); |
2417 |
| - builder.query("version", String.valueOf(this.version)); |
2418 |
| - final JsonObject contentJson = new JsonObject(); |
2419 |
| - if (bulkClassifyOptions.input() != null) { |
2420 |
| - contentJson.add( |
2421 |
| - "input", |
2422 |
| - com.ibm.cloud.sdk.core.util.GsonSingleton.getGson() |
2423 |
| - .toJsonTree(bulkClassifyOptions.input())); |
2424 |
| - } |
2425 |
| - builder.bodyJson(contentJson); |
2426 |
| - ResponseConverter<BulkClassifyResponse> responseConverter = |
2427 |
| - ResponseConverterUtils.getValue( |
2428 |
| - new com.google.gson.reflect.TypeToken<BulkClassifyResponse>() {}.getType()); |
2429 |
| - return createServiceCall(builder.build(), responseConverter); |
2430 |
| - } |
2431 | 2431 | }
|
0 commit comments