Skip to content

Commit

Permalink
chore: use keyword arguments in raw_predict implementation
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 506090900
  • Loading branch information
vertex-sdk-bot authored and copybara-github committed Jan 31, 2023
1 parent d83bc79 commit 7ab6e0b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion google/cloud/aiplatform/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,9 @@ def raw_predict(
)
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"

return self.authorized_session.post(self.raw_predict_request_url, body, headers)
return self.authorized_session.post(
url=self.raw_predict_request_url, data=body, headers=headers
)

def explain(
self,
Expand Down
8 changes: 7 additions & 1 deletion tests/unit/aiplatform/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@

from google.protobuf import field_mask_pb2, timestamp_pb2

from test_endpoints import ( # noqa: F401
create_endpoint_mock,
)

_TEST_PROJECT = "test-project"
_TEST_PROJECT_2 = "test-project-2"
_TEST_LOCATION = "us-central1"
Expand Down Expand Up @@ -2782,5 +2786,7 @@ def test_raw_predict(self, raw_predict_mock):
test_endpoint = models.Endpoint(_TEST_ID)
test_endpoint.raw_predict(_TEST_RAW_PREDICT_DATA, _TEST_RAW_PREDICT_HEADER)
raw_predict_mock.assert_called_once_with(
_TEST_RAW_PREDICT_URL, _TEST_RAW_PREDICT_DATA, _TEST_RAW_PREDICT_HEADER
url=_TEST_RAW_PREDICT_URL,
data=_TEST_RAW_PREDICT_DATA,
headers=_TEST_RAW_PREDICT_HEADER,
)

0 comments on commit 7ab6e0b

Please sign in to comment.