Table of Contents

Class NetworkBuilder

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

Fluent builder for constructing ImageJobNetworkParams instances.

public sealed record NetworkBuilder : IEquatable<NetworkBuilder>
Inheritance
NetworkBuilder
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

NetworkBuilder(NetworkType?, decimal?, string?, decimal?)

Fluent builder for constructing ImageJobNetworkParams instances.

public NetworkBuilder(NetworkType? Type = null, decimal? Strength = null, string? TriggerWord = null, decimal? ClipStrength = null)

Parameters

Type NetworkType?
Strength decimal?
TriggerWord string
ClipStrength decimal?

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

ClipStrength

public decimal? ClipStrength { get; init; }

Property Value

decimal?

Strength

public decimal? Strength { get; init; }

Property Value

decimal?

TriggerWord

public string? TriggerWord { get; init; }

Property Value

string

Type

public NetworkType? Type { get; init; }

Property Value

NetworkType?

Methods

Build()

Builds the ImageJobNetworkParams instance.

public ImageJobNetworkParams Build()

Returns

ImageJobNetworkParams

The configured ImageJobNetworkParams.

Exceptions

InvalidOperationException

Thrown when required properties are missing.

Create()

Creates a new NetworkBuilder instance.

public static NetworkBuilder Create()

Returns

NetworkBuilder

A new builder instance.

WithClipStrength(decimal)

Sets the CLIP strength for text encoder influence.

public NetworkBuilder WithClipStrength(decimal clipStrength)

Parameters

clipStrength decimal

The CLIP strength. Range: 0.0-2.0.

Returns

NetworkBuilder

A new builder instance with the updated CLIP strength.

WithStrength(decimal)

Sets the strength/weight of the network.

public NetworkBuilder WithStrength(decimal strength)

Parameters

strength decimal

The strength value. Typically 0.0-2.0, default: 1.0.

Returns

NetworkBuilder

A new builder instance with the updated strength.

WithTriggerWord(string)

Sets the trigger words for this network.

public NetworkBuilder WithTriggerWord(string triggerWord)

Parameters

triggerWord string

The trigger word(s) to activate the network.

Returns

NetworkBuilder

A new builder instance with the updated trigger word.

WithType(NetworkType)

Sets the network type.

public NetworkBuilder WithType(NetworkType type)

Parameters

type NetworkType

The network type (LoRA, embedding, etc.). Required.

Returns

NetworkBuilder

A new builder instance with the updated type.