Table of Contents

Class ImageJobParamsBuilder

Namespace
CivitaiSharp.Sdk.Request
Assembly
CivitaiSharp.Sdk.dll

Fluent builder for constructing ImageJobParams instances.

public sealed record ImageJobParamsBuilder : IEquatable<ImageJobParamsBuilder>
Inheritance
ImageJobParamsBuilder
Implements
Inherited Members

Remarks

This builder follows an immutable design pattern. Each method returns a new instance with the updated configuration, making it thread-safe and cacheable.

Constructors

ImageJobParamsBuilder(string?, string?, Scheduler?, int?, decimal?, int?, int?, long?, int?)

Fluent builder for constructing ImageJobParams instances.

public ImageJobParamsBuilder(string? PositivePrompt = null, string? NegativePrompt = null, Scheduler? Scheduler = null, int? Steps = null, decimal? ConfigurationScale = null, int? Width = null, int? Height = null, long? Seed = null, int? ClipSkip = null)

Parameters

PositivePrompt string
NegativePrompt string
Scheduler Scheduler?
Steps int?
ConfigurationScale decimal?
Width int?
Height int?
Seed long?
ClipSkip int?

Remarks

This builder follows an immutable design pattern. Each method returns a new instance with the updated configuration, making it thread-safe and cacheable.

Properties

ClipSkip

public int? ClipSkip { get; init; }

Property Value

int?

ConfigurationScale

public decimal? ConfigurationScale { get; init; }

Property Value

decimal?

Height

public int? Height { get; init; }

Property Value

int?

NegativePrompt

public string? NegativePrompt { get; init; }

Property Value

string

PositivePrompt

public string? PositivePrompt { get; init; }

Property Value

string

Scheduler

public Scheduler? Scheduler { get; init; }

Property Value

Scheduler?

Seed

public long? Seed { get; init; }

Property Value

long?

Steps

public int? Steps { get; init; }

Property Value

int?

Width

public int? Width { get; init; }

Property Value

int?

Methods

Build()

Builds the ImageJobParams instance.

public ImageJobParams Build()

Returns

ImageJobParams

The configured ImageJobParams.

Exceptions

InvalidOperationException

Thrown when required properties are missing.

Create()

Creates a new ImageJobParamsBuilder instance.

public static ImageJobParamsBuilder Create()

Returns

ImageJobParamsBuilder

A new builder instance.

WithClipSkip(int)

Sets the number of CLIP layers to skip.

public ImageJobParamsBuilder WithClipSkip(int clipSkip)

Parameters

clipSkip int

The number of layers to skip. Range: 1-12.

Returns

ImageJobParamsBuilder

A new builder instance with the updated CLIP skip.

Remarks

A value of 2 is commonly used for anime/Pony models.

WithConfigurationScale(decimal)

Sets the classifier-free guidance scale.

public ImageJobParamsBuilder WithConfigurationScale(decimal configurationScale)

Parameters

configurationScale decimal

The configuration scale. Range: 1-30, default: 7.0.

Returns

ImageJobParamsBuilder

A new builder instance with the updated configuration scale.

Remarks

Higher values make the image more closely match the prompt but may reduce quality.

WithDimensions(int, int)

Sets the image dimensions.

public ImageJobParamsBuilder WithDimensions(int width, int height)

Parameters

width int

The width in pixels. Must be a multiple of 8. Range: 64-2048.

height int

The height in pixels. Must be a multiple of 8. Range: 64-2048.

Returns

ImageJobParamsBuilder

A new builder instance with the updated dimensions.

WithHeight(int)

Sets the image height.

public ImageJobParamsBuilder WithHeight(int height)

Parameters

height int

The height in pixels. Must be a multiple of 8. Range: 64-2048.

Returns

ImageJobParamsBuilder

A new builder instance with the updated height.

WithNegativePrompt(string)

Sets the negative prompt describing what to avoid in the generated image.

public ImageJobParamsBuilder WithNegativePrompt(string negativePrompt)

Parameters

negativePrompt string

The negative prompt text.

Returns

ImageJobParamsBuilder

A new builder instance with the updated negative prompt.

WithPositivePrompt(string)

Sets the positive prompt for image generation.

public ImageJobParamsBuilder WithPositivePrompt(string positivePrompt)

Parameters

positivePrompt string

The prompt text describing what to generate. Required.

Returns

ImageJobParamsBuilder

A new builder instance with the updated positive prompt.

WithScheduler(Scheduler)

Sets the sampling algorithm to use.

public ImageJobParamsBuilder WithScheduler(Scheduler scheduler)

Parameters

scheduler Scheduler

The scheduler/sampler.

Returns

ImageJobParamsBuilder

A new builder instance with the updated scheduler.

WithSeed(long)

Sets the random seed for reproducible generation.

public ImageJobParamsBuilder WithSeed(long seed)

Parameters

seed long

The seed value.

Returns

ImageJobParamsBuilder

A new builder instance with the updated seed.

WithSteps(int)

Sets the number of sampling steps.

public ImageJobParamsBuilder WithSteps(int steps)

Parameters

steps int

The step count. Range: 1-100, default: 20.

Returns

ImageJobParamsBuilder

A new builder instance with the updated steps.

WithWidth(int)

Sets the image width.

public ImageJobParamsBuilder WithWidth(int width)

Parameters

width int

The width in pixels. Must be a multiple of 8. Range: 64-2048.

Returns

ImageJobParamsBuilder

A new builder instance with the updated width.