Documentation
Table of Contents

Namespace IntentSharp

Classes

AIRequestOptions

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

IntentClient

The one entry point. Holds the providers, options, memory, cache and rate limiter for an application. It sends a value and an intent to a model you choose, checks the reply against the result type and your rules, retries with the findings within the limits you set, and returns a typed result. Create it with IntentClientBuilder or services.AddIntentSharp(...). There is no static default instance.

IntentClientBuilder

Fluent construction of an IntentClient.

var client = new IntentClientBuilder()
    .UseAnthropic(Environment.GetEnvironmentVariable("ANTHROPIC_API_KEY")!)
    .UseOpenAIAsFallback(Environment.GetEnvironmentVariable("OPENAI_API_KEY")!)
    .WithMemory(new SqliteSemanticMemory("intentsharp-memory.db"))
    .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 scope is AsyncLocal<T> state: it flows with awaits and tasks started inside it, is invisible to other requests and threads, and ends when disposed. A task started inside the scope that is still running after the scope was disposed no longer sees the client. There is still no process-wide default client.

IntentExample

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

IntentSharpJson

The JSON settings IntentSharp uses for values.

Enums

JudgeMode

When the judge reviews a result before it is returned.