From 9e01e2e543fef22fef5a3eb16b057cdec9779dd6 Mon Sep 17 00:00:00 2001 From: Mark Daoust Date: Tue, 1 Oct 2024 16:35:29 -0700 Subject: [PATCH] Improve Any decoding-error. Was: TypeError: Could not convert Any to PredictLongRunningResponse Now: TypeError: Could not convert Any[google.ai.generativelanguage.v1main.PredictLongRunningResponse] to google.ai.generativelanguage.v1beta.PredictLongRunningResponse --- google/api_core/protobuf_helpers.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/google/api_core/protobuf_helpers.py b/google/api_core/protobuf_helpers.py index d777c5f8..b8738e5f 100644 --- a/google/api_core/protobuf_helpers.py +++ b/google/api_core/protobuf_helpers.py @@ -63,8 +63,8 @@ def from_any_pb(pb_type, any_pb): # Unpack the Any object and populate the protobuf message instance. if not any_pb.Unpack(msg_pb): raise TypeError( - "Could not convert {} to {}".format( - any_pb.__class__.__name__, pb_type.__name__ + "Could not convert\n Any[{}] to\n {}".format( + any_pb.TypeName(), msg_pb.DESCRIPTOR.full_name ) )