googleapis / googleapis/python-aiplatform

PrivateEndpoint.predict_async tries to access public endpoint

オープン
#3,307 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
api: vertex-ai
主要言語
Python
スター
905
フォーク
465
平均マージ
1日 13時間
マージ済み PR(30日)
44

説明

#### Environment details

- OS type and version: GCP VM
- Python version: 3.10.13
- pip version: 23.3.2
- `google-cloud-aiplatform` version: 1.40.0

#### Steps to reproduce
Create a `PrivateEndpoint` class and call `predict_async`

#### Code example

```python
endpoint = aiplatform.PrivateEndpoint(
endpoint_name=PRIVATE_ENDPOINT_ID,
project=PROJECT_ID,
location=REGION,
)
instance= {
"prompt": "Hi, Google."
}

instances = [instance]

prediction = endpoint.predict(instances=instances) # WORKS

prediction = await endpoint.predict_async(instances=instances) # DOESN'T WORK
```

#### Stack trace
```
---------------------------------------------------------------------------
AioRpcError Traceback (most recent call last)
File /opt/conda/lib/python3.10/site-packages/google/api_core/grpc_helpers_async.py:81, in _WrappedUnaryResponseMixin.__await__(self)
80 try:
---> 81 response = yield from self._call.__await__()
82 return response

File /opt/conda/lib/python3.10/site-packages/grpc/aio/_call.py:318, in _UnaryResponseMixin.__await__(self)
317 else:
--> 318 raise _create_rpc_error(
319 self._cython_call._initial_metadata,
320 self._cython_call._status,
321 )
322 else:

AioRpcError:

The above exception was the direct cause of the following exception:

FailedPrecondition Traceback (most recent call last)
Cell In[9], line 1
----> 1 prediction = await endpoint.predict_async(instances=instances)
2 prediction

File /opt/conda/lib/python3.10/site-packages/google/cloud/aiplatform/models.py:1636, in Endpoint.predict_async(self, instances, parameters, timeout)
1601 """Make an asynchronous prediction against this Endpoint.
1602 Example usage:
1603 ```
(...)
1632 Prediction with returned predictions and Model ID.
1633 """
1634 self.wait()
-> 1636 prediction_response = await self._prediction_async_client.predict(
1637 endpoint=self._gca_resource.name,
1638 instances=instances,
1639 parameters=parameters,
1640 timeout=timeout,
1641 )
1643 return Prediction(
1644 predictions=[
1645 json_format.MessageToDict(item)
(...)
1650 model_resource_name=prediction_response.model,
1651 )

File /opt/conda/lib/python3.10/site-packages/google/cloud/aiplatform_v1/services/prediction_service/async_client.py:360, in PredictionServiceAsyncClient.predict(self, request, endpoint, instances, parameters, retry, timeout, metadata)
355 metadata = tuple(metadata) + (
356 gapic_v1.routing_header.to_grpc_metadata((("endpoint", request.endpoint),)),
357 )
359 # Send the request.
--> 360 response = await rpc(
361 request,
362 retry=retry,
363 timeout=timeout,
364 metadata=metadata,
365 )
367 # Done; return the response.
368 return response

File /opt/conda/lib/python3.10/site-packages/google/api_core/grpc_helpers_async.py:84, in _WrappedUnaryResponseMixin.__await__(self)
82 return response
83 except grpc.RpcError as rpc_error:
---> 84 raise exceptions.from_grpc_error(rpc_error) from rpc_error

FailedPrecondition: 400 Making request from public OnePlatform API is not allowed on a private Endpoint peered with network (projects/PROJECT_ID/global/networks/default).
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。