Examination of an AutoML node
kolban-google opened this issue · 4 comments
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\"
}
}
}",
})
2020-05-30
The API looks pretty straightforward. See:
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:
- name - Name of the model
- payload
- params
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:
- msg.payload.payload
- msg.payload.params
If this ever should be relevant, if you want to use a custom trained model from me for testing, just let me know! :)
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.
Solution shipped and accepted by consumer.