MockPromptExecutor

A mock implementation of PromptExecutor used for testing.

This class simulates an LLM by returning predefined responses based on the input prompt. It supports different types of matching:

  1. Exact matching - Returns a response when the input exactly matches pattern

  2. Partial matching - Returns a response when the input contains a pattern

  3. Conditional matching - Returns a response when the input satisfies condition

  4. Default response - Returns a default response when no other matches are found

It also supports tool calls and can be configured to return specific tool results.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
open suspend override fun execute(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): List<Message.Response>

Executes a prompt with tools and returns a list of responses.

Link copied to clipboard
open suspend fun executeMultipleChoices(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): List<LLMChoice>
Link copied to clipboard
open override fun executeStreaming(prompt: Prompt, model: LLModel, tools: List<ToolDescriptor>): Flow<StreamFrame>

Executes a prompt and returns a flow of string responses.

Link copied to clipboard
open suspend fun models(): List<LLModel>
Link copied to clipboard
open suspend override fun moderate(prompt: Prompt, model: LLModel): ModerationResult

Processes a given prompt to determine if it adheres to moderation rules and returns a moderation result.