AbstractBuildingStep

abstract class AbstractBuildingStep<P : Any, R : AbstractResponseSpecification<P, *>>(mokksy: MokksyServer, buildingStep: BuildingStep<P>)(source)

Defines a building step for constructing a mock response based on specific request scenarios within a mock server for large language model interactions.

This class provides methods to specify both expected responses and error responses for completions requests. It serves as a framework for configuring the behavior of a mock server's response mechanism.

Type Parameters

P

The type of the request body for the interaction.

R

A type that extends AbstractResponseSpecification, representing configuration for the expected response specification.

Inheritors

Constructors

Link copied to clipboard
constructor(mokksy: MokksyServer, buildingStep: BuildingStep<P>)

Functions

Link copied to clipboard
open infix fun responds(block: Consumer<R>)

Defines the expected response from the system in response to a completions request.

abstract infix fun responds(block: suspend R.() -> Unit)
Link copied to clipboard
open infix fun <R : Any> respondsError(block: Consumer<ResponseDefinitionBuilder<P, R>>)

Specifies an erroneous response for a completions request.

open infix fun <T : Any> respondsError(block: suspend ResponseDefinitionBuilder<P, T>.() -> Unit)

Specifies an error response for a given request scenario. This allows defining the characteristics of an erroneous response, such as the HTTP status, response body, headers, delay, and more.

open fun <T : Any> respondsError(responseType: KClass<T>, block: suspend ResponseDefinitionBuilder<P, T>.() -> Unit)