Masterly.FluentRegex.AI
3.1.0
See the version list below for details.
dotnet add package Masterly.FluentRegex.AI --version 3.1.0
NuGet\Install-Package Masterly.FluentRegex.AI -Version 3.1.0
<PackageReference Include="Masterly.FluentRegex.AI" Version="3.1.0" />
<PackageVersion Include="Masterly.FluentRegex.AI" Version="3.1.0" />
<PackageReference Include="Masterly.FluentRegex.AI" />
paket add Masterly.FluentRegex.AI --version 3.1.0
#r "nuget: Masterly.FluentRegex.AI, 3.1.0"
#:package Masterly.FluentRegex.AI@3.1.0
#addin nuget:?package=Masterly.FluentRegex.AI&version=3.1.0
#tool nuget:?package=Masterly.FluentRegex.AI&version=3.1.0
Masterly.FluentRegex.AI
Draft Masterly.FluentRegex patterns from plain language with Claude, and verify every draft locally before you see it.
using Masterly.FluentRegex;
using Masterly.FluentRegex.AI;
PatternAssistant assistant = new PatternAssistant(
httpClient, // from IHttpClientFactory; not disposed by the assistant
new PatternAssistantOptions { ApiKey = Environment.GetEnvironmentVariable("ANTHROPIC_API_KEY")! });
PatternDraft draft = await assistant.DraftAsync(
"a five digit US ZIP code, optionally followed by a dash and four digits",
shouldMatch: new[] { "12345", "12345-6789" },
shouldNotMatch: new[] { "1234", "123456", "12345-678" });
if (draft.Passed)
{
Pattern zip = draft.Pattern!;
}
else
{
Console.WriteLine(draft); // the best attempt and exactly which checks failed
}
Each draft must pass, on your machine: valid .NET syntax, no findings from Pattern.AnalyzeSafety() (ReDoS),
every shouldMatch string matched in full, and no shouldNotMatch string matched. Failures are sent back to
the model as precise feedback and retried up to MaxAttempts (default 3). If no draft passes you get the best
attempt with Passed == false; a draft is never reported as passing unless it did.
- Calls the Claude Messages API directly with
HttpClientand source-generatedSystem.Text.Json; no SDK dependency, AOT and trim safe. - Defaults: model
claude-opus-5-5, effortmedium, structured JSON output, server-side refusal fallback. - HTTP failures throw
PatternAssistantExceptionwithStatusCode,ErrorType,RequestId,RetryAfterandIsTransient. The assistant does not retry HTTP errors itself; add a resilience handler to theHttpClientif you want that. The API key never appears in messages orToString().
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Masterly.FluentRegex (>= 3.1.0)
-
net8.0
- Masterly.FluentRegex (>= 3.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.