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
TypeNetworkType?Strengthdecimal?TriggerWordstringClipStrengthdecimal?
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
Strength
public decimal? Strength { get; init; }
Property Value
TriggerWord
public string? TriggerWord { get; init; }
Property Value
Type
public NetworkType? Type { get; init; }
Property Value
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
clipStrengthdecimalThe 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
strengthdecimalThe 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
triggerWordstringThe 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
typeNetworkTypeThe network type (LoRA, embedding, etc.). Required.
Returns
- NetworkBuilder
A new builder instance with the updated type.