OpenaiChatCompletionsBuildingStep

OpenaiChatCompletionsBuildingStep is a specialized implementation of AbstractBuildingStep intended for constructing and managing chat completion responses as part of the OpenAI 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 OpenAI's chat completion API.

Author

Konstantin Pavlov

Parameters

mokksy

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

buildingStep

The underlying building step for managing and supporting response configurations for OpenAI Chat Completion requests.

See also

Constructors

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

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 OpenaiChatResponseSpecification.() -> Unit)
Link copied to clipboard
open infix fun <R : Any> respondsError(block: Consumer<ResponseDefinitionBuilder<ChatCompletionRequest, R>>)
open infix fun <T : Any> respondsError(block: suspend ResponseDefinitionBuilder<ChatCompletionRequest, T>.() -> Unit)
open fun <T : Any> respondsError(responseType: KClass<T>, block: suspend ResponseDefinitionBuilder<ChatCompletionRequest, T>.() -> Unit)
Link copied to clipboard

Configures a streaming response for a chat completions request by applying the provided specifications.