diff --git a/docs/ai/vector-stores/define-your-data-model.md b/docs/ai/vector-stores/define-your-data-model.md index b15e63d5e594d..79389a89f49ad 100644 --- a/docs/ai/vector-stores/define-your-data-model.md +++ b/docs/ai/vector-stores/define-your-data-model.md @@ -127,7 +127,7 @@ Use the attrib It's also possible to use on properties that don't have a vector type, for example, a property of type `string`. When a property is decorated in this way, you need to provide an instance to the vector store. When upserting the record, the text that's in the `string` property is automatically converted and stored as a vector in the database. (It's not possible to retrieve a vector using this mechanism.) ```csharp -[VectorStoreVector(Dimensions: 4, DistanceFunction = DistanceFunction.CosineSimilarity, IndexKind = IndexKind.Hnsw)] +[VectorStoreVector(dimensions: 4, DistanceFunction = DistanceFunction.CosineSimilarity, IndexKind = IndexKind.Hnsw)] public string DescriptionEmbedding { get; set; } ``` @@ -138,7 +138,7 @@ The following table shows the parameters for `VectorStoreVectorAttribute`. | Parameter | Required | Description | |------------------------------------------------------------------------------------|:--------:|-------------| -| | Yes | The number of dimensions that the vector has. This is required when creating a vector index for a collection. | +| `dimensions` | Yes | The number of dimensions that the vector has. This is required when creating a vector index for a collection. Pass as a constructor argument: `[VectorStoreVector(dimensions: 1536)]`. | | | No | The type of index to index the vector with. Default varies by vector store type. | | | No | The type of function to use when doing vector comparison during vector search over this vector. Default varies by vector store type. | | | No | Can be used to supply an alternative name for the property in the database. This parameter is not supported by all providers, for example, where alternatives like `JsonPropertyNameAttribute` is supported. | @@ -174,7 +174,7 @@ Vector databases are all about storing *embeddings* - or numerical representatio You can define your vector property as `float[]` or `ReadOnlyMemory`, representing the embedding directly, and generate embeddings yourself before each operation: ```csharp -[VectorStoreVector(Dimensions: 1536)] +[VectorStoreVector(dimensions: 1536)] public ReadOnlyMemory? DescriptionEmbedding { get; set; } ``` @@ -196,7 +196,7 @@ The recommended approach is to configure an > embeddingGenerator = ...; @@ -85,22 +85,19 @@ class Movie [VectorStoreData] public string Title { get; set; } - [VectorStoreVector(Dimensions: 1536)] + [VectorStoreVector(dimensions: 1536)] public string Description { get; set; } } ``` ## Vector store providers -The `Microsoft.Extensions.VectorData.Abstractions` package defines the abstractions, and separate [provider packages](/semantic-kernel/concepts/vector-store-connectors/out-of-the-box-connectors/) provide implementations for specific vector databases. Choose the provider that matches your vector database, for example, [Microsoft.SemanticKernel.Connectors.AzureAISearch](https://www.nuget.org/packages/Microsoft.SemanticKernel.Connectors.AzureAISearch). - -> [!NOTE] -> Despite the inclusion of "SemanticKernel" in the package names, these providers have nothing to do with Semantic Kernel and are usable anywhere in .NET, including Agent Framework. +The `Microsoft.Extensions.VectorData.Abstractions` package defines the abstractions, and separate provider packages provide implementations for specific vector databases. Choose the provider that matches your vector database, for example, [CommunityToolkit.VectorData.AzureAISearch](https://www.nuget.org/packages/CommunityToolkit.VectorData.AzureAISearch). All providers implement the same and abstract classes, so you can switch between them without changing your application logic. > [!TIP] -> Use the in-memory provider ([Microsoft.SemanticKernel.Connectors.InMemory](https://www.nuget.org/packages/Microsoft.SemanticKernel.Connectors.InMemory)) during initial development/prototyping - it doesn't require any external service or configuration, and you can swap it out for a production provider later. Avoid using the InMemory provider for testing, as there can be important differences between this provider and your production database. Consider using [testcontainers](https://dotnet.testcontainers.org/) to run tests against your production database system. +> Use the in-memory provider ([CommunityToolkit.VectorData.InMemory](https://www.nuget.org/packages/CommunityToolkit.VectorData.InMemory)) during initial development/prototyping - it doesn't require any external service or configuration, and you can swap it out for a production provider later. Avoid using the InMemory provider for testing, as there can be important differences between this provider and your production database. Consider using [testcontainers](https://dotnet.testcontainers.org/) to run tests against your production database system. ## Related content diff --git a/docs/ai/vector-stores/snippets/chat-with-data/azure-openai/CloudService.cs b/docs/ai/vector-stores/snippets/chat-with-data/azure-openai/CloudService.cs index 44b3d72a86c83..8bba97b150ad3 100644 --- a/docs/ai/vector-stores/snippets/chat-with-data/azure-openai/CloudService.cs +++ b/docs/ai/vector-stores/snippets/chat-with-data/azure-openai/CloudService.cs @@ -14,7 +14,7 @@ internal class CloudService public string Description { get; set; } [VectorStoreVector( - Dimensions: 384, + dimensions: 384, DistanceFunction = DistanceFunction.CosineSimilarity)] public ReadOnlyMemory Vector { get; set; } } diff --git a/docs/ai/vector-stores/snippets/chat-with-data/azure-openai/Program.cs b/docs/ai/vector-stores/snippets/chat-with-data/azure-openai/Program.cs index 426e977d37e64..cb5b65de6005b 100644 --- a/docs/ai/vector-stores/snippets/chat-with-data/azure-openai/Program.cs +++ b/docs/ai/vector-stores/snippets/chat-with-data/azure-openai/Program.cs @@ -3,7 +3,7 @@ using Microsoft.Extensions.AI; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.VectorData; -using Microsoft.SemanticKernel.Connectors.InMemory; +using CommunityToolkit.VectorData.InMemory; using System.Linq; using VectorDataAI; diff --git a/docs/ai/vector-stores/snippets/chat-with-data/azure-openai/VectorDataAI.csproj b/docs/ai/vector-stores/snippets/chat-with-data/azure-openai/VectorDataAI.csproj index d2a9c4b4cfc60..fd9ce3938535a 100644 --- a/docs/ai/vector-stores/snippets/chat-with-data/azure-openai/VectorDataAI.csproj +++ b/docs/ai/vector-stores/snippets/chat-with-data/azure-openai/VectorDataAI.csproj @@ -14,7 +14,7 @@ - + diff --git a/docs/ai/vector-stores/snippets/chat-with-data/openai/CloudService.cs b/docs/ai/vector-stores/snippets/chat-with-data/openai/CloudService.cs index 44b3d72a86c83..8bba97b150ad3 100644 --- a/docs/ai/vector-stores/snippets/chat-with-data/openai/CloudService.cs +++ b/docs/ai/vector-stores/snippets/chat-with-data/openai/CloudService.cs @@ -14,7 +14,7 @@ internal class CloudService public string Description { get; set; } [VectorStoreVector( - Dimensions: 384, + dimensions: 384, DistanceFunction = DistanceFunction.CosineSimilarity)] public ReadOnlyMemory Vector { get; set; } } diff --git a/docs/ai/vector-stores/snippets/chat-with-data/openai/Program.cs b/docs/ai/vector-stores/snippets/chat-with-data/openai/Program.cs index c43fe9f6781e0..d2d6a8ab864b4 100644 --- a/docs/ai/vector-stores/snippets/chat-with-data/openai/Program.cs +++ b/docs/ai/vector-stores/snippets/chat-with-data/openai/Program.cs @@ -1,7 +1,7 @@ using Microsoft.Extensions.AI; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.VectorData; -using Microsoft.SemanticKernel.Connectors.InMemory; +using CommunityToolkit.VectorData.InMemory; using OpenAI; using System.ClientModel; using VectorDataAI; diff --git a/docs/ai/vector-stores/snippets/chat-with-data/openai/VectorDataAI.csproj b/docs/ai/vector-stores/snippets/chat-with-data/openai/VectorDataAI.csproj index 9d1ab9069f6c2..c8fe66faf31b2 100644 --- a/docs/ai/vector-stores/snippets/chat-with-data/openai/VectorDataAI.csproj +++ b/docs/ai/vector-stores/snippets/chat-with-data/openai/VectorDataAI.csproj @@ -12,7 +12,7 @@ - + diff --git a/docs/ai/vector-stores/snippets/conceptual/VectorStoreSnippets.csproj b/docs/ai/vector-stores/snippets/conceptual/VectorStoreSnippets.csproj index fcb52214d0132..fc4da01253496 100644 --- a/docs/ai/vector-stores/snippets/conceptual/VectorStoreSnippets.csproj +++ b/docs/ai/vector-stores/snippets/conceptual/VectorStoreSnippets.csproj @@ -11,11 +11,10 @@ - - - + + + - diff --git a/docs/ai/vector-stores/snippets/conceptual/defining-your-data-model.cs b/docs/ai/vector-stores/snippets/conceptual/defining-your-data-model.cs index f1a03abf786ca..ca017fcb563b6 100644 --- a/docs/ai/vector-stores/snippets/conceptual/defining-your-data-model.cs +++ b/docs/ai/vector-stores/snippets/conceptual/defining-your-data-model.cs @@ -17,7 +17,7 @@ public class Hotel public required string Description { get; set; } // - [VectorStoreVector(Dimensions: 4, DistanceFunction = DistanceFunction.CosineSimilarity, IndexKind = IndexKind.Hnsw)] + [VectorStoreVector(dimensions: 4, DistanceFunction = DistanceFunction.CosineSimilarity, IndexKind = IndexKind.Hnsw)] public ReadOnlyMemory? DescriptionEmbedding { get; set; } // diff --git a/docs/ai/vector-stores/snippets/conceptual/dynamic-data-model.cs b/docs/ai/vector-stores/snippets/conceptual/dynamic-data-model.cs index c4c8f4fc499fd..3388dd6b5745d 100644 --- a/docs/ai/vector-stores/snippets/conceptual/dynamic-data-model.cs +++ b/docs/ai/vector-stores/snippets/conceptual/dynamic-data-model.cs @@ -1,5 +1,5 @@ using Microsoft.Extensions.VectorData; -using Microsoft.SemanticKernel.Connectors.Qdrant; +using CommunityToolkit.VectorData.Qdrant; using Qdrant.Client; public class DynamicDataModel diff --git a/docs/ai/vector-stores/snippets/how-to/Hotel.cs b/docs/ai/vector-stores/snippets/how-to/Hotel.cs index 632bffd5fe3ca..53e11824d2380 100644 --- a/docs/ai/vector-stores/snippets/how-to/Hotel.cs +++ b/docs/ai/vector-stores/snippets/how-to/Hotel.cs @@ -12,7 +12,7 @@ public record class Hotel [VectorStoreData(IsFullTextIndexed = true)] public string? Description { get; set; } - [VectorStoreVector(Dimensions: 1536, DistanceFunction = DistanceFunction.CosineSimilarity)] + [VectorStoreVector(dimensions: 1536, DistanceFunction = DistanceFunction.CosineSimilarity)] public ReadOnlyMemory? DescriptionEmbedding { get; set; } [VectorStoreData(IsIndexed = true)] diff --git a/docs/ai/vector-stores/snippets/how-to/HowToSnippets.csproj b/docs/ai/vector-stores/snippets/how-to/HowToSnippets.csproj index 96d5a548b0bb1..745167d1f4298 100644 --- a/docs/ai/vector-stores/snippets/how-to/HowToSnippets.csproj +++ b/docs/ai/vector-stores/snippets/how-to/HowToSnippets.csproj @@ -14,8 +14,8 @@ - - + + diff --git a/docs/ai/vector-stores/snippets/how-to/Program.cs b/docs/ai/vector-stores/snippets/how-to/Program.cs index 9031980080dcc..72c53333d4f84 100644 --- a/docs/ai/vector-stores/snippets/how-to/Program.cs +++ b/docs/ai/vector-stores/snippets/how-to/Program.cs @@ -1,5 +1,5 @@ using Microsoft.Extensions.VectorData; -using Microsoft.SemanticKernel.Connectors.InMemory; +using CommunityToolkit.VectorData.InMemory; // // Create an in-memory vector store (no external service required). diff --git a/docs/ai/vector-stores/snippets/how-to/PutItTogether.cs b/docs/ai/vector-stores/snippets/how-to/PutItTogether.cs index 82546657127b9..301fb77c75c0c 100644 --- a/docs/ai/vector-stores/snippets/how-to/PutItTogether.cs +++ b/docs/ai/vector-stores/snippets/how-to/PutItTogether.cs @@ -3,7 +3,7 @@ using Microsoft.Extensions.AI; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.VectorData; -using Microsoft.SemanticKernel.Connectors.Redis; +using CommunityToolkit.VectorData.Redis; using VectorIngest; public class PutItAllTogether