Search code examples
google-cloud-automl

API call for deploying and undeploying Google AutoML natural language model - documentation error?


We have a google automl natural language model and while testing, have been deploying and undeploying the model by hand on the console.

We also have a google automl image classification model in a production application and we deploy and undeploy that from our application using the API.

I am now viewing the documentation for the automl natural language model and I want to be able to deploy the model from our application as-needed and undeploy it when finished. Obviously being deployed incurs charges so we minimise these by only having the deployed capability active when needed.

The documentation page for this functionality is here https://cloud.google.com/natural-language/automl/docs/manage-models#deploy-models This is next to the section in the documentation that describes deleting models here https://cloud.google.com/natural-language/automl/docs/manage-models#delete-model

In the deploy and undeploy model, it shows the API call you make for undeploy (:undeploy) but it does not specifically show the one you make for deploy (which I would assume is :deploy but this is not noted in the documentaion)

IN the delete model section, the API endpoint shown is the undeploy endpoint. The documentation specifically says that if you use the undeploy command, it deletes the model. I believe this to be a documentation error but I don't want to try it as I don't want to delete our model by mistake.

It also doesn't specifically say this but in my image model, it returns me a long running operation and I can poll for the status of that. Is that how it works on the natural language models too?

Thanks for the clarification

Richard


Solution

  • Deploying a model was not properly documented for the REST usage. See deploy endpoint for reference.

    curl -X POST \
    -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
    https://automl.googleapis.com/v1/projects/your-project-id/locations/location-id/models/your-model-id:deploy
    

    You are correct, this might be a documentation error. Another error is when using :undeploy it should be POST not GET.

    curl -X POST \
    -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
    https://automl.googleapis.com/v1/projects/your-project-id/locations/location-id/models/your-model-id:undeploy
    

    For :delete it should be DELETE not GET.

    curl -X DELETE \
    -H "Authorization: Bearer "$(gcloud auth application-default print-access-token) \
    https://automl.googleapis.com/v1/projects/your-project-id/locations/location-id/models/your-model-id
    

    Yes you can poll for the status that was given. See Working with long-running operations for AutoML Natural Language for more details.

    I also sent a feedback on the documentation about the mistakes you pointed out.