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
optionsGuardrailOptionsThe guardrail options.
Returns
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
optionsis 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
sourceIGuardrailSourceThe source of the rule sets.
setsstring[]The default sets; each must be loaded in the source when the client is built.
Returns
Exceptions
- ArgumentNullException
sourceorsetsis null.- InvalidOperationException
Guardrails were already set on this builder.