pub struct TaskArtifactUpdateEvent {
pub task_id: String,
pub context_id: String,
pub artifact: Artifact,
pub append: bool,
pub last_chunk: bool,
pub metadata: BTreeMap<String, Value>,
}Expand description
A streaming event that reports a task artifact being produced or appended.
Wire form:
{
"taskId": "task-1",
"contextId": "context-1",
"artifact": { "name": "answer", "parts": [...] },
"append": false,
"lastChunk": false,
"metadata": { ... }
}taskId, contextId, and artifact
are required; append, lastChunk,
and metadata are optional. The
append flag is true when the
artifact should be appended to a
previously sent artifact with the
same id (chunked transfer); the
lastChunk flag is true when this
is the final chunk of an append.
Fields§
§task_id: StringThe task’s id. Required.
context_id: StringThe task’s context id. Required.
artifact: ArtifactThe artifact that was produced or updated. Required.
append: boolWhether the artifact should be
appended to a previously sent
artifact with the same id. The
default (false) means this
artifact replaces any previous
one with the same id.
last_chunk: boolWhether this is the final chunk
of the artifact. Only meaningful
when append is true; ignored
otherwise.
metadata: BTreeMap<String, Value>Per-event metadata.
Implementations§
Source§impl TaskArtifactUpdateEvent
impl TaskArtifactUpdateEvent
Sourcepub fn new(
task_id: impl Into<String>,
context_id: impl Into<String>,
artifact: Artifact,
) -> Self
pub fn new( task_id: impl Into<String>, context_id: impl Into<String>, artifact: Artifact, ) -> Self
Starts a new event with task_id,
context_id, and artifact. The
append and lastChunk flags
default to false. Use
with_append
to mark the artifact as an
append, and
with_last_chunk
to mark this as the final chunk.
Sourcepub const fn with_append(self) -> Self
pub const fn with_append(self) -> Self
Sets the append flag to true.
Sourcepub const fn with_last_chunk(self) -> Self
pub const fn with_last_chunk(self) -> Self
Sets the lastChunk flag to true.