Skip to content

Commit 5c99db3

Browse files
Update proto conversion utilities
1 parent 50b61cb commit 5c99db3

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/a2a/utils/proto_utils.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,8 @@ def capabilities(
320320
streaming=bool(capabilities.streaming),
321321
push_notifications=bool(capabilities.push_notifications),
322322
extensions=[
323-
cls.extension(x) for x in capabilities.extensions
324-
]
325-
if capabilities.extensions
326-
else None,
323+
cls.extension(x) for x in capabilities.extensions or []
324+
],
327325
)
328326

329327
@classmethod
@@ -489,7 +487,7 @@ def message(cls, message: a2a_pb2.Message) -> types.Message:
489487

490488
@classmethod
491489
def metadata(cls, metadata: struct_pb2.Struct) -> dict[str, Any]:
492-
if not metadata:
490+
if not metadata.fields:
493491
return {}
494492
return struct_to_dict(metadata)
495493

@@ -789,9 +787,7 @@ def capabilities(
789787
push_notifications=capabilities.push_notifications,
790788
extensions=[
791789
cls.agent_extension(x) for x in capabilities.extensions
792-
]
793-
if capabilities.extensions
794-
else None,
790+
],
795791
)
796792

797793
@classmethod

0 commit comments

Comments
 (0)