Skip to content

fix: Fix PrivateEndpoint.raw_predict parameter name#6107

Closed
yashwantbezawada wants to merge 4 commits intogoogleapis:mainfrom
yashwantbezawada:fix/private-endpoint-raw-predict-parameter
Closed

fix: Fix PrivateEndpoint.raw_predict parameter name#6107
yashwantbezawada wants to merge 4 commits intogoogleapis:mainfrom
yashwantbezawada:fix/private-endpoint-raw-predict-parameter

Conversation

@yashwantbezawada
Copy link
Copy Markdown
Contributor

Fixes #6101

Description

Fixed TypeError in PrivateEndpoint.raw_predict() caused by incorrect parameter name when calling AuthorizedSession.post().

Problem

When calling PrivateEndpoint.raw_predict() with PSC (Private Service Connect) based endpoints, the method crashed with:

TypeError: Session.request() got an unexpected keyword argument 'body'

Root Cause

The google-auth-transport library updated its API, changing the parameter name from body to data for AuthorizedSession.post().

The Endpoint.raw_predict() method was updated to use data, but PrivateEndpoint.raw_predict() was missed and still used body.

Changes

File: google/cloud/aiplatform/models.py
Line: 4153

Changed:

return self._authorized_session.post(
    url=url,
    body=body,  # ← incorrect parameter name
    headers=headers,
)

To:

return self._authorized_session.post(
    url=url,
    data=body,  # ← correct parameter name
    headers=headers,
)

Testing

This fix aligns PrivateEndpoint.raw_predict() with the already-corrected Endpoint.raw_predict() implementation (line 2744), which uses data=body.

The issue reporter confirmed the fix resolves the crash when calling raw_predict() on PSC-based PrivateEndpoint instances.

@product-auto-label product-auto-label Bot added size: xs Pull request size is extra small. api: vertex-ai Issues related to the googleapis/python-aiplatform API. labels Nov 10, 2025
Fixes googleapis#6101

Changed parameter name from 'body' to 'data' in PrivateEndpoint.raw_predict
to match google-auth-transport's AuthorizedSession.post() API signature.

The google-auth-transport library updated its API, changing the parameter
name from 'body' to 'data'. The Endpoint class was already updated to use
'data', but PrivateEndpoint class was missed, causing TypeError when calling
raw_predict() on PrivateEndpoint instances.

This fix aligns PrivateEndpoint.raw_predict() with Endpoint.raw_predict()
implementation.

Signed-off-by: Yashwant Bezawada <yashwant_b@me.com>
@yashwantbezawada yashwantbezawada force-pushed the fix/private-endpoint-raw-predict-parameter branch from b689573 to 2681770 Compare November 10, 2025 08:20
@matthew29tang matthew29tang requested a review from a team as a code owner April 21, 2026 21:58
@matthew29tang matthew29tang changed the title Fix PrivateEndpoint.raw_predict parameter name fix: Fix PrivateEndpoint.raw_predict parameter name Apr 21, 2026
@matthew29tang matthew29tang added kokoro:force-run Add this label to force Kokoro to re-run the tests. labels Apr 21, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 21, 2026
@matthew29tang matthew29tang self-assigned this Apr 21, 2026
@matthew29tang matthew29tang added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 22, 2026
@yoshi-kokoro yoshi-kokoro removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Apr 22, 2026
@matthew29tang matthew29tang added the ready to pull Ready to be merged into the codebase. label Apr 23, 2026
copybara-service Bot pushed a commit that referenced this pull request Apr 23, 2026
--
2681770 by Yashwant Bezawada <yashwant_b@me.com>:

fix: PrivateEndpoint.raw_predict parameter name

Fixes #6101

Changed parameter name from 'body' to 'data' in PrivateEndpoint.raw_predict
to match google-auth-transport's AuthorizedSession.post() API signature.

The google-auth-transport library updated its API, changing the parameter
name from 'body' to 'data'. The Endpoint class was already updated to use
'data', but PrivateEndpoint class was missed, causing TypeError when calling
raw_predict() on PrivateEndpoint instances.

This fix aligns PrivateEndpoint.raw_predict() with Endpoint.raw_predict()
implementation.

Signed-off-by: Yashwant Bezawada <yashwant_b@me.com>
COPYBARA_INTEGRATE_REVIEW=#6107 from yashwantbezawada:fix/private-endpoint-raw-predict-parameter e550151
PiperOrigin-RevId: 904180559
@matthew29tang
Copy link
Copy Markdown
Contributor

Merged as 3d380ba

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: vertex-ai Issues related to the googleapis/python-aiplatform API. ready to pull Ready to be merged into the codebase. size: xs Pull request size is extra small.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

aiplatform.PrivateEndpoint.raw_predict crash (TypeError: Session.request() got an unexpected keyword argument 'body')

3 participants