Skip to content

Commit

Permalink
Merge branch 'main' into vector-store-ragsample-bugbashfeedback
Browse files Browse the repository at this point in the history
  • Loading branch information
westey-m authored Oct 15, 2024
2 parents 737fdaa + 4e73757 commit cb7e534
Show file tree
Hide file tree
Showing 15 changed files with 34 additions and 23 deletions.
4 changes: 2 additions & 2 deletions dotnet/Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<PackageVersion Include="Azure.Identity" Version="1.12.0" />
<PackageVersion Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.3.0" />
<PackageVersion Include="Azure.Search.Documents" Version="11.6.0" />
<PackageVersion Include="Handlebars.Net.Helpers" Version="2.4.5" />
<PackageVersion Include="Handlebars.Net.Helpers" Version="2.4.6" />
<PackageVersion Include="Markdig" Version="0.37.0" />
<PackageVersion Include="Handlebars.Net" Version="2.1.6" />
<PackageVersion Include="HtmlAgilityPack" Version="1.11.67" />
Expand Down Expand Up @@ -77,7 +77,7 @@
<PackageVersion Include="Docker.DotNet" Version="3.125.15" />
<!-- Plugins -->
<PackageVersion Include="DocumentFormat.OpenXml" Version="3.1.0" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="8.0.8" />
<PackageVersion Include="Microsoft.Data.Sqlite" Version="8.0.10" />
<PackageVersion Include="DuckDB.NET.Data.Full" Version="1.1.1" />
<PackageVersion Include="DuckDB.NET.Data" Version="1.1.1" />
<PackageVersion Include="MongoDB.Driver" Version="2.28.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ public class AzureCosmosDBMongoDBHotelModel(string hotelId)
public string? Description { get; set; }

/// <summary>A vector field.</summary>
[VectorStoreRecordVector(Dimensions: 4, IndexKind: IndexKind.IvfFlat, DistanceFunction: DistanceFunction.CosineDistance)]
[VectorStoreRecordVector(Dimensions: 4, DistanceFunction: DistanceFunction.CosineDistance, IndexKind: IndexKind.IvfFlat)]
public ReadOnlyMemory<float>? DescriptionEmbedding { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -828,11 +828,11 @@ private sealed class VectorSearchModel
[VectorStoreRecordData]
public string? HotelName { get; set; }

[VectorStoreRecordVector(Dimensions: 4, IndexKind: IndexKind.IvfFlat, DistanceFunction: DistanceFunction.CosineDistance, StoragePropertyName = "test_embedding_1")]
[VectorStoreRecordVector(Dimensions: 4, DistanceFunction: DistanceFunction.CosineDistance, IndexKind: IndexKind.IvfFlat, StoragePropertyName = "test_embedding_1")]
public ReadOnlyMemory<float> TestEmbedding1 { get; set; }

[BsonElement("test_embedding_2")]
[VectorStoreRecordVector(Dimensions: 4, IndexKind: IndexKind.IvfFlat, DistanceFunction: DistanceFunction.CosineDistance)]
[VectorStoreRecordVector(Dimensions: 4, DistanceFunction: DistanceFunction.CosineDistance, IndexKind: IndexKind.IvfFlat)]
public ReadOnlyMemory<float> TestEmbedding2 { get; set; }
}
#pragma warning restore CA1812
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ public class AzureCosmosDBNoSQLHotel(string hotelId)

/// <summary>A vector field.</summary>
[JsonPropertyName("description_embedding")]
[VectorStoreRecordVector(Dimensions: 4, IndexKind: IndexKind.Flat, DistanceFunction: DistanceFunction.CosineSimilarity)]
[VectorStoreRecordVector(Dimensions: 4, DistanceFunction: DistanceFunction.CosineSimilarity, IndexKind: IndexKind.Flat)]
public ReadOnlyMemory<float>? DescriptionEmbedding { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -701,16 +701,16 @@ private sealed class TestIndexingModel
[VectorStoreRecordKey]
public string? Id { get; set; }

[VectorStoreRecordVector(Dimensions: 1, IndexKind: IndexKind.Flat, DistanceFunction: DistanceFunction.CosineSimilarity)]
[VectorStoreRecordVector(Dimensions: 1, DistanceFunction: DistanceFunction.CosineSimilarity, IndexKind: IndexKind.Flat)]
public ReadOnlyMemory<Half>? DescriptionEmbedding1 { get; set; }

[VectorStoreRecordVector(Dimensions: 2, IndexKind: IndexKind.Flat, DistanceFunction: DistanceFunction.CosineSimilarity)]
[VectorStoreRecordVector(Dimensions: 2, DistanceFunction: DistanceFunction.CosineSimilarity, IndexKind: IndexKind.Flat)]
public ReadOnlyMemory<float>? DescriptionEmbedding2 { get; set; }

[VectorStoreRecordVector(Dimensions: 3, IndexKind: IndexKind.QuantizedFlat, DistanceFunction: DistanceFunction.DotProductSimilarity)]
[VectorStoreRecordVector(Dimensions: 3, DistanceFunction: DistanceFunction.DotProductSimilarity, IndexKind: IndexKind.QuantizedFlat)]
public ReadOnlyMemory<byte>? DescriptionEmbedding3 { get; set; }

[VectorStoreRecordVector(Dimensions: 4, IndexKind: IndexKind.DiskAnn, DistanceFunction: DistanceFunction.EuclideanDistance)]
[VectorStoreRecordVector(Dimensions: 4, DistanceFunction: DistanceFunction.EuclideanDistance, IndexKind: IndexKind.DiskAnn)]
public ReadOnlyMemory<sbyte>? DescriptionEmbedding4 { get; set; }

[VectorStoreRecordData(IsFilterable = true)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ public sealed record WeaviateHotel
public DateTimeOffset Timestamp { get; set; }

/// <summary>A vector field.</summary>
[VectorStoreRecordVector(Dimensions: 4, IndexKind: IndexKind.Hnsw, DistanceFunction: DistanceFunction.CosineDistance)]
[VectorStoreRecordVector(Dimensions: 4, DistanceFunction: DistanceFunction.CosineDistance, IndexKind: IndexKind.Hnsw)]
public ReadOnlyMemory<float>? DescriptionEmbedding { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,24 @@ public VectorStoreRecordVectorAttribute(int Dimensions)
/// Initializes a new instance of the <see cref="VectorStoreRecordVectorAttribute"/> class.
/// </summary>
/// <param name="Dimensions">The number of dimensions that the vector has.</param>
/// <param name="IndexKind">The kind of index to use.</param>
/// <param name="DistanceFunction">The distance function to use when comparing vectors.</param>
public VectorStoreRecordVectorAttribute(int Dimensions, string? IndexKind, string? DistanceFunction)
public VectorStoreRecordVectorAttribute(int Dimensions, string? DistanceFunction)
{
this.Dimensions = Dimensions;
this.DistanceFunction = DistanceFunction;
}

/// <summary>
/// Initializes a new instance of the <see cref="VectorStoreRecordVectorAttribute"/> class.
/// </summary>
/// <param name="Dimensions">The number of dimensions that the vector has.</param>
/// <param name="DistanceFunction">The distance function to use when comparing vectors.</param>
/// <param name="IndexKind">The kind of index to use.</param>
public VectorStoreRecordVectorAttribute(int Dimensions, string? DistanceFunction, string? IndexKind)
{
this.Dimensions = Dimensions;
this.IndexKind = IndexKind;
this.DistanceFunction = DistanceFunction;
this.IndexKind = IndexKind;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public record AzureCosmosDBMongoDBHotel()
public DateTime Timestamp { get; set; }

/// <summary>A vector field.</summary>
[VectorStoreRecordVector(Dimensions: 4, IndexKind: IndexKind.IvfFlat, DistanceFunction: DistanceFunction.CosineDistance)]
[VectorStoreRecordVector(Dimensions: 4, DistanceFunction: DistanceFunction.CosineDistance, IndexKind: IndexKind.IvfFlat)]
public ReadOnlyMemory<float>? DescriptionEmbedding { get; set; }
}
#pragma warning restore CS8618
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@ public record AzureCosmosDBNoSQLHotel()
public DateTimeOffset Timestamp { get; set; }

/// <summary>A vector field.</summary>
[VectorStoreRecordVector(Dimensions: 4, IndexKind: IndexKind.Flat, DistanceFunction: DistanceFunction.CosineSimilarity)]
[VectorStoreRecordVector(Dimensions: 4, DistanceFunction: DistanceFunction.CosineSimilarity, IndexKind: IndexKind.Flat)]
public ReadOnlyMemory<float>? DescriptionEmbedding { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ public record PineconeAllTypes()
[VectorStoreRecordData]
public IEnumerable<string> Enumerable { get; set; }

[VectorStoreRecordVector(Dimensions: 8, IndexKind: null, DistanceFunction: DistanceFunction.DotProductSimilarity)]
[VectorStoreRecordVector(Dimensions: 8, DistanceFunction: DistanceFunction.DotProductSimilarity)]
public ReadOnlyMemory<float>? Embedding { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,6 @@ public record PineconeHotel()
[VectorStoreRecordData]
public string Description { get; set; }

[VectorStoreRecordVector(Dimensions: 8, IndexKind: null, DistanceFunction: DistanceFunction.DotProductSimilarity)]
[VectorStoreRecordVector(Dimensions: 8, DistanceFunction: DistanceFunction.DotProductSimilarity)]
public ReadOnlyMemory<float> DescriptionEmbedding { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ private sealed record PineconeRecordWithUnsupportedMetric
[VectorStoreRecordData]
public string? Name { get; set; }

[VectorStoreRecordVector(Dimensions: 5, IndexKind: null, DistanceFunction: "just eyeball it")]
[VectorStoreRecordVector(Dimensions: 5, DistanceFunction: "just eyeball it")]
public ReadOnlyMemory<float> Embedding { get; set; }
}
#pragma warning restore CA1812
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ public record HotelInfo()
public string Description { get; set; }

/// <summary>A vector field.</summary>
[VectorStoreRecordVector(VectorDimensions, IndexKind.Hnsw, DistanceFunction.ManhattanDistance)]
[VectorStoreRecordVector(VectorDimensions, DistanceFunction.ManhattanDistance, IndexKind.Hnsw)]
public ReadOnlyMemory<float>? DescriptionEmbedding { get; set; }
}

Expand All @@ -358,7 +358,7 @@ public record HotelInfoWithGuidId()
public string Description { get; set; }

/// <summary>A vector field.</summary>
[VectorStoreRecordVector(VectorDimensions, IndexKind.Hnsw, DistanceFunction.ManhattanDistance)]
[VectorStoreRecordVector(VectorDimensions, DistanceFunction.ManhattanDistance, IndexKind.Hnsw)]
public ReadOnlyMemory<float>? DescriptionEmbedding { get; set; }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ public sealed record WeaviateHotel
public DateTimeOffset Timestamp { get; set; }

/// <summary>A vector field.</summary>
[VectorStoreRecordVector(Dimensions: 4, IndexKind: IndexKind.Hnsw, DistanceFunction: DistanceFunction.CosineDistance)]
[VectorStoreRecordVector(Dimensions: 4, DistanceFunction: DistanceFunction.CosineDistance, IndexKind: IndexKind.Hnsw)]
public ReadOnlyMemory<float>? DescriptionEmbedding { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ private sealed class MultiPropsModel
[JsonPropertyName("json_data2")]
public string Data2 { get; set; } = string.Empty;

[VectorStoreRecordVector(4, IndexKind.Flat, DistanceFunction.DotProductSimilarity)]
[VectorStoreRecordVector(4, DistanceFunction.DotProductSimilarity, IndexKind.Flat)]
public ReadOnlyMemory<float> Vector1 { get; set; }

[VectorStoreRecordVector(StoragePropertyName = "storage_vector2")]
Expand Down

0 comments on commit cb7e534

Please sign in to comment.