< Summary

Information
Class: Intentum.AI.Mistral.MistralServiceCollectionExtensions
Assembly: Intentum.AI.Mistral
File(s): /home/runner/work/Intentum/Intentum/src/Intentum.AI.Mistral/MistralServiceCollectionExtensions.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 13
Coverable lines: 13
Total lines: 30
Line coverage: 0%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
AddIntentumMistral(...)100%110%

File(s)

/home/runner/work/Intentum/Intentum/src/Intentum.AI.Mistral/MistralServiceCollectionExtensions.cs

#LineLine coverage
 1using Intentum.AI.Embeddings;
 2using Intentum.AI.Similarity;
 3using Intentum.Core.Contracts;
 4using JetBrains.Annotations;
 5using Microsoft.Extensions.DependencyInjection;
 6
 7namespace Intentum.AI.Mistral;
 8
 9[UsedImplicitly]
 10public static class MistralServiceCollectionExtensions
 11{
 12    [UsedImplicitly]
 13    public static IServiceCollection AddIntentumMistral(
 14        this IServiceCollection services,
 15        MistralOptions options)
 016    {
 017        options.Validate();
 018        services.AddSingleton(options);
 019        var httpClient = new HttpClient { BaseAddress = new Uri(options.BaseUrl!) };
 020        httpClient.DefaultRequestHeaders.Authorization =
 021            new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", options.ApiKey);
 022        services.AddSingleton(httpClient);
 023        services.AddSingleton<IIntentEmbeddingProvider>(sp =>
 024            new MistralEmbeddingProvider(options, sp.GetRequiredService<HttpClient>()));
 025        services.AddSingleton<IIntentSimilarityEngine, SimpleAverageSimilarityEngine>();
 026        services.AddSingleton<IIntentModel, MistralIntentModel>();
 27
 028        return services;
 029    }
 30}