Skip to content

Commit 8c6560f

Browse files
coolbeevipkthota-gholtskinner
authored
feat: Add append and last_chunk to add_artifact method on TaskUpdater (#186)
# Description Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [x] Follow the [`CONTRIBUTING` Guide](https://github.com/google-a2a/a2a-python/blob/main/CONTRIBUTING.md). - [x] Make your Pull Request title in the <https://www.conventionalcommits.org/> specification. - Important Prefixes for [release-please](https://github.com/googleapis/release-please): - `fix:` which represents bug fixes, and correlates to a [SemVer](https://semver.org/) patch. - `feat:` represents a new feature, and correlates to a SemVer minor. - `feat!:`, or `fix!:`, `refactor!:`, etc., which represent a breaking change (indicated by the `!`) and will result in a SemVer major. - [x] Ensure the tests and linter pass (Run `nox -s format` from the repository root to format) - [x] Appropriate docs were updated (if necessary) Fixes #176 🦕 --------- Co-authored-by: kthota-g <kcthota@google.com> Co-authored-by: Holt Skinner <13262395+holtskinner@users.noreply.github.com>
1 parent 32fecc7 commit 8c6560f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/a2a/server/tasks/task_updater.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,14 @@ async def update_status(
6565
)
6666
)
6767

68-
async def add_artifact(
68+
async def add_artifact( # noqa: PLR0913
6969
self,
7070
parts: list[Part],
7171
artifact_id: str | None = None,
7272
name: str | None = None,
7373
metadata: dict[str, Any] | None = None,
74+
append: bool | None = None,
75+
last_chunk: bool | None = None,
7476
) -> None:
7577
"""Adds an artifact chunk to the task and publishes a `TaskArtifactUpdateEvent`.
7678
@@ -79,6 +81,8 @@ async def add_artifact(
7981
artifact_id: The ID of the artifact. A new UUID is generated if not provided.
8082
name: Optional name for the artifact.
8183
metadata: Optional metadata for the artifact.
84+
append: Optional boolean indicating if this chunk appends to a previous one.
85+
last_chunk: Optional boolean indicating if this is the last chunk.
8286
"""
8387
if not artifact_id:
8488
artifact_id = str(uuid.uuid4())
@@ -93,6 +97,8 @@ async def add_artifact(
9397
parts=parts,
9498
metadata=metadata,
9599
),
100+
append=append,
101+
lastChunk=last_chunk
96102
)
97103
)
98104

0 commit comments

Comments
 (0)