< Summary

Information
Class: Intentum.AI.SystemOne.SystemOneEngines
Assembly: Intentum.AI.SystemOne
File(s): /home/runner/work/Intentum/Intentum/src/Intentum.AI.SystemOne/SystemOneEngines.cs
Line coverage
100%
Covered lines: 40
Uncovered lines: 0
Coverable lines: 40
Total lines: 97
Line coverage: 100%
Branch coverage
100%
Covered branches: 52
Total branches: 52
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.cctor()100%11100%
Demo(...)100%11100%
Jev(...)100%11100%
Kev(...)100%11100%
TinyJev(...)100%11100%
Laya(...)100%11100%
OpenDecision(...)100%11100%
Decision10(...)100%11100%
OpenJev(...)100%11100%
NanoJev(...)100%11100%
OpenJevPro(...)100%11100%
Foq(...)100%11100%
FromName(...)100%5252100%

File(s)

/home/runner/work/Intentum/Intentum/src/Intentum.AI.SystemOne/SystemOneEngines.cs

#LineLine coverage
 1namespace Intentum.AI.SystemOne;
 2
 3/// <summary>Presets for known System One compatible engines (Jev wire protocol).</summary>
 4public static class SystemOneEngines
 5{
 6    /// <summary>Known engine names accepted by <see cref="FromName"/>.</summary>
 27    public static IReadOnlyList<string> Names { get; } =
 18        ["demo", "jev", "kev", "tinyjev", "laya", "opendecision", "decision10", "openjev", "nanojev", "openjevpro", "foq
 9
 10    /// <summary>
 11    /// In-process demo engine hosted by the consuming app itself (POST /v1/systemone).
 12    /// No API key, no model download; deterministic keyword-based decisions.
 13    /// <paramref name="baseUrl"/> is resolved at request time (app origin) by the host.
 14    /// The host must assign a <c>BaseUrl</c> before constructing a client or model; <see cref="SystemOneOptions.Validat
 15    /// </summary>
 16    public static SystemOneOptions Demo(string baseUrl = "") =>
 217        new() { BaseUrl = baseUrl, Engine = "demo", Model = "demo-latest" };
 18
 19    /// <summary>
 20    /// Jev (TypeSafe AI): hosted System One model at <c>https://api.typesafe.ai</c>.
 21    /// Requires an API key from <c>console.typesafe.ai/keys</c>; picked up from
 22    /// <c>TYPESAFE_API_KEY</c> unless overridden via <c>ApiKey</c>.
 23    /// </summary>
 24    public static SystemOneOptions Jev(string baseUrl = "https://api.typesafe.ai") =>
 225        new()
 226        {
 227            BaseUrl = baseUrl,
 228            Engine = "jev",
 229            Model = "jev-latest",
 230            ApiKey = Environment.GetEnvironmentVariable("TYPESAFE_API_KEY"),
 231        };
 32
 33    /// <summary>Kev (jaredpalmer/kev): local server, default port 8009.</summary>
 34    public static SystemOneOptions Kev(string baseUrl = "http://127.0.0.1:8009") =>
 135        new() { BaseUrl = baseUrl, Engine = "kev", Model = "kev-latest" };
 36
 37    /// <summary>TinyJev (ankit-aglawe/tinyjev): <c>tinyjev serve</c>, default port 8077.</summary>
 38    public static SystemOneOptions TinyJev(string baseUrl = "http://127.0.0.1:8077") =>
 139        new() { BaseUrl = baseUrl, Engine = "tinyjev" };
 40
 41    /// <summary>Laya (NandhaKishorM/laya): <c>laya-serve</c>, default port 8000.</summary>
 42    public static SystemOneOptions Laya(string baseUrl = "http://127.0.0.1:8000") =>
 143        new() { BaseUrl = baseUrl, Engine = "laya" };
 44
 45    /// <summary>OpenDecision: local System One compatible server.</summary>
 46    public static SystemOneOptions OpenDecision(string baseUrl = "http://127.0.0.1:8000") =>
 147        new() { BaseUrl = baseUrl, Engine = "opendecision" };
 48
 49    /// <summary>Decision 1.0: System One compatible server.</summary>
 50    public static SystemOneOptions Decision10(string baseUrl = "http://127.0.0.1:8000") =>
 151        new() { BaseUrl = baseUrl, Engine = "decision10" };
 52
 53    /// <summary>Open-Jev: HTTP server speaking the TypeSafe System One API.</summary>
 54    public static SystemOneOptions OpenJev(string baseUrl = "http://127.0.0.1:8000") =>
 155        new() { BaseUrl = baseUrl, Engine = "openjev" };
 56
 57    /// <summary>NanoJev: local System One compatible server.</summary>
 58    public static SystemOneOptions NanoJev(string baseUrl = "http://127.0.0.1:8000") =>
 159        new() { BaseUrl = baseUrl, Engine = "nanojev" };
 60
 61    /// <summary>OpenJevPro / openjev-sglang: System One API over SGLang.</summary>
 62    public static SystemOneOptions OpenJevPro(string baseUrl = "http://127.0.0.1:8000") =>
 163        new() { BaseUrl = baseUrl, Engine = "openjevpro" };
 64
 65    /// <summary>Foq: System One compatible server.</summary>
 66    public static SystemOneOptions Foq(string baseUrl = "http://127.0.0.1:8000") =>
 167        new() { BaseUrl = baseUrl, Engine = "foq" };
 68
 69    /// <summary>Resolves a preset by engine name (case-insensitive).</summary>
 70    /// <param name="name">Engine name; see <see cref="Names"/>.</param>
 71    /// <param name="baseUrl">Optional base URL override.</param>
 72    /// <exception cref="ArgumentException">Thrown when the engine name is unknown.</exception>
 73    public static SystemOneOptions FromName(string name, string? baseUrl = null)
 1374    {
 1375        ArgumentException.ThrowIfNullOrWhiteSpace(name);
 76
 1377        var options = name.Trim().ToLowerInvariant() switch
 1378        {
 279            "demo" => Demo(),
 180            "jev" => Jev(),
 181            "kev" => Kev(),
 182            "tinyjev" => TinyJev(),
 183            "laya" => Laya(),
 184            "opendecision" => OpenDecision(),
 185            "decision10" => Decision10(),
 186            "openjev" => OpenJev(),
 187            "nanojev" => NanoJev(),
 188            "openjevpro" => OpenJevPro(),
 189            "foq" => Foq(),
 190            _ => throw new ArgumentException(
 191                $"Unknown System One engine '{name}'. Known engines: {string.Join(", ", Names)}.",
 192                nameof(name)),
 1393        };
 94
 1295        return baseUrl is null ? options : options with { BaseUrl = baseUrl };
 1296    }
 97}