CapturingPromptExecutor

abstract class CapturingPromptExecutor : PromptExecutor

A PromptExecutor that accumulates the LLMConsumption of the calls it intercepts and hands it back via collectAndClear. The training infrastructure creates one per leaf prompt call (via the session's capturingExecutorFactory) and reads its consumption between retry attempts; the concrete provider-aware extraction lives in the app.

Inheritors

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
abstract fun close()
Link copied to clipboard

Returns the consumption accumulated since the previous call (or since construction), then resets the accumulator. Returns null when nothing was captured.

Link copied to clipboard
fun execute(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>, executorService: ExecutorService?): List<Message.Response>
abstract suspend fun execute(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): List<Message.Response>
Link copied to clipboard
fun executeMultipleChoices(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>, executorService: ExecutorService?): List<LLMChoice>
open suspend fun executeMultipleChoices(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): List<LLMChoice>
Link copied to clipboard
abstract fun executeStreaming(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): Flow<StreamFrame>
Link copied to clipboard
fun executeStreamingWithPublisher(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): Flow.Publisher<StreamFrame>
Link copied to clipboard
inline suspend fun <OutputStructT> PromptExecutor.executeStructuredOrThrow(prompt: Prompt, model: LLModel): OutputStructT

Executes prompt against model, requesting a structured response of type OutputStructT, and returns the parsed data.

Link copied to clipboard
open fun getBasicJsonSchemaGenerator(model: LLModel): BasicJsonSchemaGenerator
Link copied to clipboard
open fun getStandardJsonSchemaGenerator(model: LLModel): StandardJsonSchemaGenerator
Link copied to clipboard
fun models(executorService: ExecutorService?): List<LLModel>
open suspend fun models(): List<LLModel>
Link copied to clipboard
fun moderate(prompt: Prompt, model: LLModel, executorService: ExecutorService?): ModerationResult
abstract suspend fun moderate(prompt: Prompt, model: LLModel): ModerationResult