Skip to content

Commit 3b6156a

Browse files
committed
Using this branch as repair branch. Cleaning up all files that were deleted from official PR branch and validating all files to push to PR in original-TEW
1 parent f9068b1 commit 3b6156a

37 files changed

Lines changed: 123 additions & 68 deletions
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
3+
using System;
4+
using System.Collections.Generic;
5+
using System.Collections.Concurrent;
6+
using System.Diagnostics.CodeAnalysis;
7+
using System.Globalization;
8+
using System.Runtime.CompilerServices;
9+
using System.Text.Json;
10+
using System.Threading;
11+
using System.Threading.Tasks;
12+
using Microsoft.SemanticKernel.Memory.Storage;
13+
14+
namespace Microsoft.SemanticKernel.Skills.Memory.VectorDB;
15+
16+
/// <summary>
17+
/// An implementation of <see cref="IDataStore{TValue}"/> backed by a Qdrant Vector database.
18+
/// </summary>
19+
/// <remarks>The vector data is saved to Qdrant Vector Database run locally or in cloud, specified in the constructor.
20+
/// The data persists between subsequent instances. </remarks>
21+
/// <typeparam name="TValue">The type of data to be stored in this data store.</typeparam>
22+
public class MilvusDataStore<TEmbedding> : IDataStore<IEmbeddingWithMetadata<TEmbedding>>, IMemoryStore<TEmbedding>
23+
{
24+
/// <summary>
25+
/// Connect a Milvus Vector database
26+
/// </summary>
27+
/// <param name="endpoint">IP Address or URL endpoint to Qdrant Vectore Database.</param>
28+
/// <param name="port">Port to be used for Qdrant Vector DB</param>
29+
public static MilvusDataStore<TValue> ConnectVectorDB(string endpoint, int port)
30+
{
31+
var vectorDBConnection = MilvusVectorDB.CreateVectorDBConnection(endpoint, port);
32+
return new QdrantDataStore<TValue>(vectorDBConnection);
33+
}
34+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
3+
using System.Collections.Generic;
4+
using System.Data;
5+
using System.Runtime.CompilerServices;
6+
using System.Threading;
7+
using System.Threading.Tasks;
8+
using System.Net.Http;
9+
10+
11+
12+
namespace Microsoft.SemanticKernel.Skills.Memory.VectorDB;
13+
14+
15+
internal class MilvusVectorDB //: IVectorDBClient<TData>
16+
{
17+
public static HttpClient CreateVectorDBConnection(string hostendpoint, int port)
18+
{
19+
HttpClient MilvusDBClient = new HttpClient();
20+
return MilvusDBClient;
21+
}
22+
23+
24+
}

dotnet/src/SemanticKernel.Skills/Skills.Memory.VectorDB/Qdrant/ILongTermMemoryStore.cs renamed to dotnet/src/SemanticKernel.Skills/Skills.Memory.Qdrant/Qdrant/ILongTermMemoryStore.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
using Microsoft.SemanticKernel.AI.Embeddings;
77
using Microsoft.SemanticKernel.Memory;
88
using Microsoft.SemanticKernel.Memory.Storage;
9-
using Qdrant.DotNet;
9+
using Microsoft.SemanticKernel.Skills.Memory.Qdrant.SDKClient;
1010

11-
namespace Microsoft.SemanticKernel.Skills.Memory.VectorDB;
11+
namespace Microsoft.SemanticKernel.Skills.Memory.Qdrant;
1212

1313
internal interface ILongTermMemoryStore<TEmbedding> : IQdrantMemoryStore<TEmbedding>, IMemoryStore<TEmbedding>
1414
where TEmbedding : unmanaged

dotnet/src/SemanticKernel.Skills/Skills.Memory.VectorDB/Qdrant/IQdrantMemoryStore.cs renamed to dotnet/src/SemanticKernel.Skills/Skills.Memory.Qdrant/Qdrant/IQdrantMemoryStore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Microsoft. All rights reserved.
22

33
using Microsoft.SemanticKernel.Memory.Storage;
4-
using Qdrant.DotNet;
4+
using Microsoft.SemanticKernel.Skills.Memory.Qdrant.SDKClient;
55

66
namespace Microsoft.SemanticKernel.Skills.Memory.VectorDB;
77

dotnet/src/SemanticKernel.Skills/Skills.Memory.VectorDB/Qdrant/QdrantDataStore.hold renamed to dotnet/src/SemanticKernel.Skills/Skills.Memory.Qdrant/Qdrant/QdrantDataStore.hold

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ using System.Threading;
1111
using System.Threading.Tasks;
1212
using Microsoft.SemanticKernel.Memory;
1313
using Microsoft.SemanticKernel.Memory.Storage;
14-
using Qdrant.DotNet;
15-
using Qdrant.DotNet.Internal.Diagnostics;
14+
using Microsoft.SemanticKernel.Skills.Memory.Qdrant.SDKClient;
15+
using Microsoft.SemanticKernel.Skills.Memory.Qdrant.SDKClient.Internal.Diagnostics;
1616

1717
namespace Microsoft.SemanticKernel.Skills.Memory.VectorDB;
1818

dotnet/src/SemanticKernel.Skills/Skills.Memory.VectorDB/Qdrant/QdrantMemoryStore.cs renamed to dotnet/src/SemanticKernel.Skills/Skills.Memory.Qdrant/Qdrant/QdrantMemoryStore.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,12 @@
99
using Microsoft.SemanticKernel.AI.Embeddings;
1010
using Microsoft.SemanticKernel.Memory;
1111
using Microsoft.SemanticKernel.Memory.Storage;
12-
using Qdrant.DotNet;
13-
using Qdrant.DotNet.Internal;
14-
using Qdrant.DotNet.Internal.Diagnostics;
12+
using Microsoft.SemanticKernel.Skills.Memory.Qdrant.SDKClient;
13+
using Microsoft.SemanticKernel.Skills.Memory.Qdrant.SDKClient.Internal;
14+
using Microsoft.SemanticKernel.Skills.Memory.Qdrant.SDKClient.Internal.Diagnostics;
1515

1616

17-
18-
19-
20-
namespace Microsoft.SemanticKernel.Skills.Memory.VectorDB;
17+
namespace Microsoft.SemanticKernel.Skills.Memory.Qdrant;
2118

2219
/// <summary>
2320
/// An implementation of <see cref="ILongTermMemoryStore{TEmbedding}"/> which is an embedding of type float

dotnet/src/SemanticKernel.Skills/Skills.Memory.VectorDB/Qdrant/QdrantMemoryStore.hold renamed to dotnet/src/SemanticKernel.Skills/Skills.Memory.Qdrant/Qdrant/QdrantMemoryStore.hold

File renamed without changes.

dotnet/src/SemanticKernel.Skills/Skills.Memory.VectorDB/Qdrant/QdrantVectorDb.cs renamed to dotnet/src/SemanticKernel.Skills/Skills.Memory.Qdrant/Qdrant/QdrantVectorDb.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
using System.Threading.Tasks;
99
using Microsoft.SemanticKernel.AI.Embeddings;
1010
using Microsoft.SemanticKernel.Memory.Storage;
11-
using Qdrant.DotNet;
11+
using Microsoft.SemanticKernel.Skills.Memory.Qdrant.SDKClient;
1212

1313

1414
namespace Microsoft.SemanticKernel.Skills.Memory.VectorDB;
@@ -40,7 +40,7 @@ public async Task<IVectorDbCollection> CreateCollectionAsync(string collectionna
4040
}
4141
catch (Exception ex)
4242
{
43-
throw new Qdrant.DotNet.Internal.Diagnostics.VectorDbException($"Failed to create collection in Qdrant {ex.Message}");
43+
throw new Microsoft.SemanticKernel.Skills.Memory.Qdrant.SDKClient.Internal.Diagnostics.VectorDbException($"Failed to create collection in Qdrant {ex.Message}");
4444
}
4545

4646
this._qdrantcollections.TryAdd(collectionname, collection);
@@ -93,7 +93,7 @@ public async Task<IVectorDbCollection> GetCollectionDataAsync(string collectionk
9393
}
9494
catch (Exception ex)
9595
{
96-
throw new Qdrant.DotNet.Internal.Diagnostics.VectorDbException($"Failed to get collections from Qdrant, {ex.Message}");
96+
throw new Microsoft.SemanticKernel.Skills.Memory.Qdrant.SDKClient.Internal.Diagnostics.VectorDbException($"Failed to get collections from Qdrant, {ex.Message}");
9797
}
9898

9999
return collection;
@@ -110,7 +110,7 @@ public async Task<IAsyncEnumerable<DataEntry<VectorRecordData<float>>>> GetVecto
110110
}
111111
catch
112112
{
113-
throw new Qdrant.DotNet.Internal.Diagnostics.VectorDbException($"Failed to get vectors by collection from Qdrant");
113+
throw new Microsoft.SemanticKernel.Skills.Memory.Qdrant.SDKClient.Internal.Diagnostics.VectorDbException($"Failed to get vectors by collection from Qdrant");
114114
}
115115

116116
return vectors!;
@@ -132,7 +132,7 @@ public async Task<DataEntry<VectorRecordData<float>>> GetVectorDataAsync(string
132132
}
133133
catch (Exception ex) //look up specific exece
134134
{
135-
throw new Qdrant.DotNet.Internal.Diagnostics.VectorDbException($"Failed to get vector from Qdrant, {ex.Message}");
135+
throw new Microsoft.SemanticKernel.Skills.Memory.Qdrant.SDKClient.Internal.Diagnostics.VectorDbException($"Failed to get vector from Qdrant, {ex.Message}");
136136
}
137137

138138
return result;
@@ -196,7 +196,7 @@ public async Task<IEnumerable<KeyValuePair<DataEntry<VectorRecordData<float>>, d
196196
}
197197
catch (Exception ex)
198198
{
199-
throw new Qdrant.DotNet.Internal.Diagnostics.VectorDbException($"Error occurred, Failed to get nearest matches from Qdrant{ex.Message}");
199+
throw new Microsoft.SemanticKernel.Skills.Memory.Qdrant.SDKClient.Internal.Diagnostics.VectorDbException($"Error occurred, Failed to get nearest matches from Qdrant{ex.Message}");
200200
}
201201

202202
return matchresults;

dotnet/src/SemanticKernel.Skills/Skills.Memory.VectorDB/Qdrant/DotNet/IVectorDb.cs renamed to dotnet/src/SemanticKernel.Skills/Skills.Memory.Qdrant/Qdrant/SDKClient/IVectorDb.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
using System.Threading.Tasks;
44

5-
namespace Qdrant.DotNet;
5+
namespace Microsoft.SemanticKernel.Skills.Memory.Qdrant.SDKClient;
66

7-
public interface IVectorDb
7+
internal interface IVectorDb
88
{
99
public Task<IVectorDbCollection> GetCollectionAsync(string collectionName);
1010
public Task CreateCollectionIfMissing(string collectionName, int vectorSize);

dotnet/src/SemanticKernel.Skills/Skills.Memory.VectorDB/Qdrant/DotNet/IVectorDbCollection.cs renamed to dotnet/src/SemanticKernel.Skills/Skills.Memory.Qdrant/Qdrant/SDKClient/IVectorDbCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
using Microsoft.SemanticKernel.AI.Embeddings;
77
using Microsoft.SemanticKernel.Memory.Storage;
88

9-
namespace Qdrant.DotNet;
9+
namespace Microsoft.SemanticKernel.Skills.Memory.Qdrant.SDKClient;
1010

1111
public interface IVectorDbCollection
1212
{

0 commit comments

Comments
 (0)