Norman Dy
Norman Dy

Reputation: 11

Vertex Ai AutoML Endpoint Error: "TypeError: predict_tabular_classification_sample() got an unexpected keyword argument 'instances'"

Sample Request Code provided

Sample Request Code in Colab

Error at the bottom

Upvotes: 1

Views: 146

Answers (1)

Winson Luk
Winson Luk

Reputation: 1

The instructions in the Vertex AI "Sample Request" popup guide are wrong. Here's what the guide suggested, and what you're doing:

predict_tabular_classification_sample(
    project="930429533881",
    endpoint_id="6309734392969297920",
    location="us-central1",
    instances=[{ "feature_column_a": "value", "feature_column_b": "value" ...}, {...}]
)

But here's the function as defined in https://github.com/googleapis/python-aiplatform/blob/main/samples/snippets/prediction_service/predict_tabular_classification_sample.py

def predict_tabular_classification_sample(
    project: str,
    endpoint_id: str,
    instance_dict: Dict,
    location: str = "us-central1",
    api_endpoint: str = "us-central1-aiplatform.googleapis.com", ):

Spot the problem? The argument should be instance_dict, not instances.

Upvotes: 0

Related Questions