Skip to content

Commit 2a2f627

Browse files
.Net Clean-up (#2685)
### Description All code that was marked as obsolete has been removed. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [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 😄
1 parent 16150ea commit 2a2f627

File tree

13 files changed

+16
-1324
lines changed

13 files changed

+16
-1324
lines changed

dotnet/src/Connectors/Connectors.Memory.Kusto/KustoSerializer.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System;
44
using System.Globalization;
55
using System.Text.Json;
6-
using Microsoft.SemanticKernel.AI.Embeddings;
76
using Microsoft.SemanticKernel.Memory;
87
using Microsoft.SemanticKernel.Text;
98

@@ -15,16 +14,16 @@ namespace Microsoft.SemanticKernel.Connectors.Memory.Kusto;
1514
public static class KustoSerializer
1615
{
1716
/// <summary>
18-
/// Returns serialized string from <see cref="Embedding{TEmbedding}"/> instance.
17+
/// Returns serialized string from an embedding instance.
1918
/// </summary>
20-
/// <param name="embedding">Instance of <see cref="Embedding{TEmbedding}"/> for serialization.</param>
19+
/// <param name="embedding">Instance of an embedding for serialization.</param>
2120
public static string SerializeEmbedding(ReadOnlyMemory<float> embedding)
2221
{
2322
return JsonSerializer.Serialize(embedding, s_jsonSerializerOptions);
2423
}
2524

2625
/// <summary>
27-
/// Returns deserialized instance of <see cref="Embedding{TEmbedding}"/> from serialized embedding.
26+
/// Returns deserialized instance of an embedding from serialized embedding.
2827
/// </summary>
2928
/// <param name="embedding">Serialized embedding.</param>
3029
public static ReadOnlyMemory<float> DeserializeEmbedding(string? embedding)

dotnet/src/Connectors/Connectors.Memory.Pinecone/IPineconeMemoryStore.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Collections.Generic;
55
using System.Threading;
66
using System.Threading.Tasks;
7-
using Microsoft.SemanticKernel.AI.Embeddings;
87
using Microsoft.SemanticKernel.Memory;
98

109
namespace Microsoft.SemanticKernel.Connectors.Memory.Pinecone;
@@ -204,10 +203,10 @@ Task RemoveWithFilterAsync(
204203
CancellationToken cancellationToken = default);
205204

206205
/// <summary>
207-
/// Gets the nearest filtered matches to the <see cref="Embedding"/> of type <see cref="float"/>
206+
/// Gets the nearest filtered matches to an embedding of type <see cref="float"/>
208207
/// </summary>
209208
/// <param name="indexName">The name associated with a collection of embeddings.</param>
210-
/// <param name="embedding">The <see cref="Embedding"/> to compare the collection's embeddings with.</param>
209+
/// <param name="embedding">The embedding to compare the collection's embeddings with.</param>
211210
/// <param name="limit">The maximum number of similarity results to return.</param>
212211
/// <param name="filter"> The filter to apply to the collection.</param>
213212
/// <param name="minRelevanceScore"></param>
@@ -232,11 +231,11 @@ Task RemoveWithFilterAsync(
232231
CancellationToken cancellationToken = default);
233232

234233
/// <summary>
235-
/// Gets the nearest matches to the <see cref="Embedding"/> of type <see cref="float"/> from the given namespace.
234+
/// Gets the nearest matches to an embedding of type <see cref="float"/> from the given namespace.
236235
/// </summary>
237236
/// <param name="indexName">The name associated with a collection of embeddings.</param>
238237
/// <param name="indexNamespace"> The namespace associated with a collection of embeddings.</param>
239-
/// <param name="embedding">The <see cref="Embedding"/> to compare the collection's embeddings with.</param>
238+
/// <param name="embedding">The embedding to compare the collection's embeddings with.</param>
240239
/// <param name="limit">The maximum number of similarity results to return.</param>
241240
/// <param name="minRelevanceScore">The minimum relevance threshold for returned results.</param>
242241
/// <param name="withEmbeddings">If true, the embeddings will be returned in the memory records.</param>
@@ -252,11 +251,11 @@ Task RemoveWithFilterAsync(
252251
CancellationToken cancellationToken = default);
253252

254253
/// <summary>
255-
/// Gets the nearest match to the <see cref="Embedding"/> of type <see cref="float"/> from the given namespace.
254+
/// Gets the nearest match to an embedding of type <see cref="float"/> from the given namespace.
256255
/// </summary>
257256
/// <param name="indexName">The name associated with a collection of embeddings.</param>
258257
/// <param name="indexNamespace"> The namespace associated with a collection of embeddings.</param>
259-
/// <param name="embedding">The <see cref="Embedding"/> to compare the collection's embeddings with.</param>
258+
/// <param name="embedding">The embedding to compare the collection's embeddings with.</param>
260259
/// <param name="minRelevanceScore">The minimum relevance threshold for returned results.</param>
261260
/// <param name="withEmbedding">If true, the embedding will be returned in the memory record.</param>
262261
/// <param name="cancellationToken">Cancellation token</param>

dotnet/src/SemanticKernel.Abstractions/AI/Embeddings/Embedding.cs

Lines changed: 0 additions & 227 deletions
This file was deleted.

dotnet/src/SemanticKernel.Abstractions/AI/Embeddings/EmbeddingGenerationServiceExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ public static class EmbeddingGenerationExtensions
1919
/// <typeparam name="TValue">The type from which embeddings will be generated.</typeparam>
2020
/// <typeparam name="TEmbedding">The numeric type of the embedding data.</typeparam>
2121
/// <param name="generator">The embedding generator.</param>
22-
/// <param name="value">A value from which an <see cref="Embedding{TEmbedding}"/> will be generated.</param>
22+
/// <param name="value">A value from which an embedding will be generated.</param>
2323
/// <param name="cancellationToken">Cancellation token</param>
24-
/// <returns>A list of <see cref="Embedding{TEmbedding}"/> structs representing the input <paramref name="value"/>.</returns>
24+
/// <returns>A list of embedding structs representing the input <paramref name="value"/>.</returns>
2525
public static async Task<ReadOnlyMemory<TEmbedding>> GenerateEmbeddingAsync<TValue, TEmbedding>
2626
(this IEmbeddingGeneration<TValue, TEmbedding> generator, TValue value, CancellationToken cancellationToken = default)
2727
where TEmbedding : unmanaged

dotnet/src/SemanticKernel.Abstractions/IKernel.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Copyright (c) Microsoft. All rights reserved.
22

3-
using System;
43
using System.Collections.Generic;
5-
using System.ComponentModel;
64
using System.Threading;
75
using System.Threading.Tasks;
86
using Microsoft.Extensions.Logging;
@@ -185,24 +183,4 @@ Task<SKContext> RunAsync(
185183
/// <typeparam name="T">Service type</typeparam>
186184
/// <returns>Instance of T</returns>
187185
T GetService<T>(string? name = null) where T : IAIService;
188-
189-
#region Obsolete
190-
191-
/// <summary>
192-
/// App logger
193-
/// </summary>
194-
[Obsolete("Use Logger instead. This will be removed in a future release.")]
195-
[EditorBrowsable(EditorBrowsableState.Never)]
196-
ILogger Log { get; }
197-
198-
/// <summary>
199-
/// Create a new instance of a context, linked to the kernel internal state.
200-
/// </summary>
201-
/// <param name="cancellationToken">Optional cancellation token for operations in context.</param>
202-
/// <returns>SK context</returns>
203-
[Obsolete("SKContext no longer contains the CancellationToken. Use CreateNewContext().")]
204-
[EditorBrowsable(EditorBrowsableState.Never)]
205-
SKContext CreateNewContext(CancellationToken cancellationToken);
206-
207-
#endregion
208186
}

dotnet/src/SemanticKernel.Abstractions/Memory/IMemoryStore.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using System.Collections.Generic;
55
using System.Threading;
66
using System.Threading.Tasks;
7-
using Microsoft.SemanticKernel.AI.Embeddings;
87

98
namespace Microsoft.SemanticKernel.Memory;
109

@@ -101,10 +100,10 @@ public interface IMemoryStore
101100
Task RemoveBatchAsync(string collectionName, IEnumerable<string> keys, CancellationToken cancellationToken = default);
102101

103102
/// <summary>
104-
/// Gets the nearest matches to the <see cref="Embedding{Single}"/> of type <see cref="float"/>. Does not guarantee that the collection exists.
103+
/// Gets the nearest matches to an embedding of type <see cref="float"/>. Does not guarantee that the collection exists.
105104
/// </summary>
106105
/// <param name="collectionName">The name associated with a collection of embeddings.</param>
107-
/// <param name="embedding">The <see cref="Embedding{Single}"/> to compare the collection's embeddings with.</param>
106+
/// <param name="embedding">The embedding to compare the collection's embeddings with.</param>
108107
/// <param name="limit">The maximum number of similarity results to return.</param>
109108
/// <param name="minRelevanceScore">The minimum cosine similarity threshold for returned results.</param>
110109
/// <param name="withEmbeddings">If true, the embeddings will be returned in the memory records.</param>
@@ -119,11 +118,11 @@ public interface IMemoryStore
119118
CancellationToken cancellationToken = default);
120119

121120
/// <summary>
122-
/// Gets the nearest match to the <see cref="Embedding{Single}"/> of type <see cref="float"/>. Does not guarantee that the collection exists.
121+
/// Gets the nearest match to an embedding of type <see cref="float"/>. Does not guarantee that the collection exists.
123122
/// </summary>
124123
/// <param name="collectionName">The name associated with a collection of embeddings.</param>
125-
/// <param name="embedding">The <see cref="Embedding{Single}"/> to compare the collection's embeddings with.</param>
126-
/// <param name="minRelevanceScore">The minimum cosine similarity threshold for returned results.</param>
124+
/// <param name="embedding">The embedding to compare the collection's embeddings with.</param>
125+
/// <param name="minRelevanceScore">The minimum relevance threshold for returned results.</param>
127126
/// <param name="withEmbedding">If true, the embedding will be returned in the memory record.</param>
128127
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
129128
/// <returns>A tuple consisting of the <see cref="MemoryRecord"/> and the similarity score as a <see cref="double"/>. Null if no nearest match found.</returns>

0 commit comments

Comments
 (0)