< Summary

Information
Class: Intentum.AI.AzureOpenAI.AzureOpenAIServiceCollectionExtensions
Assembly: Intentum.AI.AzureOpenAI
File(s): /home/runner/work/Intentum/Intentum/src/Intentum.AI.AzureOpenAI/AzureOpenAIServiceCollectionExtensions.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 12
Coverable lines: 12
Total lines: 29
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
AddIntentumAzureOpenAI(...)100%110%

File(s)

/home/runner/work/Intentum/Intentum/src/Intentum.AI.AzureOpenAI/AzureOpenAIServiceCollectionExtensions.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.AzureOpenAI;
 8
 9[UsedImplicitly]
 10public static class AzureOpenAIServiceCollectionExtensions
 11{
 12    [UsedImplicitly]
 13    public static IServiceCollection AddIntentumAzureOpenAI(
 14        this IServiceCollection services,
 15        AzureOpenAIOptions options)
 016    {
 017        options.Validate();
 018        services.AddSingleton(options);
 019        var httpClient = new HttpClient { BaseAddress = new Uri(options.Endpoint) };
 020        httpClient.DefaultRequestHeaders.Add("api-key", options.ApiKey);
 021        services.AddSingleton(httpClient);
 022        services.AddSingleton<IIntentEmbeddingProvider>(sp =>
 023            new AzureOpenAIEmbeddingProvider(options, sp.GetRequiredService<HttpClient>()));
 024        services.AddSingleton<IIntentSimilarityEngine, SimpleAverageSimilarityEngine>();
 025        services.AddSingleton<IIntentModel, AzureOpenAIIntentModel>();
 26
 027        return services;
 028    }
 29}