-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into py-chat-history-reduce
- Loading branch information
Showing
17 changed files
with
225 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...grationTests/Connectors/Memory/Pinecone/CommonPineconeVectorStoreRecordCollectionTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
using System.Collections.Generic; | ||
using System.Diagnostics.CodeAnalysis; | ||
using Microsoft.Extensions.VectorData; | ||
using Microsoft.SemanticKernel.Connectors.Pinecone; | ||
using SemanticKernel.IntegrationTests.Connectors.Memory.Pinecone.Xunit; | ||
using Xunit; | ||
|
||
namespace SemanticKernel.IntegrationTests.Connectors.Memory.Pinecone; | ||
|
||
// Disable unused class warning, as this class is marked internal to disable the tests in the base class. | ||
#pragma warning disable CA1812 | ||
#pragma warning disable CA1852 | ||
|
||
/// <summary> | ||
/// Inherits common integration tests that should pass for any <see cref="IVectorStoreRecordCollection{TKey, TRecord}"/>. | ||
/// </summary> | ||
/// <param name="fixture">Pinecone setup and teardown.</param> | ||
[Collection("PineconeVectorStoreTests")] | ||
[PineconeApiKeySetCondition] | ||
internal class CommonPineconeVectorStoreRecordCollectionTests(PineconeVectorStoreFixture fixture) : BaseVectorStoreRecordCollectionTests<string>, IClassFixture<PineconeVectorStoreFixture> | ||
{ | ||
protected override string Key1 => "1"; | ||
protected override string Key2 => "2"; | ||
protected override string Key3 => "3"; | ||
protected override string Key4 => "4"; | ||
|
||
protected override int DelayAfterIndexCreateInMilliseconds => 2000; | ||
|
||
protected override int DelayAfterUploadInMilliseconds => 15000; | ||
|
||
[SuppressMessage("Globalization", "CA1308:Normalize strings to uppercase", Justification = "Pinecone collection names should be lower case.")] | ||
protected override IVectorStoreRecordCollection<string, TRecord> GetTargetRecordCollection<TRecord>(string recordCollectionName, VectorStoreRecordDefinition? vectorStoreRecordDefinition) | ||
{ | ||
return new PineconeVectorStoreRecordCollection<TRecord>(fixture.Client, recordCollectionName.ToLowerInvariant(), new() | ||
{ | ||
VectorStoreRecordDefinition = vectorStoreRecordDefinition | ||
}); | ||
} | ||
|
||
protected override HashSet<string> GetSupportedDistanceFunctions() | ||
{ | ||
return [DistanceFunction.CosineSimilarity, DistanceFunction.DotProductSimilarity, DistanceFunction.EuclideanSquaredDistance]; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...rationTests/Connectors/Memory/Redis/CommonRedisHashsetVectorStoreRecordCollectionTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
using System.Collections.Generic; | ||
using Microsoft.Extensions.VectorData; | ||
using Microsoft.SemanticKernel.Connectors.Redis; | ||
using Xunit; | ||
|
||
namespace SemanticKernel.IntegrationTests.Connectors.Memory.Redis; | ||
|
||
// Disable unused class warning, as this class is marked internal to disable the tests in the base class. | ||
#pragma warning disable CA1812 | ||
#pragma warning disable CA1852 | ||
|
||
/// <summary> | ||
/// Inherits common integration tests that should pass for any <see cref="IVectorStoreRecordCollection{TKey, TRecord}"/>. | ||
/// </summary> | ||
/// <param name="fixture">Redis setup and teardown.</param> | ||
[Collection("RedisVectorStoreCollection")] | ||
internal class CommonRedisHashsetVectorStoreRecordCollectionTests(RedisVectorStoreFixture fixture) : BaseVectorStoreRecordCollectionTests<string> | ||
{ | ||
protected override string Key1 => "1"; | ||
protected override string Key2 => "2"; | ||
protected override string Key3 => "3"; | ||
protected override string Key4 => "4"; | ||
|
||
protected override IVectorStoreRecordCollection<string, TRecord> GetTargetRecordCollection<TRecord>(string recordCollectionName, VectorStoreRecordDefinition? vectorStoreRecordDefinition) | ||
{ | ||
return new RedisHashSetVectorStoreRecordCollection<TRecord>(fixture.Database, recordCollectionName + "hashset", new() | ||
{ | ||
VectorStoreRecordDefinition = vectorStoreRecordDefinition | ||
}); | ||
} | ||
|
||
protected override HashSet<string> GetSupportedDistanceFunctions() | ||
{ | ||
// Excluding DotProductSimilarity from the test even though Redis supports it, because the values that redis returns | ||
// are neither DotProductSimilarity nor NegativeDotProduct, but rather 1 - DotProductSimilarity. | ||
return [DistanceFunction.CosineDistance, DistanceFunction.CosineSimilarity, DistanceFunction.EuclideanSquaredDistance]; | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
...tegrationTests/Connectors/Memory/Redis/CommonRedisJsonVectorStoreRecordCollectionTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
using System.Collections.Generic; | ||
using Microsoft.Extensions.VectorData; | ||
using Microsoft.SemanticKernel.Connectors.Redis; | ||
using Xunit; | ||
|
||
namespace SemanticKernel.IntegrationTests.Connectors.Memory.Redis; | ||
|
||
// Disable unused class warning, as this class is marked internal to disable the tests in the base class. | ||
#pragma warning disable CA1812 | ||
#pragma warning disable CA1852 | ||
|
||
/// <summary> | ||
/// Inherits common integration tests that should pass for any <see cref="IVectorStoreRecordCollection{TKey, TRecord}"/>. | ||
/// </summary> | ||
/// <param name="fixture">Redis setup and teardown.</param> | ||
[Collection("RedisVectorStoreCollection")] | ||
internal class CommonRedisJsonVectorStoreRecordCollectionTests(RedisVectorStoreFixture fixture) : BaseVectorStoreRecordCollectionTests<string> | ||
{ | ||
protected override string Key1 => "1"; | ||
protected override string Key2 => "2"; | ||
protected override string Key3 => "3"; | ||
protected override string Key4 => "4"; | ||
|
||
protected override IVectorStoreRecordCollection<string, TRecord> GetTargetRecordCollection<TRecord>(string recordCollectionName, VectorStoreRecordDefinition? vectorStoreRecordDefinition) | ||
{ | ||
return new RedisJsonVectorStoreRecordCollection<TRecord>(fixture.Database, recordCollectionName + "json", new() | ||
{ | ||
VectorStoreRecordDefinition = vectorStoreRecordDefinition | ||
}); | ||
} | ||
|
||
protected override HashSet<string> GetSupportedDistanceFunctions() | ||
{ | ||
// Excluding DotProductSimilarity from the test even though Redis supports it, because the values that redis returns | ||
// are neither DotProductSimilarity nor NegativeDotProduct, but rather 1 - DotProductSimilarity. | ||
return [DistanceFunction.CosineDistance, DistanceFunction.CosineSimilarity, DistanceFunction.EuclideanSquaredDistance]; | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
...grationTests/Connectors/Memory/Weaviate/CommonWeaviateVectorStoreRecordCollectionTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.Extensions.VectorData; | ||
using Microsoft.SemanticKernel.Connectors.Weaviate; | ||
using Xunit; | ||
|
||
namespace SemanticKernel.IntegrationTests.Connectors.Memory.Weaviate; | ||
|
||
/// <summary> | ||
/// Inherits common integration tests that should pass for any <see cref="IVectorStoreRecordCollection{TKey, TRecord}"/>. | ||
/// </summary> | ||
/// <param name="fixture">Weaviate setup and teardown.</param> | ||
[Collection("WeaviateVectorStoreCollection")] | ||
public class CommonWeaviateVectorStoreRecordCollectionTests(WeaviateVectorStoreFixture fixture) : BaseVectorStoreRecordCollectionTests<Guid> | ||
{ | ||
protected override Guid Key1 => new("11111111-1111-1111-1111-111111111111"); | ||
protected override Guid Key2 => new("22222222-2222-2222-2222-222222222222"); | ||
protected override Guid Key3 => new("33333333-3333-3333-3333-333333333333"); | ||
protected override Guid Key4 => new("44444444-4444-4444-4444-444444444444"); | ||
|
||
protected override int DelayAfterUploadInMilliseconds => 1000; | ||
|
||
protected override IVectorStoreRecordCollection<Guid, TRecord> GetTargetRecordCollection<TRecord>(string recordCollectionName, VectorStoreRecordDefinition? vectorStoreRecordDefinition) | ||
{ | ||
// Weaviate collection names must start with an upper case letter. | ||
var recordCollectionNameChars = recordCollectionName.ToCharArray(); | ||
recordCollectionNameChars[0] = char.ToUpperInvariant(recordCollectionNameChars[0]); | ||
|
||
return new WeaviateVectorStoreRecordCollection<TRecord>(fixture.HttpClient!, new string(recordCollectionNameChars), new() | ||
{ | ||
VectorStoreRecordDefinition = vectorStoreRecordDefinition | ||
}); | ||
} | ||
|
||
protected override HashSet<string> GetSupportedDistanceFunctions() | ||
{ | ||
return [DistanceFunction.CosineDistance, DistanceFunction.NegativeDotProductSimilarity, DistanceFunction.EuclideanSquaredDistance, DistanceFunction.Hamming, DistanceFunction.ManhattanDistance]; | ||
} | ||
} |