Documentation
Table of Contents

Namespace IntentSharp

Classes

AIConstraintException

A constraint stopped the operation: a limit such as the model-call ceiling (MaxModelCalls), declared in code, by an AIConstraintAttribute or by a setting. IntentClient catches it and ends the request with a failed result that carries one Constraint issue with its message.

AIRequestOptions

Per-request overrides; unset values come from IntentClientOptions. A value that is set must be in range (MaxAttempts, MaxOutputTokens, MaxModelCalls and MaxInputChars at least 1, Temperature 0 to 2, Timeout greater than zero and at most about 49.7 days), or TransformAsync<T>(object?, string, AIRequestOptions?, CancellationToken) throws ArgumentOutOfRangeException before any model call.

IntentClient

The client an application makes model calls through. It holds the providers, options, memory, cache and rate limiter, and returns typed results that passed their checks, or failed results that say why. Create it with IntentClientBuilder or services.AddIntentSharp(...); there is no static default instance.

IntentClientBuilder

Fluent construction of an IntentClient. The providers come from a provider file in a document store, from providers added in code, or both: the file's roles may name the providers added in code.

var client = new IntentClientBuilder()
    .UseProviderOptions(store)                 // intentsharp.providers.json: providers, roles, aliases
    .UseProvider(myProvider)                   // a provider of your own, reachable by name in the roles
    .Build();
IntentClientOptions

Client-wide settings. Set once when building the IntentClient.

IntentClientScope

Makes an IntentClient ambient for the current async flow, so values can be asked to do things without passing the client at every call site:

using var scope = client.AsAmbient();
var order = await email.AIAsync<PurchaseRequest>("Extract the purchase request.");

The client flows with awaits and with tasks started inside the scope, is invisible to other requests and threads, and stops being ambient when the scope is disposed, also for a task that outlives it.

IntentExample

A worked example for the model: an input rendered as text and the exact output expected for it.

IntentSharpException

Base exception for IntentSharp. Every public exception type of the library derives from it, so one catch (IntentSharpException) with using IntentSharp; catches them all.

IntentSharpJson

The JSON settings IntentSharp uses for values.

Enums

CollectionPartition

How a collection call treats a collection that is longer than the request's input limit.

JudgeMode

When the judge reviews a result before it is returned.

JudgeStrictness

What the judge does with a reply it cannot read as a verdict. A reply its provider marks as a refusal is not governed by it: a judge refusal fails the attempt under either value.