ScriptedLlmOperations

A scripted LLM operations implementation for testing.

This allows tests to script exact sequences of:

  • Tool calls (with specific arguments)

  • Text responses

  • Object creation

The scripted operations track what was called for verification.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
sealed class ScriptedAction

Represents a scripted action to take.

Link copied to clipboard
data class ToolCallRecord(val toolName: String, val input: String, val result: String)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun callTool(toolName: String, inputJson: String = "{}"): ScriptedLlmOperations

Script a tool call.

Link copied to clipboard
open override fun <O> createObject(messages: List<Message>, interaction: LlmInteraction, outputClass: Class<O>, agentProcess: AgentProcess, action: Action?): O

Create an output object, in the context of an AgentProcess.

Link copied to clipboard
open override fun <O> createObjectIfPossible(messages: List<Message>, interaction: LlmInteraction, outputClass: Class<O>, agentProcess: AgentProcess, action: Action?): <Error class: unknown class><O>

Try to create an output object in the context of an AgentProcess. Return a failure result if the LLM does not have enough information to create the object.

Link copied to clipboard
open fun <O> doTransform(prompt: String, interaction: LlmInteraction, outputClass: Class<O>, llmRequestEvent: LlmRequestEvent<O>?): O

Low level transform, not necessarily aware of platform This is a convenience overload that creates a UserMessage from a String prompt

open override fun <O> doTransform(messages: List<Message>, interaction: LlmInteraction, outputClass: Class<O>, llmRequestEvent: LlmRequestEvent<O>?): O

Low level transform, not necessarily aware of platform

Link copied to clipboard
open override fun generate(prompt: String, interaction: LlmInteraction, agentProcess: AgentProcess, action: Action?): String

Generate text in the context of an AgentProcess.

Link copied to clipboard
fun reset()

Reset the script to start from the beginning.

Link copied to clipboard

Script a text response.

Link copied to clipboard

Script returning an object.

Link copied to clipboard

Add a scripted action to the sequence.