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
PositivePromptstringNegativePromptstringSchedulerScheduler?Stepsint?ConfigurationScaledecimal?Widthint?Heightint?Seedlong?ClipSkipint?
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
Height
public int? Height { get; init; }
Property Value
- int?
NegativePrompt
public string? NegativePrompt { get; init; }
Property Value
PositivePrompt
public string? PositivePrompt { get; init; }
Property Value
Scheduler
public Scheduler? Scheduler { get; init; }
Property Value
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
clipSkipintThe 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
configurationScaledecimalThe 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
widthintThe width in pixels. Must be a multiple of 8. Range: 64-2048.
heightintThe 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
heightintThe 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
negativePromptstringThe 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
positivePromptstringThe 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
schedulerSchedulerThe 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
seedlongThe 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
stepsintThe 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
widthintThe width in pixels. Must be a multiple of 8. Range: 64-2048.
Returns
- ImageJobParamsBuilder
A new builder instance with the updated width.