TaskBuilder

Builder class for creating Task instances.

This builder provides a fluent API for creating Task objects, making it easier to configure tasks.

Example usage:

val task = Task.create {
id("task-456")
contextId("ctx-789")
status {
state = TaskState.working
timestamp = System.currentTimeMillis()
}
artifact {
name = "response"
textPart("I can help you with that!")
}
}

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
var id: String?
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard

Adds an artifact to the task.

Link copied to clipboard
Link copied to clipboard

Creates an artifact using the provided Java-friendly Consumer and adds it to the task.

Creates an artifact using the provided configuration block and adds it to the task.

Link copied to clipboard

Sets the artifacts of the task.

Link copied to clipboard
fun build(validate: Boolean = true): Task

Builds a Task instance with the configured parameters.

Link copied to clipboard
fun contextId(contextId: String): TaskBuilder
Link copied to clipboard

Sets the ID of the task.

Link copied to clipboard
fun metadata(metadata: Metadata): TaskBuilder

Sets the metadata of the task.

Link copied to clipboard

Sets the status of the task.

Configures the status using a Java-friendly Consumer.

Configures the status using a lambda with receiver.