Package-level declarations

Types

Link copied to clipboard
class ActionLogBuilder(val truncation: ActionLogTruncation, val json: Json)

DSL for building a stage action log. Obtained via StageScope.logAction.

Link copied to clipboard
data class CompletedAgentRun<Output>(val output: Output, val score: Double, val isSolved: Boolean, val usedAgent: GraphAIAgent<*, *>? = null)

Result of a successful agent run produced by StageScope.runAgent.

Link copied to clipboard
class MatchedAgentRun<Output, RunData>(val agentRun: CompletedAgentRun<Output>, val runData: RunData)

A successful CompletedAgentRun together with the PreparedAgentRun.runData that produced it, returned by the generic StageScope.runAgentWithRetries.

Link copied to clipboard
class PreparedAgentRun<Input, Output, RunData>(val agent: GraphAIAgent<Input, Output>, val runData: RunData)

An agent paired with caller-supplied per-attempt data, returned by the agentProvider of the generic StageScope.runAgentWithRetries so the data can be matched back to a successful run.

Link copied to clipboard

Stop condition for the re-sampling StageScope.runAgentWithRetries overloads.

Link copied to clipboard

The single unified scope for the training DSL.

Link copied to clipboard
annotation class TrainingDsl

DslMarker for the training DSL; scopes receiver resolution within builders like ActionLogBuilder.

Functions

Link copied to clipboard
suspend fun StageScope<*, *, *>.executePrompt(prompt: Prompt, model: LLModel, retryPolicy: RetryPolicy? = null): Result<List<Message.Response>>

Executes an LLM prompt with consumption tracking. Creates a PromptExecutionRecord as a leaf record, recording elapsed time and consumption. On success, returns the raw LLM response messages.

Link copied to clipboard
suspend fun StageScope<*, *, *>.executePromptOrThrow(prompt: Prompt, model: LLModel, retryPolicy: RetryPolicy? = null): List<Message.Response>

.getOrThrow() shortcut over executePrompt; throws on a recorded execution failure.

Link copied to clipboard
inline suspend fun <T> StageScope<*, *, *>.executePromptStructured(prompt: Prompt, model: LLModel, retryPolicy: RetryPolicy? = null): Result<T>

Executes a structured LLM prompt with consumption tracking. Creates a PromptExecutionRecord and returns the deserialized structure.

Link copied to clipboard
inline suspend fun <T> StageScope<*, *, *>.executePromptStructuredOrThrow(prompt: Prompt, model: LLModel, retryPolicy: RetryPolicy? = null): T

.getOrThrow() shortcut over executePromptStructured; throws on a recorded execution failure.

Link copied to clipboard

Convenience wrapper that maps a collection, enclosing it in a dedicated stage. Pros: automatically sets substagesTotal to enable ETC calculation.

Link copied to clipboard
suspend fun <Input, Output, InputLabel> StageScope<Input, Output, InputLabel>.runAgentOrThrow(item: TrainSetItem<Input, InputLabel>, agentToRun: GraphAIAgent<Input, Output> = trackedAgent, retryPolicy: RetryPolicy? = null): CompletedAgentRun<Output>

.getOrThrow() shortcut over StageScope.runAgent; throws on a recorded run failure.

Link copied to clipboard
suspend fun <Input, Output, InputLabel, T> StageScope<Input, Output, InputLabel>.runIterableStage(collection: Collection<T>, name: String, itemBlock: suspend StageScope<Input, Output, InputLabel>.(T) -> Unit): Result<Unit>

Convenience wrapper that iterates a collection, enclosing it in a dedicated stage. Pros: automatically sets substagesTotal to enable ETC calculation.

Link copied to clipboard
suspend fun <Input, Output, InputLabel, T> StageScope<Input, Output, InputLabel>.runIterableStageOrThrow(collection: Collection<T>, name: String, itemBlock: suspend StageScope<Input, Output, InputLabel>.(T) -> Unit)
Link copied to clipboard
suspend fun <Input, Output, InputLabel, T> StageScope<Input, Output, InputLabel>.runStageOrThrow(name: String, substagesTotal: Int? = null, metrics: MetricsMap = standardStageMetrics(), block: suspend StageScope<Input, Output, InputLabel>.() -> T): T

.getOrThrow() shortcut over StageScope.runStage. See its KDoc for the metrics preset conventions; the default and parameter semantics are identical.

Link copied to clipboard
inline fun <T> StageScope<*, *, *>.setAdditionalData(data: T)

Serializes data with defaultExperimentsJson and stores it as this stage's additional data via StageScope.setAdditionalDataJson. Overwrites any previously set value.

Link copied to clipboard
fun JsonElement.truncateStrings(truncation: ActionLogTruncation): JsonElement

Recursive string truncation over the entire JSON element tree