Search in sources :

Example 6 with Builder

use of com.ibm.watson.assistant.v2.model.ListLogsOptions.Builder in project java-sdk by watson-developer-cloud.

the class Assistant method bulkClassify.

/**
 * Identify intents and entities in multiple user utterances.
 *
 * <p>Send multiple user inputs to a dialog skill in a single request and receive information
 * about the intents and entities recognized in each input. This method is useful for testing and
 * comparing the performance of different skills or skill versions.
 *
 * <p>This method is available only with Enterprise with Data Isolation plans.
 *
 * @param bulkClassifyOptions the {@link BulkClassifyOptions} containing the options for the call
 * @return a {@link ServiceCall} with a result of type {@link BulkClassifyResponse}
 */
public ServiceCall<BulkClassifyResponse> bulkClassify(BulkClassifyOptions bulkClassifyOptions) {
    com.ibm.cloud.sdk.core.util.Validator.notNull(bulkClassifyOptions, "bulkClassifyOptions cannot be null");
    Map<String, String> pathParamsMap = new HashMap<String, String>();
    pathParamsMap.put("skill_id", bulkClassifyOptions.skillId());
    RequestBuilder builder = RequestBuilder.post(RequestBuilder.resolveRequestUrl(getServiceUrl(), "/v2/skills/{skill_id}/workspace/bulk_classify", pathParamsMap));
    Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("conversation", "v2", "bulkClassify");
    for (Entry<String, String> header : sdkHeaders.entrySet()) {
        builder.header(header.getKey(), header.getValue());
    }
    builder.header("Accept", "application/json");
    builder.query("version", String.valueOf(this.version));
    final JsonObject contentJson = new JsonObject();
    if (bulkClassifyOptions.input() != null) {
        contentJson.add("input", com.ibm.cloud.sdk.core.util.GsonSingleton.getGson().toJsonTree(bulkClassifyOptions.input()));
    }
    builder.bodyJson(contentJson);
    ResponseConverter<BulkClassifyResponse> responseConverter = ResponseConverterUtils.getValue(new com.google.gson.reflect.TypeToken<BulkClassifyResponse>() {
    }.getType());
    return createServiceCall(builder.build(), responseConverter);
}
Also used : RequestBuilder(com.ibm.cloud.sdk.core.http.RequestBuilder) HashMap(java.util.HashMap) JsonObject(com.google.gson.JsonObject) BulkClassifyResponse(com.ibm.watson.assistant.v2.model.BulkClassifyResponse)

Aggregations

RequestBuilder (com.ibm.cloud.sdk.core.http.RequestBuilder)5 HashMap (java.util.HashMap)5 JsonObject (com.google.gson.JsonObject)3 BulkClassifyResponse (com.ibm.watson.assistant.v2.model.BulkClassifyResponse)1 Builder (com.ibm.watson.assistant.v2.model.ListLogsOptions.Builder)1 LogCollection (com.ibm.watson.assistant.v2.model.LogCollection)1 MessageResponse (com.ibm.watson.assistant.v2.model.MessageResponse)1 MessageResponseStateless (com.ibm.watson.assistant.v2.model.MessageResponseStateless)1 SessionResponse (com.ibm.watson.assistant.v2.model.SessionResponse)1