Documentation
Table of Contents

Method WithGuardrails

Namespace
IntentSharp
Assembly
IntentSharp.dll

WithGuardrails(GuardrailOptions)

Makes the client check guardrails: the rule sets of Source, applied through CheckAsync(GuardrailCheckpoint, SubjectValues, IReadOnlyList<string>, CancellationToken) and at the checkpoints the client raises itself. Call it once per builder.

public IntentClientBuilder WithGuardrails(GuardrailOptions options)

Parameters

options GuardrailOptions

The guardrail options.

Returns

IntentClientBuilder

Remarks

Build() reads the options and refuses to build a client that could not check them: it throws InvalidOperationException when a set in Sets is not loaded in the source (the message names the loaded sets) or there is no source to load it from, and ArgumentException when a declared subject, setting or kind is invalid or declared twice, or a code setting names no declared setting or holds a value the setting cannot take.

Exceptions

ArgumentNullException

options is null.

InvalidOperationException

Guardrails were already set on this builder.

WithGuardrails(IGuardrailSource, params string[])

Makes the client check guardrails from source, applying sets when a check names none. The same as WithGuardrails(GuardrailOptions) with those two options, and called once per builder likewise.

public IntentClientBuilder WithGuardrails(IGuardrailSource source, params string[] sets)

Parameters

source IGuardrailSource

The source of the rule sets.

sets string[]

The default sets; each must be loaded in the source when the client is built.

Returns

IntentClientBuilder

Exceptions

ArgumentNullException

source or sets is null.

InvalidOperationException

Guardrails were already set on this builder.