GoogleCloudPlatform / node-red-contrib-google-cloud

Node-RED nodes for Google Cloud Platform
Apache License 2.0
90 stars 57 forks source link

Examination of an AutoML node #73

Closed kolban-google closed 4 years ago

kolban-google commented 4 years ago

A user wishes to use AutoML capabilities and has given us a sample of a GCP REST API they would like to use. We are now examining what a generic node would look like.

Here is some code they are using today:

jQuery.ajax({
    url: "https://eu-automl.googleapis.com/v1/projects/1234/locations/eu/models/1234:predict",
    type: "POST",
    headers: {
        "Content-Type": "text/plain; charset=utf-8",
    },
    processData: false,
    data: "{
  \"payload\": {
    \"textSnippet\": {
      \"content\": \"some text\",
      \"mime_type\": \"text/plain\"
    }
  }
}",
})
kolban-google commented 4 years ago

2020-05-30

The API looks pretty straightforward. See:

https://cloud.google.com/natural-language/automl/docs/libraries/client-libraries#client-libraries-nodejs

From this, it looks like we can wrap into a simple call as found here:

https://googleapis.dev/nodejs/automl/latest/index.html

by calling the predict API.

https://googleapis.dev/nodejs/automl/latest/v1beta1.PredictionServiceClient.html#predict.

While this looks easy to code up, the first thing I need to find is a sample that I can test against to ensure that it is working. It is tempting to code it up and then release it but without testing, that would be a poor story.

...

This sample looks suitable:

https://cloud.google.com/natural-language/automl/docs/quickstart

...

2020-05-31

I now have a sample trained model and am now getting ready to test out calling APIs. In order to make a predict call, we need to supply:

The name of the modelId is supplied in the configuration parameters. I am going to assume that the Node-RED developer will supply the payload and params. I am thinking that these will be supplied at:

d0hnj0e commented 4 years ago

If this ever should be relevant, if you want to use a custom trained model from me for testing, just let me know! :)

kolban-google commented 4 years ago

A release (0.0.18) has been pushed that includes the AutoML function. Looking to the requestor to see how close we are to what is needed.

kolban-google commented 4 years ago

Solution shipped and accepted by consumer.