| | | 1 | | using Intentum.Core.Behavior; |
| | | 2 | | using Intentum.Core.Intents; |
| | | 3 | | |
| | | 4 | | namespace Intentum.AI.Models; |
| | | 5 | | |
| | | 6 | | /// <summary> |
| | | 7 | | /// Extension methods for <see cref="LlmIntentModel"/> to infer with <see cref="ToVectorOptions"/> (e.g. cap dimensions |
| | | 8 | | /// </summary> |
| | | 9 | | public static class LlmIntentModelExtensions |
| | | 10 | | { |
| | | 11 | | /// <summary> |
| | | 12 | | /// Infers intent using a behavior vector built with the given options (e.g. <see cref="ToVectorOptions.CapPerDimens |
| | | 13 | | /// Use to reduce embedding calls and memory for large event sets. |
| | | 14 | | /// </summary> |
| | | 15 | | /// <param name="model">The LLM intent model.</param> |
| | | 16 | | /// <param name="behaviorSpace">The observed behavior space.</param> |
| | | 17 | | /// <param name="toVectorOptions">Options for building the vector (cap/normalization); when null, same as <see cref= |
| | | 18 | | /// <param name="precomputedVector">Optional pre-computed vector; when non-null, <paramref name="toVectorOptions"/> |
| | | 19 | | public static Intent Infer( |
| | | 20 | | this LlmIntentModel model, |
| | | 21 | | BehaviorSpace behaviorSpace, |
| | | 22 | | ToVectorOptions? toVectorOptions, |
| | | 23 | | BehaviorVector? precomputedVector = null) |
| | 0 | 24 | | { |
| | 0 | 25 | | var vector = precomputedVector ?? behaviorSpace.ToVector(toVectorOptions); |
| | 0 | 26 | | return model.Infer(behaviorSpace, vector); |
| | 0 | 27 | | } |
| | | 28 | | } |