gemini-code-assist[bot] commented on code in PR #35715:
URL: https://github.com/apache/beam/pull/35715#discussion_r2237177634


##########
sdks/python/apache_beam/ml/transforms/base.py:
##########
@@ -221,12 +225,20 @@ def _dict_output_fn(
     batch: Sequence[Dict[str, Any]],
     embeddings: Sequence[Any]) -> List[Dict[str, Any]]:
   """Map embeddings back to columns in batch."""
+  is_beam_row = False
+  if hasattr(batch[0], '_asdict'):

Review Comment:
   ![critical](https://www.gstatic.com/codereviewagent/critical.svg)
   
   This line could raise an `IndexError` if `batch` is an empty sequence. To 
prevent this, you should check if `batch` is not empty before accessing 
`batch[0]`, similar to the check in `_dict_input_fn`.
   
   ```python
   if batch and hasattr(batch[0], '_asdict'):
   ```



##########
sdks/python/setup.py:
##########
@@ -516,8 +516,10 @@ def get_portability_package_data():
               'skl2onnx',
               'pillow',
               'pyod',
+              'sentence-transformers',

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   The `sentence-transformers` dependency is duplicated. It's already listed on 
line 515 in the `ml_test` extras.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to