pangwangshu opened a new issue, #40474:
URL: https://github.com/apache/beam/issues/40474

   ### What happened?
   
   Two small issues in 
`sdks/python/apache_beam/ml/rag/enrichment/milvus_search.py`:
   
   **1. `MilvusBaseRanker` defines `__int__` instead of `__init__`**
   
   
https://github.com/apache/beam/blob/c692c225d97796ee6efc3faed26aa4fb712679e7/sdks/python/apache_beam/ml/rag/enrichment/milvus_search.py#L97-L100
   
   ```python
   class MilvusBaseRanker:
     def __int__(self):
       return
   ```
   
   This looks like a typo for `__init__`. As written, it defines the integer 
conversion hook, so `int(ranker)` would raise `TypeError: __int__ returned 
non-int (type NoneType)`. Since the base class has no state to initialize, the 
method can simply be removed.
   
   **2. `join_fn` is annotated with `Embedding` but receives an 
`EmbeddableItem`**
   
   
https://github.com/apache/beam/blob/c692c225d97796ee6efc3faed26aa4fb712679e7/sdks/python/apache_beam/ml/rag/enrichment/milvus_search.py#L591-L593
   
   ```python
   def join_fn(left: Embedding, right: dict[str, Any]) -> Embedding:
     left.metadata['enrichment_data'] = right
     return left
   ```
   
   The handler's input/output type is `EmbeddableItem` (`InputT`/`OutputT` in 
the same module), and `Embedding` has no `metadata` attribute. The annotation 
should be `EmbeddableItem` for both the parameter and the return type.
   
   Neither issue changes runtime behavior for current users; the fix is a small 
cleanup. I plan to send a PR.
   
   ### Issue Priority
   
   Priority: 3 (minor)
   
   ### Issue Components
   
   - [x] Component: Python SDK
   - [ ] Component: Java SDK
   - [ ] Component: Go SDK
   - [ ] Component: Typescript SDK
   - [ ] Component: IO connector
   - [ ] Component: Beam YAML
   - [ ] Component: Beam examples
   - [ ] Component: Beam playground
   - [ ] Component: Beam katas
   - [ ] Component: Website
   - [ ] Component: Infrastructure
   - [ ] Component: Spark Runner
   - [ ] Component: Flink Runner
   - [ ] Component: Prism Runner
   - [ ] Component: Twister2 Runner
   - [ ] Component: Hazelcast Jet Runner
   - [ ] Component: Google Cloud Dataflow Runner
   


-- 
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