OllamaChatBuildingStep

class OllamaChatBuildingStep(mokksy: MokksyServer, buildingStep: BuildingStep<ChatRequest>) : AbstractBuildingStep<ChatRequest, OllamaChatResponseSpecification> (source)

OllamaChatBuildingStep is a specialized implementation of AbstractBuildingStep intended for constructing and managing chat completion responses as part of the Ollama Mock Server setup.

The class provides features to create both single-blocked responses and streaming responses for simulated chat completions using mock data. It extends the functionality of AbstractBuildingStep by applying specific logic for generating fake responses compliant with Ollama's chat completion API.

Parameters

mokksy

The MokksyServer instance used for handling mock request and response lifecycle.

buildingStep

The underlying BuildingStep for managing and supporting response configurations for Ollama Chat Completion requests.

Constructors

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

Initializes the building step with the provided mock server instance and a higher-level building step for configuring chat completion responses.

Functions

Link copied to clipboard

open infix override fun responds(block: suspend OllamaChatResponseSpecification.() -> Unit)

Configures a single, complete chat response for the mock Ollama chat completion API.

Link copied to clipboard
open infix fun <R : Any> respondsError(block: Consumer<ResponseDefinitionBuilder<ChatRequest, R>>)
open infix fun <T : Any> respondsError(block: suspend ResponseDefinitionBuilder<ChatRequest, T>.() -> Unit)
open fun <T : Any> respondsError(responseType: KClass<T>, block: suspend ResponseDefinitionBuilder<ChatRequest, T>.() -> Unit)
Link copied to clipboard

Configures a streaming chat completion response using a user-defined specification block.