PromptExecutorAPI

Functions

Link copied to clipboard
expect abstract fun close()
Link copied to clipboard
open suspend fun execute(prompt: Prompt, model: ResolvedModel, tools: List<ToolDescriptor> = emptyList()): Message.Assistant

Executes a given prompt against an already-resolved model and returns the assistant response.

abstract suspend fun execute(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor> = emptyList()): Message.Assistant

Executes a given prompt using the specified LLM and tools, returning a list of responses from the model.

Link copied to clipboard
open suspend fun executeMultipleChoices(prompt: Prompt, resolvedModel: ResolvedModel, tools: List<ToolDescriptor>): LLMChoice

Receives multiple independent choices from an already-resolved model.

open suspend fun executeMultipleChoices(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): LLMChoice

Receives multiple independent choices from the LLM. The method is implemented only for some specific providers which support multiple LLM choices.

Link copied to clipboard
open fun executeStreaming(prompt: Prompt, resolvedModel: ResolvedModel, tools: List<ToolDescriptor> = emptyList()): Flow<StreamFrame>

Executes a given prompt against an already-resolved model and returns its response as a stream.

abstract fun executeStreaming(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor> = emptyList()): Flow<StreamFrame>

Executes a given prompt using the specified LLM and returns a stream of output as a flow of StreamFrame objects.

Link copied to clipboard

Basic JSON schema generator required for the given model. Return BasicJsonSchemaGenerator by default.

Link copied to clipboard

Standard JSON schema generator required for the given model. Return StandardJsonSchemaGenerator by default.

Link copied to clipboard
open suspend fun models(): List<LLModel>

Retrieves a list of available models from all LLM clients managed by this executor.

Link copied to clipboard
open suspend fun moderate(prompt: Prompt, model: ResolvedModel): ModerationResult

Moderates the content of a prompt using an already-resolved model.

abstract suspend fun moderate(prompt: Prompt, model: LLModel): ModerationResult

Moderates the content of a given message with attachments using a specified LLM.

Link copied to clipboard
open suspend fun resolveModel(model: LLModel, promptExecutorOperation: PromptExecutorOperation): ResolvedModel

Resolves the requested model to a ResolvedModel to actually use for the given promptExecutorOperation.