This is an automated email from the ASF dual-hosted git repository.

vterentev pushed a commit to branch fix-postc-python
in repository https://gitbox.apache.org/repos/asf/beam.git

commit 7ad2d9627ece1c5bf7275f0d76ac42f151a6847a
Author: Vitaly Terentyev <[email protected]>
AuthorDate: Wed Jul 30 13:52:21 2025 +0400

    Simple fixes
---
 .../apache_beam/examples/inference/gemini_text_classification.py   | 7 +++++--
 sdks/python/apache_beam/io/debezium.py                             | 2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git 
a/sdks/python/apache_beam/examples/inference/gemini_text_classification.py 
b/sdks/python/apache_beam/examples/inference/gemini_text_classification.py
index e82f407374a..b264467467c 100644
--- a/sdks/python/apache_beam/examples/inference/gemini_text_classification.py
+++ b/sdks/python/apache_beam/examples/inference/gemini_text_classification.py
@@ -67,8 +67,11 @@ def parse_known_args(argv):
 
 class PostProcessor(beam.DoFn):
   def process(self, element: PredictionResult) -> Iterable[str]:
-    yield "Input: " + str(element.example) + " Output: " + str(
-        element.inference[1][0].content.parts[0].text)
+    try:
+      output_text = element.inference[1][0].content.parts[0].text
+      yield f"Input: {element.example}, Output: {output_text}"
+    except Exception:
+      yield f"Can't decode inference for element: {element.example}"
 
 
 def run(
diff --git a/sdks/python/apache_beam/io/debezium.py 
b/sdks/python/apache_beam/io/debezium.py
index 9e93801852c..26516fa4e4b 100644
--- a/sdks/python/apache_beam/io/debezium.py
+++ b/sdks/python/apache_beam/io/debezium.py
@@ -155,7 +155,7 @@ class ReadFromDebezium(PTransform):
         username=username,
         password=password,
         host=host,
-        port=port,
+        port=str(port),
         max_number_of_records=max_number_of_records,
         connection_properties=connection_properties)
     self.expansion_service = expansion_service or 
default_io_expansion_service()

Reply via email to