< Summary

Information
Class: Intentum.AI.Models.CatalogIntentModel
Assembly: Intentum.AI
File(s): /home/runner/work/Intentum/Intentum/src/Intentum.AI/Models/CatalogIntentModel.cs
Line coverage
100%
Covered lines: 10
Uncovered lines: 0
Coverable lines: 10
Total lines: 32
Line coverage: 100%
Branch coverage
100%
Covered branches: 4
Total branches: 4
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%44100%
Infer(...)100%11100%

File(s)

/home/runner/work/Intentum/Intentum/src/Intentum.AI/Models/CatalogIntentModel.cs

#LineLine coverage
 1using Intentum.AI.Catalog;
 2using Intentum.AI.Embeddings;
 3using Intentum.Core.Behavior;
 4using Intentum.Core.Contracts;
 5using Intentum.Core.Intents;
 6using Intentum.Core.Pipeline;
 7
 8namespace Intentum.AI.Models;
 9
 10/// <summary>
 11/// Intent model that classifies behavior against a catalog of known intents
 12/// using embedding cosine similarity (nearest neighbor classification).
 13/// Returns the actual intent name from the catalog instead of a generic "AI-Inferred-Intent".
 14/// </summary>
 15public sealed class CatalogIntentModel : IIntentModel
 16{
 17    private readonly IntentResolutionPipeline _pipeline;
 18
 419    public CatalogIntentModel(
 420        IIntentEmbeddingProvider embeddingProvider,
 421        IntentCatalog catalog)
 422    {
 423        var step = new CatalogInferenceStep(
 424            embeddingProvider ?? throw new ArgumentNullException(nameof(embeddingProvider)),
 425            catalog ?? throw new ArgumentNullException(nameof(catalog)));
 226        _pipeline = new IntentResolutionPipeline(step);
 227    }
 28
 29    /// <inheritdoc />
 30    public Intent Infer(BehaviorSpace behaviorSpace, BehaviorVector? precomputedVector = null)
 231        => _pipeline.Infer(behaviorSpace, precomputedVector);
 32}