Search in sources :

Example 11 with RequestBuilder

use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.

the class SpeechToText method resetAcousticModel.

/**
 * Resets a custom acoustic model.
 *
 * Resets a custom acoustic model by removing all audio resources from the model. Resetting a custom acoustic model
 * initializes the model to its state when it was first created. Metadata such as the name and language of the model
 * are preserved, but the model's audio resources are removed and must be re-created. You must use credentials for the
 * instance of the service that owns a model to reset it.
 *
 * @param resetAcousticModelOptions the {@link ResetAcousticModelOptions} containing the options for the call
 * @return a {@link ServiceCall} with a response type of Void
 */
public ServiceCall<Void> resetAcousticModel(ResetAcousticModelOptions resetAcousticModelOptions) {
    Validator.notNull(resetAcousticModelOptions, "resetAcousticModelOptions cannot be null");
    String[] pathSegments = { "v1/acoustic_customizations", "reset" };
    String[] pathParameters = { resetAcousticModelOptions.customizationId() };
    RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
    return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
Also used : RequestBuilder(com.ibm.watson.developer_cloud.http.RequestBuilder)

Example 12 with RequestBuilder

use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.

the class SpeechToText method getLanguageModel.

/**
 * Lists information about a custom language model.
 *
 * Lists information about a specified custom language model. You must use credentials for the instance of the service
 * that owns a model to list information about it.
 *
 * @param getLanguageModelOptions the {@link GetLanguageModelOptions} containing the options for the call
 * @return a {@link ServiceCall} with a response type of {@link LanguageModel}
 */
public ServiceCall<LanguageModel> getLanguageModel(GetLanguageModelOptions getLanguageModelOptions) {
    Validator.notNull(getLanguageModelOptions, "getLanguageModelOptions cannot be null");
    String[] pathSegments = { "v1/customizations" };
    String[] pathParameters = { getLanguageModelOptions.customizationId() };
    RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
    return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LanguageModel.class));
}
Also used : RequestBuilder(com.ibm.watson.developer_cloud.http.RequestBuilder) LanguageModel(com.ibm.watson.developer_cloud.speech_to_text.v1.model.LanguageModel)

Example 13 with RequestBuilder

use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.

the class SpeechToText method createLanguageModel.

/**
 * Creates a custom language model.
 *
 * Creates a new custom language model for a specified base model. The custom language model can be used only with the
 * base model for which it is created. The model is owned by the instance of the service whose credentials are used to
 * create it.
 *
 * @param createLanguageModelOptions the {@link CreateLanguageModelOptions} containing the options for the call
 * @return a {@link ServiceCall} with a response type of {@link LanguageModel}
 */
public ServiceCall<LanguageModel> createLanguageModel(CreateLanguageModelOptions createLanguageModelOptions) {
    Validator.notNull(createLanguageModelOptions, "createLanguageModelOptions cannot be null");
    String[] pathSegments = { "v1/customizations" };
    RequestBuilder builder = RequestBuilder.post(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments));
    final JsonObject contentJson = new JsonObject();
    contentJson.addProperty("name", createLanguageModelOptions.name());
    contentJson.addProperty("base_model_name", createLanguageModelOptions.baseModelName());
    if (createLanguageModelOptions.dialect() != null) {
        contentJson.addProperty("dialect", createLanguageModelOptions.dialect());
    }
    if (createLanguageModelOptions.description() != null) {
        contentJson.addProperty("description", createLanguageModelOptions.description());
    }
    builder.bodyJson(contentJson);
    return createServiceCall(builder.build(), ResponseConverterUtils.getObject(LanguageModel.class));
}
Also used : RequestBuilder(com.ibm.watson.developer_cloud.http.RequestBuilder) JsonObject(com.google.gson.JsonObject) LanguageModel(com.ibm.watson.developer_cloud.speech_to_text.v1.model.LanguageModel)

Example 14 with RequestBuilder

use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.

the class SpeechToText method getAudio.

/**
 * Lists information about an audio resource for a custom acoustic model.
 *
 * Lists information about an audio resource from a custom acoustic model. The method returns an `AudioListing` object
 * whose fields depend on the type of audio resource you specify with the method's `audio_name` parameter: * **For an
 * audio-type resource,** the object's fields match those of an `AudioResource` object: `duration`, `name`, `details`,
 * and `status`. * **For an archive-type resource,** the object includes a `container` field whose fields match those
 * of an `AudioResource` object. It also includes an `audio` field, which contains an array of `AudioResource` objects
 * that provides information about the audio files that are contained in the archive. The information includes the
 * status of the specified audio resource, which is important for checking the service's analysis of the resource in
 * response to a request to add it to the custom model. You must use credentials for the instance of the service that
 * owns a model to list its audio resources.
 *
 * @param getAudioOptions the {@link GetAudioOptions} containing the options for the call
 * @return a {@link ServiceCall} with a response type of {@link AudioListing}
 */
public ServiceCall<AudioListing> getAudio(GetAudioOptions getAudioOptions) {
    Validator.notNull(getAudioOptions, "getAudioOptions cannot be null");
    String[] pathSegments = { "v1/acoustic_customizations", "audio" };
    String[] pathParameters = { getAudioOptions.customizationId(), getAudioOptions.audioName() };
    RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
    return createServiceCall(builder.build(), ResponseConverterUtils.getObject(AudioListing.class));
}
Also used : RequestBuilder(com.ibm.watson.developer_cloud.http.RequestBuilder) AudioListing(com.ibm.watson.developer_cloud.speech_to_text.v1.model.AudioListing)

Example 15 with RequestBuilder

use of com.ibm.watson.developer_cloud.http.RequestBuilder in project java-sdk by watson-developer-cloud.

the class SpeechToText method deleteLanguageModel.

/**
 * Deletes a custom language model.
 *
 * Deletes an existing custom language model. The custom model cannot be deleted if another request, such as adding a
 * corpus to the model, is currently being processed. You must use credentials for the instance of the service that
 * owns a model to delete it.
 *
 * @param deleteLanguageModelOptions the {@link DeleteLanguageModelOptions} containing the options for the call
 * @return a {@link ServiceCall} with a response type of Void
 */
public ServiceCall<Void> deleteLanguageModel(DeleteLanguageModelOptions deleteLanguageModelOptions) {
    Validator.notNull(deleteLanguageModelOptions, "deleteLanguageModelOptions cannot be null");
    String[] pathSegments = { "v1/customizations" };
    String[] pathParameters = { deleteLanguageModelOptions.customizationId() };
    RequestBuilder builder = RequestBuilder.delete(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments, pathParameters));
    return createServiceCall(builder.build(), ResponseConverterUtils.getVoid());
}
Also used : RequestBuilder(com.ibm.watson.developer_cloud.http.RequestBuilder)

Aggregations

RequestBuilder (com.ibm.watson.developer_cloud.http.RequestBuilder)206 JsonObject (com.google.gson.JsonObject)60 MultipartBody (okhttp3.MultipartBody)10 RequestBody (okhttp3.RequestBody)10 Counterexample (com.ibm.watson.developer_cloud.assistant.v1.model.Counterexample)3 DialogNode (com.ibm.watson.developer_cloud.assistant.v1.model.DialogNode)3 Example (com.ibm.watson.developer_cloud.assistant.v1.model.Example)3 Synonym (com.ibm.watson.developer_cloud.assistant.v1.model.Synonym)3 Counterexample (com.ibm.watson.developer_cloud.conversation.v1.model.Counterexample)3 DialogNode (com.ibm.watson.developer_cloud.conversation.v1.model.DialogNode)3 Example (com.ibm.watson.developer_cloud.conversation.v1.model.Example)3 Synonym (com.ibm.watson.developer_cloud.conversation.v1.model.Synonym)3 Collection (com.ibm.watson.developer_cloud.discovery.v1.model.Collection)3 Configuration (com.ibm.watson.developer_cloud.discovery.v1.model.Configuration)3 Environment (com.ibm.watson.developer_cloud.discovery.v1.model.Environment)3 Entity (com.ibm.watson.developer_cloud.assistant.v1.model.Entity)2 Intent (com.ibm.watson.developer_cloud.assistant.v1.model.Intent)2 LogCollection (com.ibm.watson.developer_cloud.assistant.v1.model.LogCollection)2 Value (com.ibm.watson.developer_cloud.assistant.v1.model.Value)2 Workspace (com.ibm.watson.developer_cloud.assistant.v1.model.Workspace)2