Try calling IBM Watson Assistant 2018-07-10 from the Java SDK.

In Watson Assistant 2018-07-10, you can specify "Option" etc. as the response type. "Option" is like a radio button in HTML, and it is a function that allows you to easily create choices such as three choices and four choices.

What if I call it from the Watson API Java SDK? I tried. In conclusion, it seems that the SDK at the time of writing is not yet compatible with new features. Previously it was returned as text [], but it seems to be returned as generic. It looks like we need to parse the raw JSON.

■ Image


■ Reference (At the time of writing, it cannot be read unless "English" is set from the bottom of the page)

■API Document

■ Code

		String version = "2018-07-10";
		String username = "xxx";
		String password = "xxx";

		String workspaceId = "xxx";

		Assistant service = new Assistant(version);
		service.setUsernameAndPassword(username, password);

		InputData input = new InputData.Builder("Hi").build();

		// MessageOptions options = new
		// MessageOptions.Builder(workspaceId).input(input).build();
		MessageOptions options = new MessageOptions.Builder(workspaceId).build();

		// sync
		MessageResponse response = service.message(options).execute();



■ Results

  "output": {
    "generic": [
        "title": "",
        "options": [
            "label": "Value1",
            "value": {
              "input": {
                "text": "value1"
            "label": "Value2",
            "value": {
              "input": {
                "text": "value2"
            "label": "Value3",
            "value": {
              "input": {
                "text": "value3"
        "response_type": "option"
    "text": [],
    "nodes_visited": [
    "log_messages": []
  "input": {},
  "intents": [],
  "entities": [],
  "context": {
    "conversation_id": "xxx",
    "system": {
      "dialog_stack": [
          "dialog_node": "root"
      "dialog_turn_counter": 1.0,
      "dialog_request_counter": 1.0,
      "branch_exited": true,
      "branch_exited_reason": "completed"

Recommended Posts

Try calling IBM Watson Assistant 2018-07-10 from the Java SDK.
Try calling Watson NLU that seems to support Japanese from the Java SDK
Try calling the CORBA service in Java 11+
Try calling Nim from Java via JNI
Try accessing the dataset from Java using JZOS
Try calling synchronized methods from multiple threads in Java
Try calling JavaScript in Java
Try using IBM Java method tracing
The road from JavaScript to Java
Try using Hyperledger Iroha's Java SDK
Try using the Stream API in Java
Calling java from C ++ on Android NDK
Kick ShellScript on the server from Java
Try running a Kubernetes Job from Java
Call Visual Recognition in Watson Java SDK
Try using the Emotion API from Android
Try using the Wii remote with Java
Try to access the on-premise system from SAP Cloud Platform --Java App Edition
Upsert from Java SDK to Azure Cosmos DB
[Java] Set the time from the browser with jsoup
Try similar search of Image Search using Java SDK [Search]
Try the free version of Progate [Java II]
Try using the COTOHA API parsing in Java
[Java] Try to solve the Fizz Buzz problem
Select * from Java SDK to Azure Cosmos DB
Try the free version of Progate [Java I]