From 26d0ec891ec73db75bd85b8db3faf67ee90a0248 Mon Sep 17 00:00:00 2001
From: Craig Presti <146438+craigomatic@users.noreply.github.com>
Date: Thu, 30 Mar 2023 20:36:13 -0700
Subject: [PATCH 1/2] Change visibility modifiers to public on MemoryRecord and
associated memory collections
---
dotnet/src/SemanticKernel/Memory/Collections/MinHeap.cs | 2 +-
dotnet/src/SemanticKernel/Memory/Collections/Score.cs | 2 +-
dotnet/src/SemanticKernel/Memory/Collections/ScoredValue.cs | 2 +-
dotnet/src/SemanticKernel/Memory/Collections/TopNCollection.cs | 2 +-
dotnet/src/SemanticKernel/Memory/MemoryRecord.cs | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dotnet/src/SemanticKernel/Memory/Collections/MinHeap.cs b/dotnet/src/SemanticKernel/Memory/Collections/MinHeap.cs
index 8d18a6722066..a4d5b6666b41 100644
--- a/dotnet/src/SemanticKernel/Memory/Collections/MinHeap.cs
+++ b/dotnet/src/SemanticKernel/Memory/Collections/MinHeap.cs
@@ -11,7 +11,7 @@ namespace Microsoft.SemanticKernel.Memory.Collections;
/// Implements the classic 'heap' data structure. By default, the item with the lowest value is at the top of the heap.
///
/// Data type.
-internal class MinHeap : IEnumerable where T : IComparable
+public class MinHeap : IEnumerable where T : IComparable
{
private const int DefaultCapacity = 7;
private const int MinCapacity = 0;
diff --git a/dotnet/src/SemanticKernel/Memory/Collections/Score.cs b/dotnet/src/SemanticKernel/Memory/Collections/Score.cs
index b1454c4ad684..64984054b717 100644
--- a/dotnet/src/SemanticKernel/Memory/Collections/Score.cs
+++ b/dotnet/src/SemanticKernel/Memory/Collections/Score.cs
@@ -8,7 +8,7 @@ namespace Microsoft.SemanticKernel.Memory.Collections;
///
/// Structure for storing score value.
///
-internal struct Score : IComparable, IEquatable
+public struct Score : IComparable, IEquatable
{
public double Value { get; set; }
diff --git a/dotnet/src/SemanticKernel/Memory/Collections/ScoredValue.cs b/dotnet/src/SemanticKernel/Memory/Collections/ScoredValue.cs
index 3270059e6d7d..c904e7a7167b 100644
--- a/dotnet/src/SemanticKernel/Memory/Collections/ScoredValue.cs
+++ b/dotnet/src/SemanticKernel/Memory/Collections/ScoredValue.cs
@@ -9,7 +9,7 @@ namespace Microsoft.SemanticKernel.Memory.Collections;
/// Structure for storing data which can be scored.
///
/// Data type.
-internal struct ScoredValue : IComparable>, IEquatable>
+public struct ScoredValue : IComparable>, IEquatable>
{
public ScoredValue(T item, double score)
{
diff --git a/dotnet/src/SemanticKernel/Memory/Collections/TopNCollection.cs b/dotnet/src/SemanticKernel/Memory/Collections/TopNCollection.cs
index 745ddaba3e62..51b7d28622e5 100644
--- a/dotnet/src/SemanticKernel/Memory/Collections/TopNCollection.cs
+++ b/dotnet/src/SemanticKernel/Memory/Collections/TopNCollection.cs
@@ -10,7 +10,7 @@ namespace Microsoft.SemanticKernel.Memory.Collections;
/// Automatically flushes out any not in the top N.
/// By default, items are not sorted by score until you call .
///
-internal class TopNCollection : IEnumerable>
+public class TopNCollection : IEnumerable>
{
private readonly int _maxItems;
private readonly MinHeap> _heap;
diff --git a/dotnet/src/SemanticKernel/Memory/MemoryRecord.cs b/dotnet/src/SemanticKernel/Memory/MemoryRecord.cs
index fb25ad45c21c..cfe32d229802 100644
--- a/dotnet/src/SemanticKernel/Memory/MemoryRecord.cs
+++ b/dotnet/src/SemanticKernel/Memory/MemoryRecord.cs
@@ -8,7 +8,7 @@ namespace Microsoft.SemanticKernel.Memory;
///
/// IMPORTANT: this is a storage schema. Changing the fields will invalidate existing metadata stored in persistent vector DBs.
///
-internal class MemoryRecord : IEmbeddingWithMetadata
+public class MemoryRecord : IEmbeddingWithMetadata
{
///
/// Source content embeddings.
From 21707a1bf9701e262ee51f828f81b251dbaef4b0 Mon Sep 17 00:00:00 2001
From: Craig Presti <146438+craigomatic@users.noreply.github.com>
Date: Fri, 31 Mar 2023 06:24:55 -0700
Subject: [PATCH 2/2] Suppress code analysis complaint
---
dotnet/src/SemanticKernel/Memory/Collections/ScoredValue.cs | 2 ++
1 file changed, 2 insertions(+)
diff --git a/dotnet/src/SemanticKernel/Memory/Collections/ScoredValue.cs b/dotnet/src/SemanticKernel/Memory/Collections/ScoredValue.cs
index c904e7a7167b..916a26299d3c 100644
--- a/dotnet/src/SemanticKernel/Memory/Collections/ScoredValue.cs
+++ b/dotnet/src/SemanticKernel/Memory/Collections/ScoredValue.cs
@@ -92,6 +92,8 @@ public override int GetHashCode()
return left.CompareTo(right) >= 0;
}
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Design", "CA1000:Do not declare static members on generic types", Justification = "Min value convenience method")]
public static ScoredValue Min()
{
return new ScoredValue(default!, Score.Min);