PromptExecutor

An interface representing an executor for processing language model prompts. This defines methods for executing prompts against models with or without tool assistance, as well as for streaming responses.

Note: a single PromptExecutor might embed multiple LLM clients for different LLM providers supporting different models.

Functions

Link copied to clipboard
open suspend fun execute(prompt: Prompt, model: LLModel): String

Executes the given prompt using the specified language model and returns the resulting text content.

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

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

Link copied to clipboard
abstract suspend fun executeStreaming(prompt: Prompt, model: LLModel): Flow<String>

Executes a given prompt using the specified language model and returns a stream of output as a flow of strings.