| | | 1 | | using Intentum.AI.Embeddings; |
| | | 2 | | using Intentum.AI.Similarity; |
| | | 3 | | using Intentum.Core.Contracts; |
| | | 4 | | using JetBrains.Annotations; |
| | | 5 | | using Microsoft.Extensions.DependencyInjection; |
| | | 6 | | |
| | | 7 | | namespace Intentum.AI.Gemini; |
| | | 8 | | |
| | | 9 | | [UsedImplicitly] |
| | | 10 | | public static class GeminiServiceCollectionExtensions |
| | | 11 | | { |
| | | 12 | | [UsedImplicitly] |
| | | 13 | | public static IServiceCollection AddIntentumGemini( |
| | | 14 | | this IServiceCollection services, |
| | | 15 | | GeminiOptions options) |
| | 0 | 16 | | { |
| | 0 | 17 | | options.Validate(); |
| | 0 | 18 | | services.AddSingleton(options); |
| | 0 | 19 | | services.AddSingleton(new HttpClient { BaseAddress = new Uri(options.BaseUrl!) }); |
| | 0 | 20 | | services.AddSingleton<IIntentEmbeddingProvider>(sp => |
| | 0 | 21 | | new GeminiEmbeddingProvider(options, sp.GetRequiredService<HttpClient>())); |
| | 0 | 22 | | services.AddSingleton<IIntentSimilarityEngine, SimpleAverageSimilarityEngine>(); |
| | 0 | 23 | | services.AddSingleton<IIntentModel, GeminiIntentModel>(); |
| | | 24 | | |
| | 0 | 25 | | return services; |
| | 0 | 26 | | } |
| | | 27 | | } |