Skip to content

Commit 7ab6e0b

Browse files
vertex-sdk-botcopybara-github
authored andcommitted
chore: use keyword arguments in raw_predict implementation
PiperOrigin-RevId: 506090900
1 parent d83bc79 commit 7ab6e0b

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

google/cloud/aiplatform/models.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -1577,7 +1577,9 @@ def raw_predict(
15771577
)
15781578
self.raw_predict_request_url = f"https://{self.location}-{constants.base.API_BASE_PATH}/v1/projects/{self.project}/locations/{self.location}/endpoints/{self.name}:rawPredict"
15791579

1580-
return self.authorized_session.post(self.raw_predict_request_url, body, headers)
1580+
return self.authorized_session.post(
1581+
url=self.raw_predict_request_url, data=body, headers=headers
1582+
)
15811583

15821584
def explain(
15831585
self,

tests/unit/aiplatform/test_models.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@
6161

6262
from google.protobuf import field_mask_pb2, timestamp_pb2
6363

64+
from test_endpoints import ( # noqa: F401
65+
create_endpoint_mock,
66+
)
67+
6468
_TEST_PROJECT = "test-project"
6569
_TEST_PROJECT_2 = "test-project-2"
6670
_TEST_LOCATION = "us-central1"
@@ -2782,5 +2786,7 @@ def test_raw_predict(self, raw_predict_mock):
27822786
test_endpoint = models.Endpoint(_TEST_ID)
27832787
test_endpoint.raw_predict(_TEST_RAW_PREDICT_DATA, _TEST_RAW_PREDICT_HEADER)
27842788
raw_predict_mock.assert_called_once_with(
2785-
_TEST_RAW_PREDICT_URL, _TEST_RAW_PREDICT_DATA, _TEST_RAW_PREDICT_HEADER
2789+
url=_TEST_RAW_PREDICT_URL,
2790+
data=_TEST_RAW_PREDICT_DATA,
2791+
headers=_TEST_RAW_PREDICT_HEADER,
27862792
)

0 commit comments

Comments
 (0)