Skip to content

Commit a369be9

Browse files
authored
[MEDI] Remove collection key type workaround (#7010)
1 parent 57004d9 commit a369be9

File tree

3 files changed

+8
-10
lines changed

3 files changed

+8
-10
lines changed

eng/Versions.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@
170170
<XUnitRunnerVisualStudioVersion>2.8.2</XUnitRunnerVisualStudioVersion>
171171
<!-- MEVD is still part of the Semantic Kernel repo -->
172172
<MicrosoftExtensionsVectorDataAbstractionsVersion>9.7.0</MicrosoftExtensionsVectorDataAbstractionsVersion>
173-
<MicrosoftSemanticKernelConnectorsVersion>1.66.0-preview</MicrosoftSemanticKernelConnectorsVersion>
173+
<MicrosoftSemanticKernelConnectorsVersion>1.67.0-preview</MicrosoftSemanticKernelConnectorsVersion>
174174
<MarkdigSignedVersion>0.43.0</MarkdigSignedVersion>
175175
</PropertyGroup>
176176
</Project>

src/Libraries/Microsoft.Extensions.DataIngestion/Microsoft.Extensions.DataIngestion.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,9 @@
2323
<PackageReference Include="Microsoft.ML.Tokenizers" />
2424
</ItemGroup>
2525

26+
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
27+
<!-- Workaround https://github.com/microsoft/semantic-kernel/issues/13316 -->
28+
<PackageReference Include="System.Text.Json" VersionOverride="$(SystemTextJsonVersion)" />
29+
</ItemGroup>
30+
2631
</Project>

src/Libraries/Microsoft.Extensions.DataIngestion/Writers/VectorStoreWriter.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public sealed class VectorStoreWriter<T> : IngestionChunkWriter<T>
2626
private readonly VectorStore _vectorStore;
2727
private readonly int _dimensionCount;
2828
private readonly VectorStoreWriterOptions _options;
29-
private readonly bool _keysAreStrings;
3029

3130
private VectorStoreCollection<object, Dictionary<string, object?>>? _vectorStoreCollection;
3231

@@ -43,12 +42,6 @@ public VectorStoreWriter(VectorStore vectorStore, int dimensionCount, VectorStor
4342
_vectorStore = Throw.IfNull(vectorStore);
4443
_dimensionCount = Throw.IfLessThanOrEqual(dimensionCount, 0);
4544
_options = options ?? new VectorStoreWriterOptions();
46-
47-
// Not all vector store support string as the key type, examples:
48-
// Qdrant: https://github.com/microsoft/semantic-kernel/blob/28ea2f4df872e8fd03ef0792ebc9e1989b4be0ee/dotnet/src/VectorData/Qdrant/QdrantCollection.cs#L104
49-
// When https://github.com/microsoft/semantic-kernel/issues/13141 gets released,
50-
// we need to remove this workaround.
51-
_keysAreStrings = vectorStore.GetType().Name != "QdrantVectorStore";
5245
}
5346

5447
/// <summary>
@@ -85,7 +78,7 @@ public override async Task WriteAsync(IAsyncEnumerable<IngestionChunk<T>> chunks
8578
var key = Guid.NewGuid();
8679
Dictionary<string, object?> record = new()
8780
{
88-
[KeyName] = _keysAreStrings ? key.ToString() : key,
81+
[KeyName] = key,
8982
[ContentName] = chunk.Content,
9083
[EmbeddingName] = chunk.Content,
9184
[ContextName] = chunk.Context,
@@ -129,7 +122,7 @@ private VectorStoreCollectionDefinition GetVectorStoreRecordDefinition(Ingestion
129122
{
130123
Properties =
131124
{
132-
new VectorStoreKeyProperty(KeyName, _keysAreStrings ? typeof(string) : typeof(Guid)),
125+
new VectorStoreKeyProperty(KeyName, typeof(Guid)),
133126

134127
// By using T as the type here we allow the vector store
135128
// to handle the conversion from T to the actual vector type it supports.

0 commit comments

Comments
 (0)