Skip to content

Commit ee026aa

Browse files
authored
fix: correct new_artifact methods signature (#503)
Artifact class has nullable description with default None `Artifact(description: str | None = None)` But, utilities functions creates and artifact with empty description by default `description=''` Release-As: 0.3.10
1 parent 9155888 commit ee026aa

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/a2a/utils/artifact.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99

1010

1111
def new_artifact(
12-
parts: list[Part], name: str, description: str = ''
12+
parts: list[Part],
13+
name: str,
14+
description: str | None = None,
1315
) -> Artifact:
1416
"""Creates a new Artifact object.
1517
@@ -32,7 +34,7 @@ def new_artifact(
3234
def new_text_artifact(
3335
name: str,
3436
text: str,
35-
description: str = '',
37+
description: str | None = None,
3638
) -> Artifact:
3739
"""Creates a new Artifact object containing only a single TextPart.
3840
@@ -54,7 +56,7 @@ def new_text_artifact(
5456
def new_data_artifact(
5557
name: str,
5658
data: dict[str, Any],
57-
description: str = '',
59+
description: str | None = None,
5860
) -> Artifact:
5961
"""Creates a new Artifact object containing only a single DataPart.
6062

tests/utils/test_artifact.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def test_new_artifact_empty_description_if_not_provided(self):
3838
parts = [Part(root=TextPart(text='Another sample'))]
3939
name = 'Artifact_No_Desc'
4040
artifact = new_artifact(parts=parts, name=name)
41-
self.assertEqual(artifact.description, '')
41+
self.assertEqual(artifact.description, None)
4242

4343
def test_new_text_artifact_creates_single_text_part(self):
4444
text = 'This is a text artifact.'

0 commit comments

Comments
 (0)