< Summary

Information
Class: Elsa.AI.Host.Tools.GroundingToolSchemas
Assembly: Elsa.AI.Host
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.AI.Host/Tools/GroundingToolSchemas.cs
Line coverage
84%
Covered lines: 28
Uncovered lines: 5
Coverable lines: 33
Total lines: 52
Line coverage: 84.8%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Empty()100%210%
WithProperties(...)100%22100%
String(...)100%11100%
Integer(...)100%11100%
Boolean(...)100%11100%
Object(...)100%11100%

File(s)

/home/runner/work/elsa-core/elsa-core/src/modules/Elsa.AI.Host/Tools/GroundingToolSchemas.cs

#LineLine coverage
 1namespace Elsa.AI.Host.Tools;
 2
 3internal static class GroundingToolSchemas
 4{
 5    public static JsonObject Empty() =>
 06        new()
 07        {
 08            ["type"] = "object",
 09            ["properties"] = new JsonObject()
 010        };
 11
 12    public static JsonObject WithProperties(params (string Name, JsonObject Schema)[] properties)
 13    {
 67614        var propertyObject = new JsonObject();
 649015        foreach (var (name, schema) in properties)
 256916            propertyObject[name] = schema;
 17
 67618        return new JsonObject
 67619        {
 67620            ["type"] = "object",
 67621            ["properties"] = propertyObject
 67622        };
 23    }
 24
 25    public static JsonObject String(string description) =>
 202826        new()
 202827        {
 202828            ["type"] = "string",
 202829            ["description"] = description
 202830        };
 31
 32    public static JsonObject Integer(string description) =>
 22633        new()
 22634        {
 22635            ["type"] = "integer",
 22636            ["description"] = description
 22637        };
 38
 39    public static JsonObject Boolean(string description) =>
 18040        new()
 18041        {
 18042            ["type"] = "boolean",
 18043            ["description"] = description
 18044        };
 45
 46    public static JsonObject Object(string description) =>
 13547        new()
 13548        {
 13549            ["type"] = "object",
 13550            ["description"] = description
 13551        };
 52}