From 062685c19ca0468747f60072e8958ccd13f63d0e Mon Sep 17 00:00:00 2001 From: Shawn Callegari <36091529+shawncal@users.noreply.github.com> Date: Tue, 8 Aug 2023 09:09:15 -0700 Subject: [PATCH] .Net: Removing unused files (#2353) ### Description Cleaning up files no longer in use. ### Contribution Checklist - [X] The code builds clean without any errors or warnings - [X] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [X] All unit tests pass, and I have added new tests where possible - [X] I didn't break anyone :smile: Co-authored-by: Dmytro Struk <13853051+dmytrostruk@users.noreply.github.com> --- .../AI/Embeddings/IEmbeddingIndex.cs | 53 ------------------- .../AI/Embeddings/IEmbeddingWithMetadata.cs | 21 -------- .../ContextVariablesExtensions.cs | 21 -------- 3 files changed, 95 deletions(-) delete mode 100644 dotnet/src/SemanticKernel/AI/Embeddings/IEmbeddingIndex.cs delete mode 100644 dotnet/src/SemanticKernel/AI/Embeddings/IEmbeddingWithMetadata.cs delete mode 100644 dotnet/src/SemanticKernel/Orchestration/ContextVariablesExtensions.cs diff --git a/dotnet/src/SemanticKernel/AI/Embeddings/IEmbeddingIndex.cs b/dotnet/src/SemanticKernel/AI/Embeddings/IEmbeddingIndex.cs deleted file mode 100644 index 86de0b5ff697..000000000000 --- a/dotnet/src/SemanticKernel/AI/Embeddings/IEmbeddingIndex.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. - -using System.Collections.Generic; -using System.Threading.Tasks; -using Microsoft.SemanticKernel.Diagnostics; - -namespace Microsoft.SemanticKernel.AI.Embeddings; - -/// -/// Represents an searchable index of structs. -/// -/// The data type of the embedding. -public interface IEmbeddingIndex - where TEmbedding : unmanaged -{ - /// - /// Gets the nearest matches to the . - /// - /// The storage collection to search. - /// The input to use as the search. - /// The max number of results to return. - /// The minimum score to consider in the distance calculation. - /// A tuple consisting of the and the similarity score as a . - IAsyncEnumerable<(IEmbeddingWithMetadata, double)> GetNearestMatchesAsync( - string collection, - Embedding embedding, - int limit = 1, - double minRelevanceScore = 0.0); -} - -/// -/// Common extension methods for objects. -/// -public static class EmbeddingIndexExtensions -{ - /// - /// Searches the index for the nearest match to the . - /// - public static async Task<(IEmbeddingWithMetadata, double)> GetNearestMatchAsync(this IEmbeddingIndex index, - string collection, - Embedding embedding, - double minScore = 0.0) - where TEmbedding : unmanaged - { - Verify.NotNull(index); - await foreach (var match in index.GetNearestMatchesAsync(collection, embedding, 1, minScore)) - { - return match; - } - - return default; - } -} diff --git a/dotnet/src/SemanticKernel/AI/Embeddings/IEmbeddingWithMetadata.cs b/dotnet/src/SemanticKernel/AI/Embeddings/IEmbeddingWithMetadata.cs deleted file mode 100644 index 2d0b6e704263..000000000000 --- a/dotnet/src/SemanticKernel/AI/Embeddings/IEmbeddingWithMetadata.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. - -namespace Microsoft.SemanticKernel.AI.Embeddings; - -/// -/// Represents an object that has an . -/// -/// The embedding data type. -public interface IEmbeddingWithMetadata - where TEmbedding : unmanaged -{ - /// - /// Gets the . - /// - Embedding Embedding { get; } - - /// - /// Returns a string representing the metadata. - /// - string GetSerializedMetadata(); -} diff --git a/dotnet/src/SemanticKernel/Orchestration/ContextVariablesExtensions.cs b/dotnet/src/SemanticKernel/Orchestration/ContextVariablesExtensions.cs deleted file mode 100644 index 4f2891c7f10c..000000000000 --- a/dotnet/src/SemanticKernel/Orchestration/ContextVariablesExtensions.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft. All rights reserved. - -// ReSharper disable once CheckNamespace - Using NS of SKContext - -namespace Microsoft.SemanticKernel.Orchestration; - -/// -/// Class that holds extension methods for ContextVariables. -/// -public static class ContextVariablesExtensions -{ - /// - /// Simple extension method to turn a string into a instance. - /// - /// The text to transform - /// An instance of - public static ContextVariables ToContextVariables(this string text) - { - return new ContextVariables(text); - } -}