< Summary

Information
Class: Elsa.AI.Host.Tools.GroundingToolBase
Assembly: Elsa.AI.Host
File(s): /home/runner/work/elsa-core/elsa-core/src/modules/Elsa.AI.Host/Tools/GroundingToolBase.cs
Line coverage
100%
Covered lines: 31
Uncovered lines: 0
Coverable lines: 31
Total lines: 56
Line coverage: 100%
Branch coverage
79%
Covered branches: 19
Total branches: 24
Branch coverage: 79.1%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity Line coverage
Dispose()100%11100%
GetString(...)100%88100%
GetInt(...)50%66100%
GetBool(...)100%66100%
GetObject(...)50%44100%
ReadOnlyDefinition(...)100%11100%
ProposalDefinition(...)100%11100%

File(s)

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

#LineLine coverage
 1using Elsa.AI.Abstractions.Contracts;
 2using Elsa.AI.Abstractions.Models;
 3
 4namespace Elsa.AI.Host.Tools;
 5
 6public abstract class GroundingToolBase : IAITool
 7{
 8    public abstract AIToolDefinition Definition { get; }
 9    public abstract ValueTask<AIToolResult> ExecuteAsync(AIToolExecutionContext context, CancellationToken cancellationT
 10
 11    public void Dispose()
 12    {
 67613    }
 14
 15    protected static string? GetString(JsonObject arguments, string name) =>
 2616        arguments.TryGetPropertyValue(name, out var node) && node is JsonValue value && value.TryGetValue<string>(out va
 2617            ? result
 2618            : null;
 19
 20    protected static int? GetInt(JsonObject arguments, string name) =>
 321        arguments.TryGetPropertyValue(name, out var node) && node is JsonValue value && value.TryGetValue<int>(out var r
 322            ? result
 323            : null;
 24
 25    protected static bool? GetBool(JsonObject arguments, string name) =>
 426        arguments.TryGetPropertyValue(name, out var node) && node is JsonValue value && value.TryGetValue<bool>(out var 
 427            ? result
 428            : null;
 29
 30    protected static JsonObject? GetObject(JsonObject arguments, string name) =>
 131        arguments.TryGetPropertyValue(name, out var node) && node is JsonObject jsonObject
 132            ? jsonObject
 133            : null;
 34
 35    protected static AIToolDefinition ReadOnlyDefinition(string name, string displayName, string description, JsonObject
 58636        new()
 58637        {
 58638            Name = name,
 58639            DisplayName = displayName,
 58640            Description = description,
 58641            Schema = schema,
 58642            Mutability = AIToolMutability.ReadOnly,
 58643            DangerLevel = AIToolDangerLevel.Low
 58644        };
 45
 46    protected static AIToolDefinition ProposalDefinition(string name, string displayName, string description, JsonObject
 9047        new()
 9048        {
 9049            Name = name,
 9050            DisplayName = displayName,
 9051            Description = description,
 9052            Schema = schema,
 9053            Mutability = AIToolMutability.Proposal,
 9054            DangerLevel = AIToolDangerLevel.Medium
 9055        };
 56}