JavaPromptExecutor
A wrapper for PromptExecutor that exposes a Java-friendly API.
Constructors
Link copied to clipboard
Creates a new JavaPromptExecutor instance.
Functions
Link copied to clipboard
Converts a PromptExecutor instance to a JavaPromptExecutor instance.
Link copied to clipboard
open suspend override 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
fun executeAsync(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor> = emptyList(), coroutineContext: CoroutineContext = Dispatchers.IO): CompletableFuture<List<Message.Response>>
Executes the given prompt asynchronously using the specified model and tools.
Link copied to clipboard
open suspend override fun executeMultipleChoices(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): List<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 override fun executeStreaming(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): Flow<StreamFrame>
Executes a given prompt using the specified language model and returns a stream of output as a flow of StreamFrame
objects.
Link copied to clipboard
Moderates the content of a given message with attachments using a specified language model.