AbstractInferenceRequestSpecification

abstract class AbstractInferenceRequestSpecification<P>(var temperature: Double? = null, var maxTokens: Long? = null, var topK: Long? = null, var topP: Double? = null, model: String? = null, requestBody: MutableList<Matcher<P?>> = mutableListOf(), requestBodyString: MutableList<Matcher<String?>> = mutableListOf()) : ModelRequestSpecification<P> (source)

Abstract class for defining specifications for inference requests. Provides functionality for configuring parameters and specifying conditions related to system and user messages within the request.

Parameters

model

Optional model identifier.

requestBody

A mutable list of matchers representing conditions on the request body.

requestBodyString

A mutable list of matchers representing conditions on the request body string.

Type Parameters

P

The type of the request body.

Constructors

Link copied to clipboard
constructor(temperature: Double? = null, maxTokens: Long? = null, topK: Long? = null, topP: Double? = null, model: String? = null, requestBody: MutableList<Matcher<P?>> = mutableListOf(), requestBodyString: MutableList<Matcher<String?>> = mutableListOf())

Properties

Link copied to clipboard

Optional maximum number of tokens to generate in the response.

Link copied to clipboard
Link copied to clipboard
val requestBody: MutableList<Matcher<P?>>
Link copied to clipboard
Link copied to clipboard

Optional temperature parameter to control randomness in the inference process.

Link copied to clipboard
var topK: Long?

Optional top-k sampling parameter specifying how many top tokens to consider during sampling.

Link copied to clipboard
var topP: Double?

Optional top-p (nucleus) sampling parameter to control the probability mass of tokens to consider.

Functions

Link copied to clipboard
Link copied to clipboard

Adds a matcher to require that the request body string contains the specified substring.

Link copied to clipboard

Adds a condition to ensure the request body contains the specified substring, ignoring case sensitivity.

Link copied to clipboard

Adds a condition to ensure the request body does not contain the specified substring.

Link copied to clipboard

Adds a condition to ensure the request body does not contain the specified substring, ignoring case sensitivity.

Link copied to clipboard

Adds a matcher to require the request body object to be exactly equal to the specified object.

Adds a matcher to require the request body string to be exactly equal to the specified value.

Link copied to clipboard

Adds a matcher that requires the request body string to exactly match the specified JSON payload.

Link copied to clipboard
fun requestMatches(matcher: Matcher<P?>)

Adds a condition to verify that the request matches the specified matcher.

Link copied to clipboard
fun requestMatchesPredicate(predicate: (P) -> Boolean)

Adds a condition to verify that the request matches the specified predicate.

Link copied to clipboard
fun requestSatisfies(description: String? = null, call: (P?) -> Unit)

Adds a condition to verify that the request satisfies the specified call.

Link copied to clipboard
inline fun systemMessageContains(builderAction: StringBuilder.() -> Unit)

Specifies that the system/developer message must contain a dynamically constructed string. The string can be built using a lambda with a StringBuilder receiver.

abstract fun systemMessageContains(substring: String)

Specifies that the system/developer message must contain the provided string.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
inline fun userMessageContains(builderAction: StringBuilder.() -> Unit)

Specifies a condition that the user's message must contain a dynamically constructed string. The string can be built using a lambda with a StringBuilder receiver.

abstract fun userMessageContains(substring: String)

Specifies that the user's message must contain the provided substring.