0

Problem with dialogue action hook I am calling a dataframe from cloud function action. I get dailogue node error on first time but I can see the result in context variable.

I have tried passing the variable in different ways

JSON response

  {
  "output": {
    "generic": [
      {
        "values": [
          {
            "text": "$result.message"
          }
        ],
        "response_type": "text",
        "selection_policy": "sequential"
      }
    ]
  },
  "actions": [
    {
      "name": "xxxxxx[In context variable result is received[![\]\[1\]][1]][1]l.com_dev/dep/sample",
      "type": "server",
      "credentials": "$private.cf_creds",
      "result_variable": "$result"
    }
  ]
}

'''python

import pandas as pd
import json

def main(dict):
    file_name = "https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data"
    df = pd.read_csv(file_name)
    df.head()
    print(df.head())
    result = { 'message': df.head(5).to_json() }
    return result
'''

I expect result.message output but I get output as per the screenshots

Quantum Dreamer
  • 432
  • 1
  • 6
  • 17

1 Answers1

0

It not clear from your description above if you are calling out from Watson Assistant to an IBM cloud function or to the new Beta action to a web hook.
For a action call out to a cloud function the expected dialog action json should be;
{ "context": { "variable_name" : "variable_value" }, "actions": [ { "name":"<actionName>", "type":"client | cloud_function | server | web_action", "parameters": { "<parameter_name>":"<parameter_value>", "<parameter_name>":"<parameter_value>" }, "result_variable": "<result_variable_name>", "credentials": "<reference_to_credentials>" } ], "output": { "text": "response text" } }

Your example seems to be missing the parameters payload. Also, your json name value, the cloud function being called seems strange.

I would have expected something along the lines of;

https://eu-gb.functions.cloud.ibm.com/api/v1/namespaces/My_Dev/actions/hello-world/helloworld

timd
  • 376
  • 1
  • 8