ToolCondition

class ToolCondition<Args : Tool.Args, Result : ToolResult>(val tool: Tool<Args, Result>, val argsCondition: suspend (Args) -> Boolean, val produceResult: suspend (Args) -> Result)(source)

Represents a condition for a tool call and its corresponding result.

This class is used to define how a tool should respond to specific inputs during testing. It encapsulates the tool, a condition to check if the tool call matches, and a function to produce the result when the condition is satisfied.

Parameters

Args

The type of arguments the tool accepts

Result

The type of result the tool produces

Constructors

Link copied to clipboard
constructor(tool: Tool<Args, Result>, argsCondition: suspend (Args) -> Boolean, produceResult: suspend (Args) -> Result)

Properties

Link copied to clipboard
val argsCondition: suspend (Args) -> Boolean

A function that determines if the tool call matches this condition

Link copied to clipboard
val produceResult: suspend (Args) -> Result

A function that produces the result when the condition is satisfied

Link copied to clipboard

The tool to be mocked