Documentation
Table of Contents

Class GuardrailOptions

Namespace
IntentSharp.Guardrails
Assembly
IntentSharp.dll

How a client checks guardrails: the source of the rule sets, the sets it applies by default, and what it declares beyond the library's core subjects, settings and kinds. Pass it to WithGuardrails(GuardrailOptions), or register it in the service collection for a client built by AddIntentSharp. The client reads these options when it is built; a later change to them does not reach a built client.

public sealed class GuardrailOptions
Inheritance
object
GuardrailOptions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.ReferenceEquals(object, object)
object.ToString()
Extension Methods

Constructors

GuardrailOptions()

Creates options with no source, no default sets and nothing declared beyond the core.

Properties

CodeSettings

The code layer of the settings, by setting name: what a setting takes when no file sets it. A file's value beats it. Each name must be a declared setting and each value one the setting takes, or the client is not built.

CoreSubjects

The subjects the library declares: request., reply., tool., embedding.provider, data. and environment.*. data.entities and data.operations are required security subjects whose fail-closed value allows nothing. A new list of new descriptors on each call.

Kinds

Custom kinds, each with a name that contains a dot, beside the built-in kinds.

OnBuild

Called by Build() with the settings and subjects declared on the builder with AddSetting(SettingDescriptor) and AddSubject(SubjectDescriptor), whatever the order of those calls and WithGuardrails(GuardrailOptions). The options it returns are the ones the client is built with, and their own OnBuild is not called. It lets a source that reads rule files learn the builder's declarations, as the Guardrails package's WithGuardrailFiles does. Null, the default, builds the client with these options as they are.

Sets

The sets the client applies when a check names none, and at the checkpoints the client raises itself. Each must be loaded in the source when the client is built.

Settings

Settings declared beyond the core settings; the same as calling AddSetting(SettingDescriptor) for each.

Shadows

Versions of rule documents to run side by side with the running versions, typically candidates saved with Activate false; empty, the default, runs none.

Source

The source of the rule sets; null for none, so every check that names a set is refused. Registered in the service collection with no source, the options take a source registered there.

Subjects

Subjects declared beyond the core subjects, such as those of an application's own checkpoint.