AbstractMockLlm

abstract class AbstractMockLlm(port: Int = 0, configuration: ServerConfiguration, applicationConfigurer: Application.() -> Unit? = {})(source)

Abstract class representing a mock Language Model (LLM) server. This serves as a base class for creating a mock server used for testing Language Model interactions. It is built upon the MokksyServer framework for configuring and managing mock servers.

Author

Konstantin Pavlov

Parameters

port

The port number to use for the server. Defaults to 0, which allows the system to select an available port automatically.

configuration

The ServerConfiguration instance providing details such as verbosity, server name, and content negotiation settings.

applicationConfigurer

An optional function to further customize the server application configuration. Default is an empty configuration.

Constructors

Link copied to clipboard
constructor(port: Int = 0, configuration: ServerConfiguration, applicationConfigurer: Application.() -> Unit? = {})

Initializes the mock server with the specified configuration.

Functions

Link copied to clipboard
open fun baseUrl(): String

Provides the base URL of the mock server to be provided to a language model client.

Link copied to clipboard
fun port(): Int

Returns the port number on which the mock server is running.

Link copied to clipboard

Resets the match state of all stubs and clears the request journal.

Link copied to clipboard
open fun shutdown(gracePeriodMillis: Long = 500, timeoutMillis: Long = 1000)

Stops the mock LLM server and releases its resources with the specified grace period and timeout.

Link copied to clipboard

Verifies that all requests received by the mock server were expected. Throws an exception if any unexpected requests were made.

Link copied to clipboard