Package-level declarations

Types

Link copied to clipboard
class AgentBuilder(val name: String, val provider: String = "embabel", val version: <Error class: unknown class> = Semver(), val description: String, promptContributors: List<<Error class: unknown class>> = emptyList())

Instances of this are usually created via the convenient agent() function.

Link copied to clipboard
data class AgentScopeBuilder<O>(val name: String, val provider: String = "embabel", val actions: List<Action> = emptyList(), val goals: Set<Goal> = emptySet(), val conditions: Set<Condition> = emptySet(), val opaque: Boolean = false)

AgentScopeBuilder that emits actions and can be built on further.

Link copied to clipboard
data class BiInputActionContext<A1, A2>(val input1: A1, val input2: A2, val actionContext: ActionContext) : InputsActionContext, ActionContext
Link copied to clipboard
typealias ConditionPredicate = (context: OperationContext) -> Boolean?

Functions

Link copied to clipboard
fun agent(name: String, provider: String = "embabel", version: <Error class: unknown class> = Semver(), description: String, promptContributors: List<<Error class: unknown class>> = emptyList(), block: AgentBuilder.() -> Unit): Agent

Surface area of DSL for creating an agent.

Link copied to clipboard
inline fun <A, B, C> aggregate(transforms: List<(context: InputActionContext<A>) -> B>, noinline merge: (list: List<B>, context: OperationContext) -> C): AgentScopeBuilder<C>

Run all the transforms and merge the results.

fun <A, B, C> aggregate(transforms: List<(context: InputActionContext<A>) -> B>, merge: (list: List<B>, context: OperationContext) -> C, aClass: Class<A>, bClass: Class<B>, cClass: Class<C>): AgentScopeBuilder<C>
Link copied to clipboard
infix inline fun <A, B, C> (A) -> B.andThen(crossinline that: (B) -> C): AgentScopeBuilder<C>
fun <A, B, C> Function<InputActionContext<A>, B>.andThen(that: Function<InputActionContext<B>, C>, aClass: Class<A>, bClass: Class<B>, cClass: Class<C>): AgentScopeBuilder<C>
Link copied to clipboard
infix inline fun <A, B, C> (A) -> B.andThenDo(crossinline that: (InputActionContext<B>) -> C): AgentScopeBuilder<C>
Link copied to clipboard
inline fun <A1, A2, B : Any, C> biAggregate(transforms: List<(context: BiInputActionContext<A1, A2>) -> B>, noinline merge: (list: List<B>) -> C): AgentScopeBuilder<C>

fun <A1, A2, B : Any, C> biAggregate(transforms: List<(context: BiInputActionContext<A1, A2>) -> B>, merge: (list: List<B>) -> C, a1Class: Class<A1>, a2Class: Class<A2>, bClass: Class<B>, cClass: Class<C>): AgentScopeBuilder<C>

Aggregate taking 2 inputs

Link copied to clipboard
inline fun <A, B, C> branch(noinline a: (context: InputActionContext<A>) -> Branch<B, C>): AgentScopeBuilder<Branch<B, C>>

Convenience method to branch from A to B or C using Kotlin reified types.

fun <A, B, C> branch(a: (context: InputActionContext<A>) -> Branch<B, C>, aClass: Class<A>, bClass: Class<B>, cClass: Class<C>): AgentScopeBuilder<Branch<B, C>>

Branch from A to B or C using Kotlin reified types. Makes conditionals easy to express.

Link copied to clipboard
inline fun <A, B, C> chain(noinline a: (context: InputActionContext<A>) -> B, noinline b: (context: InputActionContext<B>) -> C): AgentScopeBuilder<C>

Convenience method to chain A to B via C using Kotlin reified types.

fun <A, B, C> chain(a: (context: InputActionContext<A>) -> B, b: (context: InputActionContext<B>) -> C, aClass: Class<A>, bClass: Class<B>, cClass: Class<C>): AgentScopeBuilder<C>

Creates a chain from A to B via C. Emits actions.

Link copied to clipboard
inline fun <A, B : Any> doSplit(noinline splitter: (InputActionContext<A>) -> List<B>): AgentScopeBuilder<Unit>
fun <A, B : Any> doSplit(splitter: (InputActionContext<A>) -> List<B>, aClass: Class<A>, bClass: Class<B>): AgentScopeBuilder<Unit>
Link copied to clipboard
Link copied to clipboard
suspend fun <T, R> Collection<T>.mapAsync(context: OperationContext, concurrencyLevel: Int = 10, dispatcher: <Error class: unknown class> = Dispatchers.IO, transform: suspend (T) -> R): List<R>

Map async, using the agent process

Link copied to clipboard
fun <T, R> Collection<T>.parallelMap(context: OperationContext, concurrencyLevel: Int = 10, dispatcher: <Error class: unknown class> = Dispatchers.IO, transform: suspend (T) -> R): List<R>

Map parallel. Block on all results

Link copied to clipboard
inline fun <C> repeat(noinline what: () -> AgentScopeBuilder<C>, noinline until: (c: C, context: OperationContext) -> Boolean): AgentScopeBuilder<C>
fun <C> repeat(what: () -> AgentScopeBuilder<C>, until: (c: C, context: OperationContext) -> Boolean, cClass: Class<C>): AgentScopeBuilder<C>
Link copied to clipboard
inline fun <A, B : Any, C> repeatableAggregate(startWith: C, transforms: List<(context: BiInputActionContext<A, C>) -> B>, noinline merge: (list: List<B>) -> C): AgentScopeBuilder<C>

Special aggregate that works like an accumulator. If the condition is not satisfied, your transformer methods will be called again with the latest updated context.

Link copied to clipboard
inline fun <I, O : Any> runAgent(agent: Agent, context: TransformationActionContext<I, O>): O
Link copied to clipboard
inline fun <A, B : Any> split(noinline splitter: (a: A) -> List<B>): AgentScopeBuilder<Unit>