Skip to content

.Net: Adding VectorStore abstractions and 5 sample implementations #7595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 48 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
d41a1fa
.Net: Add Updated Memory Connector ADR and IMemoryRecordService inter…
westey-m Jun 5, 2024
cc59b04
.Net: Add new Azure AI Search memory connector implementation (#6585)
westey-m Jun 13, 2024
bfa0967
.Net: Rename memory to vector. (#6701)
westey-m Jun 17, 2024
0740d88
.Net: Adding unit tests for property enumerator and excluding from co…
westey-m Jun 17, 2024
c43ef3e
.Net: Adding generic redis IVectorRecordStore implementation (#6741)
westey-m Jun 21, 2024
15c1e9b
.Net: Add qdrant vector record store implementation (#6904)
westey-m Jun 24, 2024
17d55e9
.Net: VectorStore: Add unit tests for mappers and adding dedicated op…
westey-m Jun 26, 2024
ef5bef5
.Net: Add unit tests for AzureAISearch and Redis Vector Record Stores…
westey-m Jun 27, 2024
251218c
.Net: VectorStore: Adding unit tests for the Qdrant vector record sto…
westey-m Jun 28, 2024
2bfb66a
.Net: VectorStore: Add strongly typed properties for vector store exc…
westey-m Jul 1, 2024
4d8dcfd
.Net: VectorStore: Add custom serialization options / naming support.…
westey-m Jul 2, 2024
210d188
.Net: VectorStore: Moving all vector store interfaces to data folder …
westey-m Jul 3, 2024
3776975
.Net: Adding volatile vector record store implementation. (#7109)
westey-m Jul 8, 2024
21c94a7
.Net: Switching all vector record store instances to be tied to a sin…
westey-m Jul 10, 2024
9759ec3
.Net: Improve support for enumerable types and remove complex object …
westey-m Jul 15, 2024
6ffc0c7
.Net: Rename VectorRecordStore to VetorStoreRecordCollection (#7261)
westey-m Jul 15, 2024
0ef9b16
.Net: Adding collectionName, exists and delete to collection interfac…
westey-m Jul 16, 2024
eb54ca2
.Net: Adding Azure AI Search CollectionCreate (#7287)
westey-m Jul 16, 2024
c279270
.Net: Add redis collection create support. (#7315)
westey-m Jul 17, 2024
b2d34ee
Adding qdrant collection create. (#7302)
westey-m Jul 17, 2024
16dd962
.Net: Add CreateCollection to Volatile vectorstore and abstraction (#…
westey-m Jul 17, 2024
b0b6ece
.Net: Add IVectorStore interface and Volatile implementation (#7332)
westey-m Jul 17, 2024
ba8edc8
.Net: Adding VectorStore for Azure AI Search. (#7335)
westey-m Jul 18, 2024
6969ec0
.Net: Adding VectorStore for Redis. (#7345)
westey-m Jul 18, 2024
8909d87
.Net: Adding a VectorStore implementation for Qdrant (#7354)
westey-m Jul 18, 2024
9f71a4d
.Net: Remove mapper type option and default redis prefixing to true. …
westey-m Jul 19, 2024
288c57d
.Net: Fix casting bug in VolatileVectorStore (#7385)
westey-m Jul 22, 2024
7cce740
.Net: Add basic KernelBuilder and ServiceCollection extensions for re…
westey-m Jul 22, 2024
bb91cc6
.Net: Add Data ingestion sample for VectorStore (#7388)
westey-m Jul 23, 2024
a2dbb2f
.Net: Add missing experimental attributes and fix typos. (#7411)
westey-m Jul 24, 2024
1ed0970
.Net: dotnet Pinecone connector improvements: move to Pinecone.NET an…
maumar Jul 24, 2024
718dc5b
.Net: RedisJson rename, adr rename and AzureAISearch integration test…
westey-m Jul 24, 2024
11dce8f
.Net: Fix collection create field naming bug and add tests to cover s…
westey-m Jul 25, 2024
92220f2
.Net: Add support for redis hashsets. (#7445)
westey-m Jul 25, 2024
da26536
.Net: VectorStore: Add DI extensions for Pinecone and reorder params …
westey-m Jul 26, 2024
d8fd5e8
.Net: Removing embedding generation attributes and fixing cloning bug…
westey-m Jul 29, 2024
887fa0c
.Net: Add a few improvements to data ingestion sample. (#7524)
westey-m Jul 29, 2024
ef9bc1b
.Net: Fix bug where JsonSerializerOptions is not consistently used. (…
westey-m Jul 29, 2024
04e20ee
.Net: Add support for any key type to the VolatileVectorStore. (#7529)
westey-m Jul 29, 2024
8a591dd
.Net: Restricting property writability and renaming data model name p…
westey-m Jul 30, 2024
df0ea21
.Net: Rename DI extensions that depend on already registered dependen…
westey-m Jul 30, 2024
74963d6
.Net: Removing reflection type checks where possible when using defin…
westey-m Jul 31, 2024
65cd240
.Net: [Feature branch] Small formatting improvements (#7588)
dmytrostruk Aug 1, 2024
2fec094
.Net: Make full text search configurable and improve support for tagg…
westey-m Aug 1, 2024
1d3cf94
.Net: VectorStore: Adding a simple example a custom mapper example. (…
westey-m Aug 2, 2024
a7bc61f
.Net: Adding improvements to xml docs based on suggestions from team.…
westey-m Aug 2, 2024
d9c31e2
.Net: Fix service collection extensions return type typo. (#7897)
westey-m Aug 6, 2024
46c3c89
.Net: Increase connection timeout for redis integration tests. (#7901)
westey-m Aug 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
995 changes: 995 additions & 0 deletions docs/decisions/0050-updated-vector-store-design.md

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions dotnet/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<PackageVersion Include="Microsoft.Identity.Client" Version="4.61.3" />
<PackageVersion Include="Microsoft.ML.OnnxRuntime" Version="1.18.1" />
<PackageVersion Include="FastBertTokenizer" Version="1.0.28" />
<PackageVersion Include="Pinecone.NET" Version="2.1.1" />
<PackageVersion Include="System.Diagnostics.DiagnosticSource" Version="8.0.1" />
<PackageVersion Include="System.Linq.Async" Version="6.0.1" />
<PackageVersion Include="System.Memory.Data" Version="8.0.0" />
Expand Down Expand Up @@ -68,6 +69,7 @@
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7" />
<PackageVersion Include="xretry" Version="1.9.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.2" />
<PackageVersion Include="Docker.DotNet" Version="3.125.15" />
<!-- Plugins -->
<PackageVersion Include="DocumentFormat.OpenXml" Version="3.0.2" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="8.0.2" />
Expand All @@ -92,6 +94,7 @@
<PackageVersion Include="Milvus.Client" Version="2.3.0-preview.1" />
<PackageVersion Include="Testcontainers.Milvus" Version="3.8.0" />
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.2.1" />
<PackageVersion Include="Qdrant.Client" Version="1.9.0" />
<!-- Symbols -->
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<!-- Toolset -->
Expand Down
1 change: 1 addition & 0 deletions dotnet/samples/Concepts/Concepts.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Docker.DotNet" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="xRetry" />
<PackageReference Include="xunit" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
// Copyright (c) Microsoft. All rights reserved.

using Docker.DotNet;
using Docker.DotNet.Models;

namespace Memory.VectorStoreFixtures;

/// <summary>
/// Helper class that creates and deletes containers for the vector store examples.
/// </summary>
internal static class VectorStoreInfra
{
/// <summary>
/// Setup the qdrant container by pulling the image and running it.
/// </summary>
/// <param name="client">The docker client to create the container with.</param>
/// <returns>The id of the container.</returns>
public static async Task<string> SetupQdrantContainerAsync(DockerClient client)
{
await client.Images.CreateImageAsync(
new ImagesCreateParameters
{
FromImage = "qdrant/qdrant",
Tag = "latest",
},
null,
new Progress<JSONMessage>());

var container = await client.Containers.CreateContainerAsync(new CreateContainerParameters()
{
Image = "qdrant/qdrant",
HostConfig = new HostConfig()
{
PortBindings = new Dictionary<string, IList<PortBinding>>
{
{"6333", new List<PortBinding> {new() {HostPort = "6333" } }},
{"6334", new List<PortBinding> {new() {HostPort = "6334" } }}
},
PublishAllPorts = true
},
ExposedPorts = new Dictionary<string, EmptyStruct>
{
{ "6333", default },
{ "6334", default }
},
});

await client.Containers.StartContainerAsync(
container.ID,
new ContainerStartParameters());

return container.ID;
}

/// <summary>
/// Setup the redis container by pulling the image and running it.
/// </summary>
/// <param name="client">The docker client to create the container with.</param>
/// <returns>The id of the container.</returns>
public static async Task<string> SetupRedisContainerAsync(DockerClient client)
{
await client.Images.CreateImageAsync(
new ImagesCreateParameters
{
FromImage = "redis/redis-stack",
Tag = "latest",
},
null,
new Progress<JSONMessage>());

var container = await client.Containers.CreateContainerAsync(new CreateContainerParameters()
{
Image = "redis/redis-stack",
HostConfig = new HostConfig()
{
PortBindings = new Dictionary<string, IList<PortBinding>>
{
{"6379", new List<PortBinding> {new() {HostPort = "6379"}}},
{"8001", new List<PortBinding> {new() {HostPort = "8001"}}}
},
PublishAllPorts = true
},
ExposedPorts = new Dictionary<string, EmptyStruct>
{
{ "6379", default },
{ "8001", default }
},
});

await client.Containers.StartContainerAsync(
container.ID,
new ContainerStartParameters());

return container.ID;
}

/// <summary>
/// Stop and delete the container with the specified id.
/// </summary>
/// <param name="client">The docker client to delete the container in.</param>
/// <param name="containerId">The id of the container to delete.</param>
/// <returns>An async task.</returns>
public static async Task DeleteContainerAsync(DockerClient client, string containerId)
{
await client.Containers.StopContainerAsync(containerId, new ContainerStopParameters());
await client.Containers.RemoveContainerAsync(containerId, new ContainerRemoveParameters());
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright (c) Microsoft. All rights reserved.

using Docker.DotNet;
using Qdrant.Client;

namespace Memory.VectorStoreFixtures;

/// <summary>
/// Fixture to use for creating a Qdrant container before tests and delete it after tests.
/// </summary>
public class VectorStoreQdrantContainerFixture : IAsyncLifetime
{
private DockerClient? _dockerClient;
private string? _qdrantContainerId;

public async Task InitializeAsync()
{
}

public async Task ManualInitializeAsync()
{
if (this._qdrantContainerId == null)
{
// Connect to docker and start the docker container.
using var dockerClientConfiguration = new DockerClientConfiguration();
this._dockerClient = dockerClientConfiguration.CreateClient();
this._qdrantContainerId = await VectorStoreInfra.SetupQdrantContainerAsync(this._dockerClient);

// Delay until the Qdrant server is ready.
var qdrantClient = new QdrantClient("localhost");
var succeeded = false;
var attemptCount = 0;
while (!succeeded && attemptCount++ < 10)
{
try
{
await qdrantClient.ListCollectionsAsync();
succeeded = true;
}
catch (Exception)
{
await Task.Delay(1000);
}
}
}
}

public async Task DisposeAsync()
{
if (this._dockerClient != null && this._qdrantContainerId != null)
{
// Delete docker container.
await VectorStoreInfra.DeleteContainerAsync(this._dockerClient, this._qdrantContainerId);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Copyright (c) Microsoft. All rights reserved.

using Docker.DotNet;

namespace Memory.VectorStoreFixtures;

/// <summary>
/// Fixture to use for creating a Redis container before tests and delete it after tests.
/// </summary>
public class VectorStoreRedisContainerFixture : IAsyncLifetime
{
private DockerClient? _dockerClient;
private string? _redisContainerId;

public async Task InitializeAsync()
{
}

public async Task ManualInitializeAsync()
{
if (this._redisContainerId == null)
{
// Connect to docker and start the docker container.
using var dockerClientConfiguration = new DockerClientConfiguration();
this._dockerClient = dockerClientConfiguration.CreateClient();
this._redisContainerId = await VectorStoreInfra.SetupRedisContainerAsync(this._dockerClient);
}
}

public async Task DisposeAsync()
{
if (this._dockerClient != null && this._redisContainerId != null)
{
// Delete docker container.
await VectorStoreInfra.DeleteContainerAsync(this._dockerClient, this._redisContainerId);
}
}
}
Loading
Loading