Skip to content

Commit 41bfcb6

Browse files
Ark-kuncopybara-github
authored andcommitted
fix: LLM - Fixed the async streaming
Fixes #2853 PiperOrigin-RevId: 577345792
1 parent 087f3c8 commit 41bfcb6

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

google/cloud/aiplatform/_streaming_prediction.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ async def predict_stream_of_tensor_lists_from_single_tensor_list_async(
130130
inputs=tensor_list,
131131
parameters=parameters_tensor,
132132
)
133-
async for response in prediction_service_async_client.server_streaming_predict(
133+
async for response in await prediction_service_async_client.server_streaming_predict(
134134
request=request
135135
):
136136
yield response.outputs

tests/unit/aiplatform/test_language_models.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1484,12 +1484,15 @@ async def test_text_generation_model_predict_streaming_async(self):
14841484
"text-bison@001"
14851485
)
14861486

1487-
async def mock_server_streaming_predict_async(*args, **kwargs):
1487+
async def mock_server_streaming_predict_async_iter(*args, **kwargs):
14881488
for response_dict in _TEST_TEXT_GENERATION_PREDICTION_STREAMING:
14891489
yield gca_prediction_service.StreamingPredictResponse(
14901490
outputs=[_streaming_prediction.value_to_tensor(response_dict)]
14911491
)
14921492

1493+
async def mock_server_streaming_predict_async(*args, **kwargs):
1494+
return mock_server_streaming_predict_async_iter(*args, **kwargs)
1495+
14931496
with mock.patch.object(
14941497
target=prediction_service_async_client.PredictionServiceAsyncClient,
14951498
attribute="server_streaming_predict",

0 commit comments

Comments
 (0)