| | | 1 | | using Intentum.AI.Embeddings; |
| | | 2 | | using Intentum.AI.Similarity; |
| | | 3 | | using Intentum.Core.Behavior; |
| | | 4 | | using Intentum.Core.Contracts; |
| | | 5 | | using Intentum.Core.Intents; |
| | | 6 | | using Intentum.Core.Pipeline; |
| | | 7 | | |
| | | 8 | | namespace Intentum.AI.Models; |
| | | 9 | | |
| | | 10 | | /// <summary> |
| | | 11 | | /// AI-assisted intent inference using embeddings and similarity scoring. |
| | | 12 | | /// Uses the resolution pipeline internally (signal → vector → LLM inference → confidence). |
| | | 13 | | /// Uses dimension counts as weights when the engine supports it; uses time decay when the engine implements ITimeAwareS |
| | | 14 | | /// </summary> |
| | | 15 | | public sealed class LlmIntentModel : IIntentModel |
| | | 16 | | { |
| | | 17 | | private readonly IntentResolutionPipeline _pipeline; |
| | | 18 | | |
| | | 19 | | /// <summary> |
| | | 20 | | /// Creates an LLM intent model with the given embedding provider and similarity engine. |
| | | 21 | | /// </summary> |
| | 73 | 22 | | public LlmIntentModel( |
| | 73 | 23 | | IIntentEmbeddingProvider embeddingProvider, |
| | 73 | 24 | | IIntentSimilarityEngine similarityEngine) |
| | 73 | 25 | | { |
| | 73 | 26 | | var step = new LlmInferenceStep( |
| | 73 | 27 | | embeddingProvider ?? throw new ArgumentNullException(nameof(embeddingProvider)), |
| | 73 | 28 | | similarityEngine ?? throw new ArgumentNullException(nameof(similarityEngine))); |
| | 73 | 29 | | _pipeline = new IntentResolutionPipeline(step); |
| | 73 | 30 | | } |
| | | 31 | | |
| | | 32 | | /// <inheritdoc /> |
| | | 33 | | public Intent Infer(BehaviorSpace behaviorSpace, BehaviorVector? precomputedVector = null) |
| | 97 | 34 | | => _pipeline.Infer(behaviorSpace, precomputedVector); |
| | | 35 | | } |