Skip to main content
For the complete documentation index for agents and LLMs, see llms.txt.

SleeperGenerator

Mock a Generator component for benchmarks and load testing. This component sleeps for a configurable duration and returns a placeholder answer.

Key Features​

  • Simulates Generator latency without calling an external LLM API.
  • Sleep duration follows a normal distribution around a configurable mean.
  • Returns a configurable placeholder answer and metadata.
  • Useful for pipeline performance testing and benchmarking.

Configuration​

  1. Drag the SleeperGenerator component onto the canvas from the Component Library.
  2. Click the component to open the configuration panel.
  3. Set mean_sleep_in_seconds, sleep_scale, answer, and optional meta values.

Connections​

SleeperGenerator accepts a prompt string as input. It outputs replies — a list containing the placeholder answer — and meta — optional metadata.

Connect a PromptBuilder to the prompt input. Connect the replies output to DeepsetAnswerBuilder or a pipeline output, the same way you would connect a real Generator.

Usage Examples​

Basic Configuration​

SleeperGenerator:
type: deepset_cloud_custom_nodes.generators.sleeper.SleeperGenerator
init_parameters:
mean_sleep_in_seconds: 5
sleep_scale: 1.0
answer: Placeholder response
meta: {}

Using the Component in a Pipeline​

This example replaces a real Generator with SleeperGenerator for load testing:

# haystack-pipeline
components:
sleeper:
type: deepset_cloud_custom_nodes.generators.sleeper.SleeperGenerator
init_parameters:
mean_sleep_in_seconds: 5
sleep_scale: 1.0
answer: Placeholder response
meta: {}

inputs:
prompt:
- sleeper.prompt

outputs:
replies: sleeper.replies

Parameters​

Inputs​

ParameterTypeDefaultDescription
promptstrPrompt input. The component does not use this value but accepts it to match the Generator interface.
generation_kwargsOptional[Dict[str, Any]]NoneGeneration kwargs. The component does not use this value but accepts it to match the Generator interface.

Outputs​

ParameterTypeDefaultDescription
repliesList[str]List containing the placeholder answer.
metaList[Dict[str, Any]]Metadata returned with the answer.

Init Parameters​

These are the parameters you can configure in Pipeline Builder:

ParameterTypeDefaultDescription
mean_sleep_in_secondsfloat10Mean sleep duration in seconds before returning the answer.
sleep_scalefloat1.0Standard deviation for the sleep duration.
answerstrPlaceholderText returned as the Generator reply.
metaOptional[Dict[str, Any]]NoneMetadata returned with the answer.

Run Method Parameters​

These are the parameters you can configure for the component's run() method. This means you can pass these parameters at query time through the API, in Playground, or when running a job. For details, see Modify Pipeline Parameters at Query Time.

ParameterTypeDefaultDescription
promptstrPrompt input.
generation_kwargsOptional[Dict[str, Any]]NoneGeneration kwargs.