Skip to content

Commit

Permalink
Simplify method
Browse files Browse the repository at this point in the history
  • Loading branch information
marcominerva committed May 21, 2024
1 parent 11d2926 commit 52a1e6b
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions service/Abstractions/KernelMemoryBuilderExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft. All rights reserved.

using System;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.KernelMemory.AI;
using Microsoft.KernelMemory.Configuration;
using Microsoft.KernelMemory.DataFormats;
Expand Down Expand Up @@ -141,11 +140,7 @@ public static IKernelMemoryBuilder WithCustomEmbeddingGenerator(
public static IKernelMemoryBuilder WithCustomEmbeddingGenerator<T>(
this IKernelMemoryBuilder builder) where T : class, ITextEmbeddingGenerator
{
builder.Services.AddSingleton<ITextEmbeddingGenerator>(serviceProvider =>
{
return ActivatorUtilities.CreateInstance<T>(serviceProvider);
});

builder.AddSingleton<ITextEmbeddingGenerator, T>();
return builder;
}

Expand Down

0 comments on commit 52a1e6b

Please sign in to comment.