PromptExecutorWithChoiceSelection

A specialized implementation of PromptExecutor that enhances the standard execution process by introducing a choice selection mechanism. This class acts as a proxy that intercepts the standard execute method, generates multiple response choices, and applies a selection strategy to filter and choose the most appropriate responses.

The execution process involves two main steps:

  1. Generating multiple response choices using the underlying executor

  2. Applying the specified selection strategy to choose the most suitable responses

Parameters

executor

The underlying PromptExecutor responsible for performing the prompt execution and generating multiple response choices.

choiceSelectionStrategy

The strategy implementation that defines the logic for selecting and filtering the generated response choices.

Constructors

Link copied to clipboard
constructor(executor: PromptExecutor, choiceSelectionStrategy: ChoiceSelectionStrategy)

Functions

Link copied to clipboard
open suspend override fun execute(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): List<Message.Response>
Link copied to clipboard
open suspend override fun executeMultipleChoices(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): List<LLMChoice>
Link copied to clipboard
open suspend override fun executeStreaming(prompt: Prompt, model: LLModel): Flow<String>
Link copied to clipboard
open suspend override fun moderate(prompt: Prompt, model: LLModel): ModerationResult