diff --git a/dotnet/samples/Concepts/Memory/VectorStoreLangchainInterop/AzureAISearchFactory.cs b/dotnet/samples/Concepts/Memory/VectorStoreLangchainInterop/AzureAISearchFactory.cs index 2bf0cb763a7a..f509373233d9 100644 --- a/dotnet/samples/Concepts/Memory/VectorStoreLangchainInterop/AzureAISearchFactory.cs +++ b/dotnet/samples/Concepts/Memory/VectorStoreLangchainInterop/AzureAISearchFactory.cs @@ -9,6 +9,8 @@ namespace Memory.VectorStoreLangchainInterop; +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete + /// /// Contains a factory method that can be used to create an Azure AI Search vector store that is compatible with datasets ingested using Langchain. /// diff --git a/dotnet/samples/Concepts/Memory/VectorStoreLangchainInterop/QdrantFactory.cs b/dotnet/samples/Concepts/Memory/VectorStoreLangchainInterop/QdrantFactory.cs index 53f0b399af82..79d149c24973 100644 --- a/dotnet/samples/Concepts/Memory/VectorStoreLangchainInterop/QdrantFactory.cs +++ b/dotnet/samples/Concepts/Memory/VectorStoreLangchainInterop/QdrantFactory.cs @@ -7,6 +7,8 @@ namespace Memory.VectorStoreLangchainInterop; +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete + /// /// Contains a factory method that can be used to create a Qdrant vector store that is compatible with datasets ingested using Langchain. /// diff --git a/dotnet/samples/Concepts/Memory/VectorStore_DataIngestion_CustomMapper.cs b/dotnet/samples/Concepts/Memory/VectorStore_DataIngestion_CustomMapper.cs index 3f86c763acbb..54928cddfb23 100644 --- a/dotnet/samples/Concepts/Memory/VectorStore_DataIngestion_CustomMapper.cs +++ b/dotnet/samples/Concepts/Memory/VectorStore_DataIngestion_CustomMapper.cs @@ -12,6 +12,8 @@ namespace Memory; +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete + /// /// An example showing how to ingest data into a vector store using with a custom mapper. /// In this example, the storage model differs significantly from the data model, so a custom mapper is used to map between the two. diff --git a/dotnet/samples/GettingStartedWithVectorStores/Step6_Use_CustomMapper.cs b/dotnet/samples/GettingStartedWithVectorStores/Step6_Use_CustomMapper.cs index cc86a773b0c0..383baeaae4fa 100644 --- a/dotnet/samples/GettingStartedWithVectorStores/Step6_Use_CustomMapper.cs +++ b/dotnet/samples/GettingStartedWithVectorStores/Step6_Use_CustomMapper.cs @@ -10,6 +10,8 @@ namespace GettingStartedWithVectorStores; +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete + /// /// Example that shows how you can use custom mappers if you wish the data model and storage schema to differ. /// diff --git a/dotnet/src/Connectors/Connectors.AzureCosmosDBMongoDB.UnitTests/AzureCosmosDBMongoDBVectorStoreRecordCollectionTests.cs b/dotnet/src/Connectors/Connectors.AzureCosmosDBMongoDB.UnitTests/AzureCosmosDBMongoDBVectorStoreRecordCollectionTests.cs index 840acf4a3c78..17d4cbb1939e 100644 --- a/dotnet/src/Connectors/Connectors.AzureCosmosDBMongoDB.UnitTests/AzureCosmosDBMongoDBVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/Connectors/Connectors.AzureCosmosDBMongoDB.UnitTests/AzureCosmosDBMongoDBVectorStoreRecordCollectionTests.cs @@ -489,6 +489,7 @@ await this.TestUpsertWithModelAsync( expectedPropertyName: "bson_hotel_name"); } +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete [Fact] public async Task UpsertWithCustomMapperWorksCorrectlyAsync() { @@ -564,6 +565,7 @@ public async Task GetWithCustomMapperWorksCorrectlyAsync() Assert.Equal(RecordKey, result.HotelId); Assert.Equal("Name from mapper", result.HotelName); } +#pragma warning restore CS0618 [Theory] [MemberData(nameof(VectorizedSearchVectorTypeData))] diff --git a/dotnet/src/Connectors/Connectors.AzureCosmosDBNoSQL.UnitTests/AzureCosmosDBNoSQLVectorStoreRecordCollectionTests.cs b/dotnet/src/Connectors/Connectors.AzureCosmosDBNoSQL.UnitTests/AzureCosmosDBNoSQLVectorStoreRecordCollectionTests.cs index ea45cc39b158..af141aac095c 100644 --- a/dotnet/src/Connectors/Connectors.AzureCosmosDBNoSQL.UnitTests/AzureCosmosDBNoSQLVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/Connectors/Connectors.AzureCosmosDBNoSQL.UnitTests/AzureCosmosDBNoSQLVectorStoreRecordCollectionTests.cs @@ -455,6 +455,7 @@ public async Task UpsertBatchReturnsRecordKeysAsync() Assert.Equal("key3", results[2]); } +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete [Fact] public async Task UpsertWithCustomMapperWorksCorrectlyAsync() { @@ -537,6 +538,7 @@ public async Task GetWithCustomMapperWorksCorrectlyAsync() Assert.Equal(RecordKey, result.HotelId); Assert.Equal("Name from mapper", result.HotelName); } +#pragma warning restore CS0618 [Fact] public async Task VectorizedSearchReturnsValidRecordAsync() diff --git a/dotnet/src/Connectors/Connectors.Memory.AzureAISearch/AzureAISearchGenericDataModelMapper.cs b/dotnet/src/Connectors/Connectors.Memory.AzureAISearch/AzureAISearchGenericDataModelMapper.cs index f63fdd32bc00..3ca40ca84d15 100644 --- a/dotnet/src/Connectors/Connectors.Memory.AzureAISearch/AzureAISearchGenericDataModelMapper.cs +++ b/dotnet/src/Connectors/Connectors.Memory.AzureAISearch/AzureAISearchGenericDataModelMapper.cs @@ -15,7 +15,9 @@ namespace Microsoft.SemanticKernel.Connectors.AzureAISearch; /// /// A mapper that maps between the generic Semantic Kernel data model and the model that the data is stored under, within Azure AI Search. /// +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete internal sealed class AzureAISearchGenericDataModelMapper(VectorStoreRecordModel model) : IVectorStoreRecordMapper, JsonObject> +#pragma warning restore CS0618 { /// public JsonObject MapFromDataToStorageModel(VectorStoreGenericDataModel dataModel) diff --git a/dotnet/src/Connectors/Connectors.Memory.AzureAISearch/AzureAISearchVectorStoreRecordCollection.cs b/dotnet/src/Connectors/Connectors.Memory.AzureAISearch/AzureAISearchVectorStoreRecordCollection.cs index 82d3bcc5fe2a..54bcc1ed33d3 100644 --- a/dotnet/src/Connectors/Connectors.Memory.AzureAISearch/AzureAISearchVectorStoreRecordCollection.cs +++ b/dotnet/src/Connectors/Connectors.Memory.AzureAISearch/AzureAISearchVectorStoreRecordCollection.cs @@ -52,7 +52,9 @@ public class AzureAISearchVectorStoreRecordCollection : private readonly AzureAISearchVectorStoreRecordCollectionOptions _options; /// A mapper to use for converting between the data model and the Azure AI Search record. +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete private readonly IVectorStoreRecordMapper? _mapper; +#pragma warning restore CS0618 /// The model for this collection. private readonly VectorStoreRecordModel _model; @@ -80,6 +82,7 @@ public AzureAISearchVectorStoreRecordCollection(SearchIndexClient searchIndexCli this._model = new VectorStoreRecordJsonModelBuilder(AzureAISearchConstants.s_modelBuildingOptions) .Build(typeof(TRecord), this._options.VectorStoreRecordDefinition, this._options.JsonSerializerOptions); +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete // Resolve mapper. // First, if someone has provided a custom mapper, use that. // If they didn't provide a custom mapper, and the record type is the generic data model, use the built in mapper for that. @@ -92,6 +95,7 @@ public AzureAISearchVectorStoreRecordCollection(SearchIndexClient searchIndexCli { this._mapper = new AzureAISearchGenericDataModelMapper(this._model) as IVectorStoreRecordMapper; } +#pragma warning restore CS0618 } /// diff --git a/dotnet/src/Connectors/Connectors.Memory.AzureAISearch/AzureAISearchVectorStoreRecordCollectionOptions.cs b/dotnet/src/Connectors/Connectors.Memory.AzureAISearch/AzureAISearchVectorStoreRecordCollectionOptions.cs index 5d2ec9c9bb23..5da63d55ffb8 100644 --- a/dotnet/src/Connectors/Connectors.Memory.AzureAISearch/AzureAISearchVectorStoreRecordCollectionOptions.cs +++ b/dotnet/src/Connectors/Connectors.Memory.AzureAISearch/AzureAISearchVectorStoreRecordCollectionOptions.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. +using System; using System.Text.Json; using System.Text.Json.Nodes; using Azure.Search.Documents.Indexes; @@ -18,6 +19,7 @@ public sealed class AzureAISearchVectorStoreRecordCollectionOptions /// /// If not set, the default mapper that is provided by the Azure AI Search client SDK will be used. /// + [Obsolete("Custom mappers are being obsoleted.")] public IVectorStoreRecordMapper? JsonObjectCustomMapper { get; init; } = null; /// diff --git a/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBMongoDB/AzureCosmosDBMongoDBVectorStoreRecordCollection.cs b/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBMongoDB/AzureCosmosDBMongoDBVectorStoreRecordCollection.cs index 5c1d705f0f1c..99ea67d05b07 100644 --- a/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBMongoDB/AzureCosmosDBMongoDBVectorStoreRecordCollection.cs +++ b/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBMongoDB/AzureCosmosDBMongoDBVectorStoreRecordCollection.cs @@ -48,7 +48,9 @@ public class AzureCosmosDBMongoDBVectorStoreRecordCollection : IVectorS private readonly AzureCosmosDBMongoDBVectorStoreRecordCollectionOptions _options; /// Interface for mapping between a storage model, and the consumer record data model. +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete private readonly IVectorStoreRecordMapper _mapper; +#pragma warning restore CS0618 /// The model for this collection. private readonly VectorStoreRecordModel _model; @@ -473,6 +475,7 @@ private static Dictionary GetStoragePropertyNames( return storagePropertyNames; } +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete /// /// Returns custom mapper, generic data model mapper or default record mapper. /// @@ -490,6 +493,7 @@ private IVectorStoreRecordMapper InitializeMapper() return new MongoDBVectorStoreRecordMapper(this._model); } +#pragma warning restore CS0618 #endregion } diff --git a/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBMongoDB/AzureCosmosDBMongoDBVectorStoreRecordCollectionOptions.cs b/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBMongoDB/AzureCosmosDBMongoDBVectorStoreRecordCollectionOptions.cs index d94c6c0956f1..7eb381a1095f 100644 --- a/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBMongoDB/AzureCosmosDBMongoDBVectorStoreRecordCollectionOptions.cs +++ b/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBMongoDB/AzureCosmosDBMongoDBVectorStoreRecordCollectionOptions.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. +using System; using Microsoft.Extensions.VectorData; using MongoDB.Bson; @@ -13,6 +14,7 @@ public sealed class AzureCosmosDBMongoDBVectorStoreRecordCollectionOptions /// Gets or sets an optional custom mapper to use when converting between the data model and the Azure CosmosDB MongoDB BSON object. /// + [Obsolete("Custom mappers are being obsoleted.")] public IVectorStoreRecordMapper? BsonDocumentCustomMapper { get; init; } = null; /// diff --git a/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLGenericDataModelMapper.cs b/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLGenericDataModelMapper.cs index b98177845ac2..6811764bf920 100644 --- a/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLGenericDataModelMapper.cs +++ b/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLGenericDataModelMapper.cs @@ -12,8 +12,10 @@ namespace Microsoft.SemanticKernel.Connectors.AzureCosmosDBNoSQL; /// /// A mapper that maps between the generic Semantic Kernel data model and the model that the data is stored under, within Azure CosmosDB NoSQL. /// +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete internal sealed class AzureCosmosDBNoSQLGenericDataModelMapper(VectorStoreRecordModel model, JsonSerializerOptions jsonSerializerOptions) : IVectorStoreRecordMapper, JsonObject> +#pragma warning restore CS0618 { /// A default for serialization/deserialization of vector properties. private static readonly JsonSerializerOptions s_vectorJsonSerializerOptions = new() diff --git a/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreRecordCollection.cs b/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreRecordCollection.cs index c291f84c3aa4..1bce4d37df73 100644 --- a/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreRecordCollection.cs +++ b/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreRecordCollection.cs @@ -52,7 +52,9 @@ public class AzureCosmosDBNoSQLVectorStoreRecordCollection : private readonly VectorStoreRecordPropertyModel _partitionKeyProperty; /// The mapper to use when mapping between the consumer data model and the Azure CosmosDB NoSQL record. +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete private readonly IVectorStoreRecordMapper _mapper; +#pragma warning restore CS0618 /// public string CollectionName { get; } @@ -664,6 +666,7 @@ private async IAsyncEnumerable> MapSearchResultsAsyn } } +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete private IVectorStoreRecordMapper InitializeMapper(JsonSerializerOptions jsonSerializerOptions) { if (this._options.JsonObjectCustomMapper is not null) @@ -679,6 +682,7 @@ private IVectorStoreRecordMapper InitializeMapper(JsonSeria return new AzureCosmosDBNoSQLVectorStoreRecordMapper(this._model.KeyProperty, this._options.JsonSerializerOptions); } +#pragma warning restore CS0618 #endregion } diff --git a/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreRecordCollectionOptions.cs b/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreRecordCollectionOptions.cs index 047cd2b56b6c..ff77da73dd19 100644 --- a/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreRecordCollectionOptions.cs +++ b/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreRecordCollectionOptions.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. +using System; using System.Text.Json; using System.Text.Json.Nodes; using Microsoft.Azure.Cosmos; @@ -18,6 +19,7 @@ public sealed class AzureCosmosDBNoSQLVectorStoreRecordCollectionOptions /// If not set, the default mapper that is provided by the Azure CosmosDB NoSQL client SDK will be used. /// + [Obsolete("Custom mappers are being obsoleted.")] public IVectorStoreRecordMapper? JsonObjectCustomMapper { get; init; } = null; /// diff --git a/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreRecordMapper.cs b/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreRecordMapper.cs index 4c1ad9e7071f..4667d3956b8e 100644 --- a/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreRecordMapper.cs +++ b/dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreRecordMapper.cs @@ -11,8 +11,10 @@ namespace Microsoft.SemanticKernel.Connectors.AzureCosmosDBNoSQL; /// Class for mapping between a json node stored in Azure CosmosDB NoSQL and the consumer data model. /// /// The consumer data model to map to or from. +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete internal sealed class AzureCosmosDBNoSQLVectorStoreRecordMapper(VectorStoreRecordKeyPropertyModel keyProperty, JsonSerializerOptions? jsonSerializerOptions) : IVectorStoreRecordMapper +#pragma warning restore CS0618 { private readonly VectorStoreRecordKeyPropertyModel _keyProperty = keyProperty; diff --git a/dotnet/src/Connectors/Connectors.Memory.MongoDB/MongoDBVectorStoreRecordCollection.cs b/dotnet/src/Connectors/Connectors.Memory.MongoDB/MongoDBVectorStoreRecordCollection.cs index 05577cf8a7d6..65788581b57d 100644 --- a/dotnet/src/Connectors/Connectors.Memory.MongoDB/MongoDBVectorStoreRecordCollection.cs +++ b/dotnet/src/Connectors/Connectors.Memory.MongoDB/MongoDBVectorStoreRecordCollection.cs @@ -48,7 +48,9 @@ public class MongoDBVectorStoreRecordCollection : IVectorStoreRecordCol private readonly MongoDBVectorStoreRecordCollectionOptions _options; /// Interface for mapping between a storage model, and the consumer record data model. +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete private readonly IVectorStoreRecordMapper _mapper; +#pragma warning restore CS0618 /// The model for this collection. private readonly VectorStoreRecordModel _model; @@ -597,6 +599,7 @@ private async Task RunOperationWithRetryAsync( throw new VectorStoreOperationException("Retry logic failed."); } +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete /// /// Returns custom mapper, generic data model mapper or default record mapper. /// @@ -614,6 +617,7 @@ private IVectorStoreRecordMapper InitializeMapper() return new MongoDBVectorStoreRecordMapper(this._model); } +#pragma warning restore CS0618 private static Array VerifyVectorParam(TVector vector) { diff --git a/dotnet/src/Connectors/Connectors.Memory.MongoDB/MongoDBVectorStoreRecordCollectionOptions.cs b/dotnet/src/Connectors/Connectors.Memory.MongoDB/MongoDBVectorStoreRecordCollectionOptions.cs index bc591f87cdc0..64ead70bdd47 100644 --- a/dotnet/src/Connectors/Connectors.Memory.MongoDB/MongoDBVectorStoreRecordCollectionOptions.cs +++ b/dotnet/src/Connectors/Connectors.Memory.MongoDB/MongoDBVectorStoreRecordCollectionOptions.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. +using System; using Microsoft.Extensions.VectorData; using MongoDB.Bson; @@ -13,6 +14,7 @@ public sealed class MongoDBVectorStoreRecordCollectionOptions /// /// Gets or sets an optional custom mapper to use when converting between the data model and the MongoDB BSON object. /// + [Obsolete("Custom mappers are being obsoleted.")] public IVectorStoreRecordMapper? BsonDocumentCustomMapper { get; init; } = null; /// diff --git a/dotnet/src/Connectors/Connectors.Memory.Pinecone/PineconeVectorStoreRecordCollection.cs b/dotnet/src/Connectors/Connectors.Memory.Pinecone/PineconeVectorStoreRecordCollection.cs index d8df1e4b9f2a..32bcfe852b09 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Pinecone/PineconeVectorStoreRecordCollection.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Pinecone/PineconeVectorStoreRecordCollection.cs @@ -29,7 +29,9 @@ public class PineconeVectorStoreRecordCollection : IVectorStoreRecordCo private readonly Sdk.PineconeClient _pineconeClient; private readonly PineconeVectorStoreRecordCollectionOptions _options; private readonly VectorStoreRecordModel _model; +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete private readonly IVectorStoreRecordMapper _mapper; +#pragma warning restore CS0618 private IndexClient? _indexClient; /// @@ -54,7 +56,9 @@ public PineconeVectorStoreRecordCollection(Sdk.PineconeClient pineconeClient, st this._model = new VectorStoreRecordModelBuilder(PineconeVectorStoreRecordFieldMapping.ModelBuildingOptions) .Build(typeof(TRecord), this._options.VectorStoreRecordDefinition); +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete this._mapper = this._options.VectorCustomMapper ?? new PineconeVectorStoreRecordMapper(this._model); +#pragma warning restore CS0618 } /// diff --git a/dotnet/src/Connectors/Connectors.Memory.Pinecone/PineconeVectorStoreRecordCollectionOptions.cs b/dotnet/src/Connectors/Connectors.Memory.Pinecone/PineconeVectorStoreRecordCollectionOptions.cs index feb147a75763..64c6b31b478a 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Pinecone/PineconeVectorStoreRecordCollectionOptions.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Pinecone/PineconeVectorStoreRecordCollectionOptions.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. +using System; using Microsoft.Extensions.VectorData; using Pinecone; @@ -13,6 +14,7 @@ public sealed class PineconeVectorStoreRecordCollectionOptions /// /// Gets or sets an optional custom mapper to use when converting between the data model and the Pinecone vector. /// + [Obsolete("Custom mappers are being obsoleted.")] public IVectorStoreRecordMapper? VectorCustomMapper { get; init; } = null; /// diff --git a/dotnet/src/Connectors/Connectors.Memory.Pinecone/PineconeVectorStoreRecordMapper.cs b/dotnet/src/Connectors/Connectors.Memory.Pinecone/PineconeVectorStoreRecordMapper.cs index 27e2017d3cf9..a1e8db6014a5 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Pinecone/PineconeVectorStoreRecordMapper.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Pinecone/PineconeVectorStoreRecordMapper.cs @@ -11,7 +11,9 @@ namespace Microsoft.SemanticKernel.Connectors.Pinecone; /// Mapper between a Pinecone record and the consumer data model that uses json as an intermediary to allow supporting a wide range of models. /// /// The consumer data model to map to or from. +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete internal sealed class PineconeVectorStoreRecordMapper(VectorStoreRecordModel model) : IVectorStoreRecordMapper +#pragma warning restore CS0618 { /// public Vector MapFromDataToStorageModel(TRecord dataModel) diff --git a/dotnet/src/Connectors/Connectors.Memory.Postgres/PostgresVectorStoreRecordCollection.cs b/dotnet/src/Connectors/Connectors.Memory.Postgres/PostgresVectorStoreRecordCollection.cs index eb7eeb43d20a..94393aab6221 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Postgres/PostgresVectorStoreRecordCollection.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Postgres/PostgresVectorStoreRecordCollection.cs @@ -35,7 +35,9 @@ public class PostgresVectorStoreRecordCollection : IVectorStoreRe private readonly VectorStoreRecordModel _model; /// A mapper to use for converting between the data model and the Azure AI Search record. +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete private readonly IVectorStoreRecordMapper> _mapper; +#pragma warning restore CS0618 /// The default options for vector search. private static readonly VectorSearchOptions s_defaultVectorSearchOptions = new(); @@ -74,7 +76,9 @@ internal PostgresVectorStoreRecordCollection(IPostgresVectorStoreDbClient client this._model = new VectorStoreRecordModelBuilder(PostgresConstants.ModelBuildingOptions) .Build(typeof(TRecord), options?.VectorStoreRecordDefinition); +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete this._mapper = this._options.DictionaryCustomMapper ?? new PostgresVectorStoreRecordMapper(this._model); +#pragma warning restore CS0618 } /// diff --git a/dotnet/src/Connectors/Connectors.Memory.Postgres/PostgresVectorStoreRecordCollectionOptions.cs b/dotnet/src/Connectors/Connectors.Memory.Postgres/PostgresVectorStoreRecordCollectionOptions.cs index 753713d21b3f..00a9a5624380 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Postgres/PostgresVectorStoreRecordCollectionOptions.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Postgres/PostgresVectorStoreRecordCollectionOptions.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. +using System; using System.Collections.Generic; using Microsoft.Extensions.VectorData; @@ -21,6 +22,7 @@ public sealed class PostgresVectorStoreRecordCollectionOptions /// /// If not set, the default mapper will be used. /// + [Obsolete("Custom mappers are being obsoleted.")] public IVectorStoreRecordMapper>? DictionaryCustomMapper { get; init; } = null; /// diff --git a/dotnet/src/Connectors/Connectors.Memory.Postgres/PostgresVectorStoreRecordMapper.cs b/dotnet/src/Connectors/Connectors.Memory.Postgres/PostgresVectorStoreRecordMapper.cs index 06b5c88b2ab0..13b73ce87489 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Postgres/PostgresVectorStoreRecordMapper.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Postgres/PostgresVectorStoreRecordMapper.cs @@ -13,8 +13,10 @@ namespace Microsoft.SemanticKernel.Connectors.Postgres; /// A mapper class that handles the conversion between data models and storage models for Postgres vector store. /// /// The type of the data model record. +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete internal sealed class PostgresVectorStoreRecordMapper(VectorStoreRecordModel model) : IVectorStoreRecordMapper> +#pragma warning restore CS0618 { public Dictionary MapFromDataToStorageModel(TRecord dataModel) { diff --git a/dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorStoreCollectionSearchMapping.cs b/dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorStoreCollectionSearchMapping.cs index 6991ce782e58..e1f4ed9411f0 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorStoreCollectionSearchMapping.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorStoreCollectionSearchMapping.cs @@ -98,7 +98,9 @@ public static Filter BuildFromLegacyFilter(VectorSearchFilter basicVectorSearchF /// The name of the collection the operation is being run on. /// The type of database operation being run. /// The mapped . +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete public static VectorSearchResult MapScoredPointToVectorSearchResult(ScoredPoint point, IVectorStoreRecordMapper mapper, bool includeVectors, string databaseSystemName, string collectionName, string operationName) +#pragma warning restore CS0618 { // Since the mapper doesn't know about scored points, we need to convert the scored point to a point struct first. var pointStruct = new PointStruct diff --git a/dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorStoreRecordCollection.cs b/dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorStoreRecordCollection.cs index e2f2d2bf37b8..5ff856fa4daa 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorStoreRecordCollection.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorStoreRecordCollection.cs @@ -54,7 +54,9 @@ public class QdrantVectorStoreRecordCollection : private readonly VectorStoreRecordModel _model; /// A mapper to use for converting between qdrant point and consumer models. +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete private readonly IVectorStoreRecordMapper _mapper; +#pragma warning restore CS0618 /// /// Initializes a new instance of the class. @@ -91,7 +93,9 @@ internal QdrantVectorStoreRecordCollection(MockableQdrantClient qdrantClient, st this._model = new VectorStoreRecordModelBuilder(QdrantVectorStoreRecordFieldMapping.GetModelBuildOptions(this._options.HasNamedVectors)) .Build(typeof(TRecord), this._options.VectorStoreRecordDefinition); +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete this._mapper = this._options.PointStructCustomMapper ?? new QdrantVectorStoreRecordMapper(this._model, this._options.HasNamedVectors); +#pragma warning restore CS0618 } /// diff --git a/dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorStoreRecordCollectionOptions.cs b/dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorStoreRecordCollectionOptions.cs index bdb1a8658e59..1b1289c799b6 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorStoreRecordCollectionOptions.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorStoreRecordCollectionOptions.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. +using System; using Microsoft.Extensions.VectorData; using Qdrant.Client.Grpc; @@ -22,6 +23,7 @@ public sealed class QdrantVectorStoreRecordCollectionOptions /// /// If not set, a default mapper that uses json as an intermediary to allow automatic mapping to a wide variety of types will be used. /// + [Obsolete("Custom mappers are being obsoleted.")] public IVectorStoreRecordMapper? PointStructCustomMapper { get; init; } = null; /// diff --git a/dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorStoreRecordMapper.cs b/dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorStoreRecordMapper.cs index 2929b455fd13..da07c10b3481 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorStoreRecordMapper.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Qdrant/QdrantVectorStoreRecordMapper.cs @@ -13,8 +13,10 @@ namespace Microsoft.SemanticKernel.Connectors.Qdrant; /// Mapper between a Qdrant record and the consumer data model that uses json as an intermediary to allow supporting a wide range of models. /// /// The consumer data model to map to or from. +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete internal sealed class QdrantVectorStoreRecordMapper(VectorStoreRecordModel model, bool hasNamedVectors) : IVectorStoreRecordMapper +#pragma warning restore CS0618 { /// public PointStruct MapFromDataToStorageModel(TRecord dataModel) diff --git a/dotnet/src/Connectors/Connectors.Memory.Redis/RedisHashSetGenericDataModelMapper.cs b/dotnet/src/Connectors/Connectors.Memory.Redis/RedisHashSetGenericDataModelMapper.cs index 2ed9a25ce0d2..ef3c42722845 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Redis/RedisHashSetGenericDataModelMapper.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Redis/RedisHashSetGenericDataModelMapper.cs @@ -12,7 +12,9 @@ namespace Microsoft.SemanticKernel.Connectors.Redis; /// /// A mapper that maps between the generic Semantic Kernel data model and the model that the data is stored under, within Redis when using hash sets. /// +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete internal sealed class RedisHashSetGenericDataModelMapper : IVectorStoreRecordMapper, (string Key, HashEntry[] HashEntries)> +#pragma warning restore CS0618 { /// All the properties from the record definition. private readonly IReadOnlyList _properties; diff --git a/dotnet/src/Connectors/Connectors.Memory.Redis/RedisHashSetVectorStoreRecordCollection.cs b/dotnet/src/Connectors/Connectors.Memory.Redis/RedisHashSetVectorStoreRecordCollection.cs index 74d5d0930f2a..36916c550c05 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Redis/RedisHashSetVectorStoreRecordCollection.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Redis/RedisHashSetVectorStoreRecordCollection.cs @@ -82,7 +82,9 @@ public class RedisHashSetVectorStoreRecordCollection : IVectorStoreReco private readonly string[] _dataStoragePropertyNamesWithScore; /// The mapper to use when mapping between the consumer data model and the Redis record. +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete private readonly IVectorStoreRecordMapper _mapper; +#pragma warning restore CS0618 /// /// Initializes a new instance of the class. @@ -108,7 +110,9 @@ public RedisHashSetVectorStoreRecordCollection(IDatabase database, string collec this._dataStoragePropertyNamesWithScore = [.. this._model.DataProperties.Select(p => p.StorageName), "vector_score"]; // Assign Mapper. +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete this._mapper = this._options.HashEntriesCustomMapper ?? new RedisHashSetVectorStoreRecordMapper(this._model); +#pragma warning restore CS0618 } /// diff --git a/dotnet/src/Connectors/Connectors.Memory.Redis/RedisHashSetVectorStoreRecordCollectionOptions.cs b/dotnet/src/Connectors/Connectors.Memory.Redis/RedisHashSetVectorStoreRecordCollectionOptions.cs index 8d61c1fb74ea..121262f92c5c 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Redis/RedisHashSetVectorStoreRecordCollectionOptions.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Redis/RedisHashSetVectorStoreRecordCollectionOptions.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. +using System; using Microsoft.Extensions.VectorData; using StackExchange.Redis; @@ -23,6 +24,7 @@ public sealed class RedisHashSetVectorStoreRecordCollectionOptions /// /// Gets or sets an optional custom mapper to use when converting between the data model and the Redis record. /// + [Obsolete("Custom mappers are being obsoleted.")] public IVectorStoreRecordMapper? HashEntriesCustomMapper { get; init; } = null; /// diff --git a/dotnet/src/Connectors/Connectors.Memory.Redis/RedisHashSetVectorStoreRecordMapper.cs b/dotnet/src/Connectors/Connectors.Memory.Redis/RedisHashSetVectorStoreRecordMapper.cs index 1223e025718b..520869d35c43 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Redis/RedisHashSetVectorStoreRecordMapper.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Redis/RedisHashSetVectorStoreRecordMapper.cs @@ -14,8 +14,10 @@ namespace Microsoft.SemanticKernel.Connectors.Redis; /// Class for mapping between a hashset stored in redis, and the consumer data model. /// /// The consumer data model to map to or from. +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete internal sealed class RedisHashSetVectorStoreRecordMapper(VectorStoreRecordModel model) : IVectorStoreRecordMapper +#pragma warning restore CS0618 { /// public (string Key, HashEntry[] HashEntries) MapFromDataToStorageModel(TConsumerDataModel dataModel) diff --git a/dotnet/src/Connectors/Connectors.Memory.Redis/RedisJsonGenericDataModelMapper.cs b/dotnet/src/Connectors/Connectors.Memory.Redis/RedisJsonGenericDataModelMapper.cs index ea0ac812674a..41a4efb63575 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Redis/RedisJsonGenericDataModelMapper.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Redis/RedisJsonGenericDataModelMapper.cs @@ -14,7 +14,9 @@ namespace Microsoft.SemanticKernel.Connectors.Redis; internal sealed class RedisJsonGenericDataModelMapper( IReadOnlyList properties, JsonSerializerOptions jsonSerializerOptions) +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete : IVectorStoreRecordMapper, (string Key, JsonNode Node)> +#pragma warning restore CS0618 { /// public (string Key, JsonNode Node) MapFromDataToStorageModel(VectorStoreGenericDataModel dataModel) diff --git a/dotnet/src/Connectors/Connectors.Memory.Redis/RedisJsonVectorStoreRecordCollection.cs b/dotnet/src/Connectors/Connectors.Memory.Redis/RedisJsonVectorStoreRecordCollection.cs index b267cf0bef3b..ef6f48e33857 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Redis/RedisJsonVectorStoreRecordCollection.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Redis/RedisJsonVectorStoreRecordCollection.cs @@ -70,7 +70,9 @@ public class RedisJsonVectorStoreRecordCollection : IVectorStoreRecordC private readonly string[] _dataStoragePropertyNames; /// The mapper to use when mapping between the consumer data model and the Redis record. +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete private readonly IVectorStoreRecordMapper _mapper; +#pragma warning restore CS0618 /// The JSON serializer options to use when converting between the data model and the Redis record. private readonly JsonSerializerOptions _jsonSerializerOptions; @@ -99,6 +101,7 @@ public RedisJsonVectorStoreRecordCollection(IDatabase database, string collectio // Lookup storage property names. this._dataStoragePropertyNames = this._model.DataProperties.Select(p => p.StorageName).ToArray(); +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete // Assign Mapper. if (this._options.JsonNodeCustomMapper is not null) { @@ -117,6 +120,7 @@ public RedisJsonVectorStoreRecordCollection(IDatabase database, string collectio // Default Mapper. this._mapper = new RedisJsonVectorStoreRecordMapper(this._model.KeyProperty, this._jsonSerializerOptions); } +#pragma warning restore CS0618 } /// diff --git a/dotnet/src/Connectors/Connectors.Memory.Redis/RedisJsonVectorStoreRecordCollectionOptions.cs b/dotnet/src/Connectors/Connectors.Memory.Redis/RedisJsonVectorStoreRecordCollectionOptions.cs index d5f8696fc30d..24a3f342a755 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Redis/RedisJsonVectorStoreRecordCollectionOptions.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Redis/RedisJsonVectorStoreRecordCollectionOptions.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. +using System; using System.Text.Json; using System.Text.Json.Nodes; using Microsoft.Extensions.VectorData; @@ -27,6 +28,7 @@ public sealed class RedisJsonVectorStoreRecordCollectionOptions /// /// If not set, the default built in mapper will be used, which uses record attrigutes or the provided to map the record. /// + [Obsolete("Custom mappers are being obsoleted.")] public IVectorStoreRecordMapper? JsonNodeCustomMapper { get; init; } = null; /// diff --git a/dotnet/src/Connectors/Connectors.Memory.Redis/RedisJsonVectorStoreRecordMapper.cs b/dotnet/src/Connectors/Connectors.Memory.Redis/RedisJsonVectorStoreRecordMapper.cs index 3efa31400415..b128be837bfb 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Redis/RedisJsonVectorStoreRecordMapper.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Redis/RedisJsonVectorStoreRecordMapper.cs @@ -14,7 +14,9 @@ namespace Microsoft.SemanticKernel.Connectors.Redis; internal sealed class RedisJsonVectorStoreRecordMapper( VectorStoreRecordKeyPropertyModel keyProperty, JsonSerializerOptions jsonSerializerOptions) +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete : IVectorStoreRecordMapper +#pragma warning restore CS0618 { /// The key property. private readonly string _keyPropertyStorageName = keyProperty.StorageName; diff --git a/dotnet/src/Connectors/Connectors.Memory.SqlServer/RecordMapper.cs b/dotnet/src/Connectors/Connectors.Memory.SqlServer/RecordMapper.cs index 1628948668b8..963d5f266128 100644 --- a/dotnet/src/Connectors/Connectors.Memory.SqlServer/RecordMapper.cs +++ b/dotnet/src/Connectors/Connectors.Memory.SqlServer/RecordMapper.cs @@ -7,7 +7,9 @@ namespace Microsoft.SemanticKernel.Connectors.SqlServer; +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete internal sealed class RecordMapper(VectorStoreRecordModel model) : IVectorStoreRecordMapper> +#pragma warning restore CS0618 { public IDictionary MapFromDataToStorageModel(TRecord dataModel) { diff --git a/dotnet/src/Connectors/Connectors.Memory.SqlServer/SqlServerVectorStoreRecordCollection.cs b/dotnet/src/Connectors/Connectors.Memory.SqlServer/SqlServerVectorStoreRecordCollection.cs index e95ba5cb07d5..19be43247293 100644 --- a/dotnet/src/Connectors/Connectors.Memory.SqlServer/SqlServerVectorStoreRecordCollection.cs +++ b/dotnet/src/Connectors/Connectors.Memory.SqlServer/SqlServerVectorStoreRecordCollection.cs @@ -26,7 +26,9 @@ public sealed class SqlServerVectorStoreRecordCollection private readonly string _connectionString; private readonly SqlServerVectorStoreRecordCollectionOptions _options; private readonly VectorStoreRecordModel _model; +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete private readonly IVectorStoreRecordMapper> _mapper; +#pragma warning restore CS0618 /// /// Initializes a new instance of the class. @@ -49,6 +51,7 @@ public SqlServerVectorStoreRecordCollection( this.CollectionName = name; // We need to create a copy, so any changes made to the option bag after // the ctor call do not affect this instance. +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete this._options = options is null ? s_defaultOptions : new() @@ -59,6 +62,7 @@ public SqlServerVectorStoreRecordCollection( }; this._mapper = this._options.Mapper ?? new RecordMapper(this._model); +#pragma warning restore CS0618 } /// diff --git a/dotnet/src/Connectors/Connectors.Memory.SqlServer/SqlServerVectorStoreRecordCollectionOptions.cs b/dotnet/src/Connectors/Connectors.Memory.SqlServer/SqlServerVectorStoreRecordCollectionOptions.cs index 6b21a5e35842..d8bfd40a2217 100644 --- a/dotnet/src/Connectors/Connectors.Memory.SqlServer/SqlServerVectorStoreRecordCollectionOptions.cs +++ b/dotnet/src/Connectors/Connectors.Memory.SqlServer/SqlServerVectorStoreRecordCollectionOptions.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. +using System; using System.Collections.Generic; using Microsoft.Extensions.VectorData; @@ -21,6 +22,7 @@ public sealed class SqlServerVectorStoreRecordCollectionOptions /// /// If not set, the default mapper will be used. /// + [Obsolete("Custom mappers are being obsoleted.")] public IVectorStoreRecordMapper>? Mapper { get; init; } /// diff --git a/dotnet/src/Connectors/Connectors.Memory.Sqlite/SqliteVectorStoreRecordCollection.cs b/dotnet/src/Connectors/Connectors.Memory.Sqlite/SqliteVectorStoreRecordCollection.cs index 55ccffb60a9c..8f6e87c32242 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Sqlite/SqliteVectorStoreRecordCollection.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Sqlite/SqliteVectorStoreRecordCollection.cs @@ -34,7 +34,9 @@ public class SqliteVectorStoreRecordCollection : private readonly SqliteVectorStoreRecordCollectionOptions _options; /// The mapper to use when mapping between the consumer data model and the SQLite record. +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete private readonly IVectorStoreRecordMapper> _mapper; +#pragma warning restore CS0618 /// The default options for vector search. private static readonly VectorSearchOptions s_defaultVectorSearchOptions = new(); @@ -130,7 +132,9 @@ public SqliteVectorStoreRecordCollection( } } +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete this._mapper = this._options.DictionaryCustomMapper ?? new SqliteVectorStoreRecordMapper(this._model); +#pragma warning restore CS0618 } /// diff --git a/dotnet/src/Connectors/Connectors.Memory.Sqlite/SqliteVectorStoreRecordCollectionOptions.cs b/dotnet/src/Connectors/Connectors.Memory.Sqlite/SqliteVectorStoreRecordCollectionOptions.cs index 90c06511826b..a6cc642af863 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Sqlite/SqliteVectorStoreRecordCollectionOptions.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Sqlite/SqliteVectorStoreRecordCollectionOptions.cs @@ -1,5 +1,6 @@ // Copyright (c) Microsoft. All rights reserved. +using System; using System.Collections.Generic; using Microsoft.Extensions.VectorData; @@ -13,6 +14,7 @@ public sealed class SqliteVectorStoreRecordCollectionOptions /// /// Gets or sets an optional custom mapper to use when converting between the data model and the SQLite record. /// + [Obsolete("Custom mappers are being obsoleted.")] public IVectorStoreRecordMapper>? DictionaryCustomMapper { get; set; } /// diff --git a/dotnet/src/Connectors/Connectors.Memory.Sqlite/SqliteVectorStoreRecordMapper.cs b/dotnet/src/Connectors/Connectors.Memory.Sqlite/SqliteVectorStoreRecordMapper.cs index d39a5d343f93..8acd276cdb74 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Sqlite/SqliteVectorStoreRecordMapper.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Sqlite/SqliteVectorStoreRecordMapper.cs @@ -11,7 +11,9 @@ namespace Microsoft.SemanticKernel.Connectors.Sqlite; /// Class for mapping between a dictionary and the consumer data model. /// /// The consumer data model to map to or from. +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete internal sealed class SqliteVectorStoreRecordMapper(VectorStoreRecordModel model) : IVectorStoreRecordMapper> +#pragma warning restore CS0618 { public Dictionary MapFromDataToStorageModel(TRecord dataModel) { diff --git a/dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateGenericDataModelMapper.cs b/dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateGenericDataModelMapper.cs index aed7448293df..9b981631384a 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateGenericDataModelMapper.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateGenericDataModelMapper.cs @@ -12,7 +12,9 @@ namespace Microsoft.SemanticKernel.Connectors.Weaviate; /// /// A mapper that maps between the generic Semantic Kernel data model and the model that the data is stored under, within Weaviate. /// +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete internal sealed class WeaviateGenericDataModelMapper : IVectorStoreRecordMapper, JsonObject> +#pragma warning restore CS0618 { /// The name of the Weaviate collection. private readonly string _collectionName; diff --git a/dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateVectorStoreRecordCollection.cs b/dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateVectorStoreRecordCollection.cs index a740b1dfd414..aa3e934153ec 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateVectorStoreRecordCollection.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateVectorStoreRecordCollection.cs @@ -51,7 +51,9 @@ public class WeaviateVectorStoreRecordCollection : IVectorStoreRecordCo private readonly VectorStoreRecordModel _model; /// The mapper to use when mapping between the consumer data model and the Weaviate record. +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete private readonly IVectorStoreRecordMapper _mapper; +#pragma warning restore CS0618 /// Weaviate endpoint. private readonly Uri _endpoint; @@ -418,6 +420,7 @@ private async Task RunOperationAsync(string operationName, Func> o /// /// Returns custom mapper, generic data model mapper or default record mapper. /// +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete private IVectorStoreRecordMapper InitializeMapper() { if (this._options.JsonObjectCustomMapper is not null) @@ -434,6 +437,7 @@ private IVectorStoreRecordMapper InitializeMapper() return new WeaviateVectorStoreRecordMapper(this.CollectionName, this._model, s_jsonSerializerOptions); } +#pragma warning restore CS0618 private static void VerifyVectorParam(TVector vector) { diff --git a/dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateVectorStoreRecordCollectionOptions.cs b/dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateVectorStoreRecordCollectionOptions.cs index 9f812e489dcf..7dff47f28d0e 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateVectorStoreRecordCollectionOptions.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateVectorStoreRecordCollectionOptions.cs @@ -14,6 +14,7 @@ public sealed class WeaviateVectorStoreRecordCollectionOptions /// /// Gets or sets an optional custom mapper to use when converting between the data model and Weaviate record. /// + [Obsolete("Custom mappers are being obsoleted.")] public IVectorStoreRecordMapper? JsonObjectCustomMapper { get; init; } = null; /// diff --git a/dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateVectorStoreRecordMapper.cs b/dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateVectorStoreRecordMapper.cs index 37a762ece30c..93edfdaadd96 100644 --- a/dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateVectorStoreRecordMapper.cs +++ b/dotnet/src/Connectors/Connectors.Memory.Weaviate/WeaviateVectorStoreRecordMapper.cs @@ -8,7 +8,9 @@ namespace Microsoft.SemanticKernel.Connectors.Weaviate; +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete internal sealed class WeaviateVectorStoreRecordMapper : IVectorStoreRecordMapper +#pragma warning restore CS0618 { private readonly string _collectionName; private readonly VectorStoreRecordModel _model; diff --git a/dotnet/src/Connectors/Connectors.MongoDB.UnitTests/MongoDBVectorStoreRecordCollectionTests.cs b/dotnet/src/Connectors/Connectors.MongoDB.UnitTests/MongoDBVectorStoreRecordCollectionTests.cs index 5b5efb539d91..93ecc470d179 100644 --- a/dotnet/src/Connectors/Connectors.MongoDB.UnitTests/MongoDBVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/Connectors/Connectors.MongoDB.UnitTests/MongoDBVectorStoreRecordCollectionTests.cs @@ -489,6 +489,7 @@ await this.TestUpsertWithModelAsync( expectedPropertyName: "bson_hotel_name"); } +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete [Fact] public async Task UpsertWithCustomMapperWorksCorrectlyAsync() { @@ -564,6 +565,7 @@ public async Task GetWithCustomMapperWorksCorrectlyAsync() Assert.Equal(RecordKey, result.HotelId); Assert.Equal("Name from mapper", result.HotelName); } +#pragma warning restore CS0618 [Theory] [MemberData(nameof(VectorizedSearchVectorTypeData))] diff --git a/dotnet/src/Connectors/Connectors.Pinecone.UnitTests/PineconeVectorStoreRecordCollectionTests.cs b/dotnet/src/Connectors/Connectors.Pinecone.UnitTests/PineconeVectorStoreRecordCollectionTests.cs index e9b3a8e3cf17..f6aa343fbaef 100644 --- a/dotnet/src/Connectors/Connectors.Pinecone.UnitTests/PineconeVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/Connectors/Connectors.Pinecone.UnitTests/PineconeVectorStoreRecordCollectionTests.cs @@ -17,6 +17,7 @@ public class PineconeVectorStoreRecordCollectionTests { private const string TestCollectionName = "testcollection"; +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete /// /// Tests that the collection can be created even if the definition and the type do not match. /// In this case, the expectation is that a custom mapper will be provided to map between the @@ -43,6 +44,7 @@ public void CanCreateCollectionWithMismatchedDefinitionAndType() TestCollectionName, new() { VectorStoreRecordDefinition = definition, VectorCustomMapper = Mock.Of>() }); } +#pragma warning restore CS0618 public sealed class SinglePropsModel { diff --git a/dotnet/src/Connectors/Connectors.Qdrant.UnitTests/QdrantVectorStoreRecordCollectionTests.cs b/dotnet/src/Connectors/Connectors.Qdrant.UnitTests/QdrantVectorStoreRecordCollectionTests.cs index 06e97c33cc43..d917a20c505a 100644 --- a/dotnet/src/Connectors/Connectors.Qdrant.UnitTests/QdrantVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/Connectors/Connectors.Qdrant.UnitTests/QdrantVectorStoreRecordCollectionTests.cs @@ -253,6 +253,7 @@ public async Task CanGetManyRecordsWithVectorsAsync(bool useDefinition, bo Assert.Equal(testRecordKeys[1], actual[1].Key); } +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete [Fact] public async Task CanGetRecordWithCustomMapperAsync() { @@ -298,6 +299,7 @@ public async Task CanGetRecordWithCustomMapperAsync() It.Is(x => x.IncludeVectors)), Times.Once); } +#pragma warning restore CS0618 [Theory] [InlineData(true, true)] @@ -479,6 +481,7 @@ public async Task CanUpsertManyRecordsAsync(bool useDefinition, bool hasNa Times.Once); } +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete [Fact] public async Task CanUpsertRecordWithCustomMapperAsync() { @@ -544,6 +547,7 @@ public void CanCreateCollectionWithMismatchedDefinitionAndType() TestCollectionName, new() { VectorStoreRecordDefinition = definition, PointStructCustomMapper = Mock.Of, PointStruct>>() }); } +#pragma warning restore CS0618 #pragma warning disable CS0618 // VectorSearchFilter is obsolete [Theory] diff --git a/dotnet/src/Connectors/Connectors.Redis.UnitTests/RedisHashSetVectorStoreRecordCollectionTests.cs b/dotnet/src/Connectors/Connectors.Redis.UnitTests/RedisHashSetVectorStoreRecordCollectionTests.cs index 6dd99624bf42..a2996b31b2c0 100644 --- a/dotnet/src/Connectors/Connectors.Redis.UnitTests/RedisHashSetVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/Connectors/Connectors.Redis.UnitTests/RedisHashSetVectorStoreRecordCollectionTests.cs @@ -236,6 +236,7 @@ public async Task CanGetManyRecordsWithVectorsAsync(bool useDefinition) Assert.Equal(new float[] { 5, 6, 7, 8 }, actual[1].Vector!.Value.ToArray()); } +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete [Fact] public async Task CanGetRecordWithCustomMapperAsync() { @@ -284,6 +285,7 @@ public async Task CanGetRecordWithCustomMapperAsync() It.Is(x => x.IncludeVectors)), Times.Once); } +#pragma warning restore CS0618 [Theory] [InlineData(true)] @@ -375,6 +377,7 @@ public async Task CanUpsertManyRecordsAsync(bool useDefinition) Times.Once); } +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete [Fact] public async Task CanUpsertRecordWithCustomMapperAsync() { @@ -414,6 +417,7 @@ public async Task CanUpsertRecordWithCustomMapperAsync() x => x.MapFromDataToStorageModel(It.Is(x => x == model)), Times.Once); } +#pragma warning restore CS0618 #pragma warning disable CS0618 // VectorSearchFilter is obsolete [Theory] @@ -511,6 +515,7 @@ public async Task CanSearchWithVectorAndFilterAsync(bool useDefinition, bool inc } #pragma warning restore CS0618 // VectorSearchFilter is obsolete +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete /// /// Tests that the collection can be created even if the definition and the type do not match. /// In this case, the expectation is that a custom mapper will be provided to map between the @@ -536,6 +541,7 @@ public void CanCreateCollectionWithMismatchedDefinitionAndType() TestCollectionName, new() { VectorStoreRecordDefinition = definition, HashEntriesCustomMapper = Mock.Of>() }); } +#pragma warning restore CS0618 private RedisHashSetVectorStoreRecordCollection CreateRecordCollection(bool useDefinition) { diff --git a/dotnet/src/Connectors/Connectors.Weaviate.UnitTests/WeaviateVectorStoreRecordCollectionTests.cs b/dotnet/src/Connectors/Connectors.Weaviate.UnitTests/WeaviateVectorStoreRecordCollectionTests.cs index 373b7f836c00..5c456296ff89 100644 --- a/dotnet/src/Connectors/Connectors.Weaviate.UnitTests/WeaviateVectorStoreRecordCollectionTests.cs +++ b/dotnet/src/Connectors/Connectors.Weaviate.UnitTests/WeaviateVectorStoreRecordCollectionTests.cs @@ -349,6 +349,7 @@ public async Task UpsertReturnsRecordKeysAsync() Assert.Equal("Test Name 2", jsonObject2["properties"]?["hotelName"]?.GetValue()); } +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete [Fact] public async Task UpsertWithCustomMapperWorksCorrectlyAsync() { @@ -427,6 +428,7 @@ public async Task GetWithCustomMapperWorksCorrectlyAsync() Assert.Equal(id, result.HotelId); Assert.Equal("Test Name from mapper", result.HotelName); } +#pragma warning restore CS0618 [Theory] [InlineData(true, "http://test-endpoint/schema", "Bearer fake-key")] diff --git a/dotnet/src/Connectors/VectorData.Abstractions/VectorStorage/IVectorStoreRecordMapper.cs b/dotnet/src/Connectors/VectorData.Abstractions/VectorStorage/IVectorStoreRecordMapper.cs index 3bac47a89121..3af4f5315871 100644 --- a/dotnet/src/Connectors/VectorData.Abstractions/VectorStorage/IVectorStoreRecordMapper.cs +++ b/dotnet/src/Connectors/VectorData.Abstractions/VectorStorage/IVectorStoreRecordMapper.cs @@ -1,5 +1,7 @@ // Copyright (c) Microsoft. All rights reserved. +using System; + namespace Microsoft.Extensions.VectorData; /// @@ -7,6 +9,7 @@ namespace Microsoft.Extensions.VectorData; /// /// The consumer record data model to map to or from. /// The storage model to map to or from. +[Obsolete("Custom mappers are being obsoleted.")] public interface IVectorStoreRecordMapper { /// diff --git a/dotnet/src/InternalUtilities/connectors/Memory/MongoDB/MongoDBGenericDataModelMapper.cs b/dotnet/src/InternalUtilities/connectors/Memory/MongoDB/MongoDBGenericDataModelMapper.cs index ea48950a8a9a..4ac5b274c819 100644 --- a/dotnet/src/InternalUtilities/connectors/Memory/MongoDB/MongoDBGenericDataModelMapper.cs +++ b/dotnet/src/InternalUtilities/connectors/Memory/MongoDB/MongoDBGenericDataModelMapper.cs @@ -16,7 +16,9 @@ namespace Microsoft.SemanticKernel.Connectors.MongoDB; /// A mapper that maps between the generic Semantic Kernel data model and the model that the data is stored under, within MongoDB. /// [ExcludeFromCodeCoverage] +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete internal sealed class MongoDBGenericDataModelMapper(VectorStoreRecordModel model) : IVectorStoreRecordMapper, BsonDocument> +#pragma warning restore CS0618 { /// public BsonDocument MapFromDataToStorageModel(VectorStoreGenericDataModel dataModel) diff --git a/dotnet/src/InternalUtilities/connectors/Memory/MongoDB/MongoDBVectorStoreRecordMapper.cs b/dotnet/src/InternalUtilities/connectors/Memory/MongoDB/MongoDBVectorStoreRecordMapper.cs index e2d52adfea61..78dd7c931419 100644 --- a/dotnet/src/InternalUtilities/connectors/Memory/MongoDB/MongoDBVectorStoreRecordMapper.cs +++ b/dotnet/src/InternalUtilities/connectors/Memory/MongoDB/MongoDBVectorStoreRecordMapper.cs @@ -13,7 +13,9 @@ namespace Microsoft.SemanticKernel.Connectors.MongoDB; [ExcludeFromCodeCoverage] +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete internal sealed class MongoDBVectorStoreRecordMapper : IVectorStoreRecordMapper +#pragma warning restore CS0618 { /// A key property info of the data model. private readonly PropertyInfo? _keyClrProperty; diff --git a/dotnet/src/VectorDataIntegrationTests/SqlServerIntegrationTests/SqlServerVectorStoreTests.cs b/dotnet/src/VectorDataIntegrationTests/SqlServerIntegrationTests/SqlServerVectorStoreTests.cs index 0c2f56a59c3e..41ae4910bfb4 100644 --- a/dotnet/src/VectorDataIntegrationTests/SqlServerIntegrationTests/SqlServerVectorStoreTests.cs +++ b/dotnet/src/VectorDataIntegrationTests/SqlServerIntegrationTests/SqlServerVectorStoreTests.cs @@ -150,6 +150,7 @@ public async Task WrongModels() } } +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete [ConditionalFact] public async Task CustomMapper() { @@ -201,6 +202,7 @@ public async Task CustomMapper() await collection.DeleteCollectionAsync(); } } +#pragma warning restore CS0618 [ConditionalFact] public async Task BatchCRUD() @@ -467,6 +469,7 @@ public sealed class FancyTestModel public ReadOnlyMemory Floats { get; set; } } +#pragma warning disable CS0618 // IVectorStoreRecordMapper is obsolete private sealed class TestModelMapper : IVectorStoreRecordMapper> { internal bool MapFromDataToStorageModel_WasCalled { get; set; } @@ -499,4 +502,5 @@ public TestModel MapFromStorageToDataModel(IDictionary storageM }; } } +#pragma warning restore CS0618 }