Beef up MEVD docs: expanded conceptual article, new how-to guide, and working code snippets#51846
Beef up MEVD docs: expanded conceptual article, new how-to guide, and working code snippets#51846
Conversation
…how-to, new TOC section Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
|
@copilot I added learn.microsoft.com to your allow list. Can you try to access the docs you need to port over to this repo? |
…ybrid search, record definitions, more connectors Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
Accessed the SK vector store docs at learn.microsoft.com and ported relevant content. Commit
All code samples compile and run against the real |
| # Vector databases for .NET AI apps | ||
|
|
||
| Vector databases are designed to store and manage vector [embeddings](embeddings.md). Embeddings are numeric representations of non-numeric data that preserve semantic meaning. Words, documents, images, audio, and other types of data can all be vectorized. You can use embeddings to help an AI model understand the meaning of inputs so that it can perform comparisons and transformations, such as summarizing text, finding contextually related data, or creating images from text descriptions. | ||
| Vector databases store and manage vector [embeddings](embeddings.md)—numeric representations of data that preserve semantic meaning. Words, documents, images, audio, and other types of data can all be vectorized. You can use embeddings to help an AI model understand the meaning of inputs so that it can perform comparisons and transformations, such as summarizing text, finding contextually related data, or creating images from text descriptions. |
There was a problem hiding this comment.
| Vector databases store and manage vector [embeddings](embeddings.md)—numeric representations of data that preserve semantic meaning. Words, documents, images, audio, and other types of data can all be vectorized. You can use embeddings to help an AI model understand the meaning of inputs so that it can perform comparisons and transformations, such as summarizing text, finding contextually related data, or creating images from text descriptions. | |
| Vector databases store and manage vector [*embeddings*](embeddings.md). Embeddings are numeric representations of data that preserve semantic meaning. Words, documents, images, audio, and other types of data can all be vectorized. You can use embeddings to help an AI model understand the meaning of inputs so that it can perform comparisons and transformations, such as summarizing text, finding contextually related data, or creating images from text descriptions. |
There was a problem hiding this comment.
Done in 1ddb6a13.
| } | ||
| ``` | ||
|
|
||
| You can configure the `IEmbeddingGenerator` at the vector store level, collection level, or on individual vector properties. With auto-embedding, you can also pass a `string` directly to `SearchAsync` instead of a precomputed vector—the store generates the search embedding for you. For more information, see [Use built-in embedding generation](../how-to/use-vector-stores.md#use-built-in-embedding-generation). |
There was a problem hiding this comment.
| You can configure the `IEmbeddingGenerator` at the vector store level, collection level, or on individual vector properties. With auto-embedding, you can also pass a `string` directly to `SearchAsync` instead of a precomputed vector—the store generates the search embedding for you. For more information, see [Use built-in embedding generation](../how-to/use-vector-stores.md#use-built-in-embedding-generation). | |
| You can configure the `IEmbeddingGenerator` at the vector store or collection level, or on individual vector properties. With auto-embedding, you can also pass a `string` directly to `SearchAsync` instead of a precomputed vector—the store generates the search embedding for you. For more information, see [Use built-in embedding generation](../how-to/use-vector-stores.md#use-built-in-embedding-generation). |
There was a problem hiding this comment.
Done in 1ddb6a13.
There was a problem hiding this comment.
Removed in 1ddb6a13.
docs/ai/how-to/use-vector-stores.md
Outdated
| description: Learn how to use Microsoft.Extensions.VectorData to store, search, and manage embeddings in vector databases for .NET AI applications. | ||
| ms.topic: how-to | ||
| ms.date: 02/24/2026 | ||
| ai-usage: ai-assisted |
There was a problem hiding this comment.
| ai-usage: ai-assisted | |
| ai-usage: ai-generated |
There was a problem hiding this comment.
Updated to ai-usage: ai-generated in 1ddb6a13.
docs/ai/how-to/use-vector-stores.md
Outdated
|
|
||
| | Parameter | Required | Description | | ||
| |---|---|---| | ||
| | `StorageName` | No | An alternative name for the property in storage. Not supported by all connectors. | |
There was a problem hiding this comment.
Please add xref links to the attribute parameters, for example, xref:Microsoft.Extensions.VectorData.VectorStoreKeyAttribute.StorageName.
There was a problem hiding this comment.
Updated all three heading to use xref links: <xref:Microsoft.Extensions.VectorData.VectorStoreKeyAttribute>, <xref:Microsoft.Extensions.VectorData.VectorStoreDataAttribute>, and <xref:Microsoft.Extensions.VectorData.VectorStoreVectorAttribute> in 1ddb6a13.
There was a problem hiding this comment.
@copilot I didn't mean update the headings. I meant update the parameters in the tables to use xref links.
There was a problem hiding this comment.
Done in ab4c26a4. All parameter names in the three tables now use xref links (e.g., <xref:Microsoft.Extensions.VectorData.VectorStoreDataAttribute.IsIndexed>).
There was a problem hiding this comment.
Done in ab4c26a4. All parameter names in the three attribute parameter tables now use xref links.
docs/ai/how-to/use-vector-stores.md
Outdated
|
|
||
| ## Get a collection | ||
|
|
||
| Call `GetCollection<TKey, TRecord>` on the vector store to get a typed reference to a collection. Then call `EnsureCollectionExistsAsync` to create the collection if it doesn't already exist: |
There was a problem hiding this comment.
Add xref links wherever possible.
There was a problem hiding this comment.
Added xref links throughout the how-to guide in 1ddb6a13: VectorStore, VectorStoreCollection\2, EnsureCollectionExistsAsync, SearchAsync, VectorSearchResult`1, IKeywordHybridSearchable`1, DeleteAsync, and EnsureCollectionDeletedAsync`.
|
@copilot please respond to all feedback |
…tignore, fix TOC duplicate, update intro sentence Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
All feedback addressed in
|
docs/ai/how-to/use-vector-stores.md
Outdated
|
|
||
| | Parameter | Required | Description | | ||
| |---|---|---| | ||
| | `StorageName` | No | An alternative name for the property in storage. Not supported by all connectors. | |
There was a problem hiding this comment.
@copilot I didn't mean update the headings. I meant update the parameters in the tables to use xref links.
docs/ai/how-to/use-vector-stores.md
Outdated
|
|
||
| ## Upsert records | ||
|
|
||
| Use `UpsertAsync` to insert or update records in the collection. If a record with the same key already exists, it gets updated: |
There was a problem hiding this comment.
Use an xref for UpsertAsync.
There was a problem hiding this comment.
Done in ab4c26a4. Changed to <xref:Microsoft.Extensions.VectorData.VectorStoreCollection\2.UpsertAsync*>`.
docs/ai/how-to/use-vector-stores.md
Outdated
|
|
||
| ## Get records | ||
|
|
||
| Use `GetAsync` to retrieve a single record by its key. To retrieve multiple records, pass an `IEnumerable<TKey>` to `GetAsync`: |
There was a problem hiding this comment.
Use an xref for GetAsync.
There was a problem hiding this comment.
Done in ab4c26a4. Changed to <xref:Microsoft.Extensions.VectorData.VectorStoreCollection\2.GetAsync*>`.
docs/ai/how-to/use-vector-stores.md
Outdated
|
|
||
| ## Control search behavior with VectorSearchOptions | ||
|
|
||
| Use `VectorSearchOptions<TRecord>` to control various aspects of vector search behavior: |
There was a problem hiding this comment.
Use an xref for VectorSearchOptions<TRecord>
There was a problem hiding this comment.
Done in ab4c26a4. Changed to <xref:Microsoft.Extensions.VectorData.VectorSearchOptions\1>`.
docs/ai/how-to/use-vector-stores.md
Outdated
|
|
||
| ## Get a collection | ||
|
|
||
| Call `GetCollection<TKey, TRecord>` on the <xref:Microsoft.Extensions.VectorData.VectorStore> to get a typed <xref:Microsoft.Extensions.VectorData.VectorStoreCollection`2> reference. Then call <xref:Microsoft.Extensions.VectorData.VectorStoreCollection`2.EnsureCollectionExistsAsync*> to create the collection if it doesn't already exist: |
There was a problem hiding this comment.
Use an xref for GetCollection<>().
There was a problem hiding this comment.
Done in ab4c26a4. Changed to <xref:Microsoft.Extensions.VectorData.VectorStore.GetCollection*>.
…rtAsync, GetAsync, VectorSearchOptions Co-authored-by: gewarren <24882762+gewarren@users.noreply.github.com>
All feedback addressed in |
There was a problem hiding this comment.
Pull request overview
This PR significantly expands the vector database documentation for .NET AI applications by adding comprehensive coverage of the Microsoft.Extensions.VectorData library. The changes transform a brief conceptual overview into detailed documentation with working code examples, covering both conceptual understanding and practical implementation.
Changes:
- Expanded the vector databases conceptual article with detailed coverage of the Microsoft.Extensions.VectorData library, including API examples, data modeling patterns, and a complete list of available connectors
- Created a new how-to guide for using vector stores with step-by-step instructions for common operations like upserting, searching, and filtering
- Added a complete, compilable C# snippet project with working code examples demonstrating all major features
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| docs/ai/toc.yml | Reorganized TOC to create a new "Vector stores" top-level section containing both the conceptual overview and how-to guide |
| docs/ai/conceptual/vector-databases.md | Expanded from a brief overview to comprehensive conceptual documentation covering MEVD library features, data models, search patterns, and available connectors |
| docs/ai/how-to/use-vector-stores.md | New how-to guide with detailed step-by-step instructions for all vector store operations including CRUD, search, filtering, and hybrid search |
| docs/ai/how-to/snippets/use-vector-stores/csharp/VectorStoresExamples/VectorStoresExamples.csproj | Project file targeting net10.0 with required vector store dependencies |
| docs/ai/how-to/snippets/use-vector-stores/csharp/VectorStoresExamples/Hotel.cs | Data model example demonstrating vector store attributes |
| docs/ai/how-to/snippets/use-vector-stores/csharp/VectorStoresExamples/Program.cs | Main demonstration code with snippets for all basic operations |
| docs/ai/how-to/snippets/use-vector-stores/csharp/VectorStoresExamples/RecordDefinition.cs | Example of programmatic schema definition without attributes |
| docs/ai/how-to/snippets/use-vector-stores/csharp/VectorStoresExamples/AutoEmbedding.cs | Example of automatic embedding generation feature |
|
@gewarren great to see this! Just want to make sure you're aware of the vector store section in the Semantic Kernel docs (the entire section, not just that page). These are pretty high-quality docs that will go away as part of this effort, with their contents merged into the .NET docs you're working on. At least some of this content can simply be moved as-is, others can at least be a source for Copilot. Let me know your thoughts... BTW I'm nearing the end of my coding work on MEVD, and am definitely happy to be involved in the docs side of things, as a reviewer or anything else that might be helpful. |
BillWagner
left a comment
There was a problem hiding this comment.
This looks great @gewarren
I had a few questions on the code to consider.
| The `Microsoft.Extensions.VectorData.Abstractions` library exposes the following main abstract classes: | ||
|
|
||
| - <xref:Microsoft.Extensions.VectorData.VectorStore>: The top-level class for a vector database. Use it to retrieve and manage collections. | ||
| - <xref:Microsoft.Extensions.VectorData.VectorStoreCollection`2>: Represents a named collection of records within a vector store. Use it to perform CRUD and search operations. Also inherits from `IVectorSearchable<TRecord>`. |
There was a problem hiding this comment.
technical nit:
| - <xref:Microsoft.Extensions.VectorData.VectorStoreCollection`2>: Represents a named collection of records within a vector store. Use it to perform CRUD and search operations. Also inherits from `IVectorSearchable<TRecord>`. | |
| - <xref:Microsoft.Extensions.VectorData.VectorStoreCollection`2>: Represents a named collection of records within a vector store. Use it to perform CRUD and search operations. It implements `IVectorSearchable<TRecord>`. |
| // <AutoEmbeddingDataModel> | ||
| // When the vector property type is string (not ReadOnlyMemory<float>), | ||
| // the vector store automatically generates embeddings using the configured IEmbeddingGenerator. | ||
| public class FinanceInfo |
There was a problem hiding this comment.
This looks like it could / should be a record?
| public class FinanceInfo | |
| public record class FinanceInfo |
| public string Text { get; set; } = ""; | ||
|
|
||
| // The string value placed here before upsert is automatically converted to a vector. | ||
| [VectorStoreVector(1536)] | ||
| public string EmbeddingSource { get; set; } = ""; |
There was a problem hiding this comment.
In both cases, required might be better than the empty string initialization:
| public string Text { get; set; } = ""; | |
| // The string value placed here before upsert is automatically converted to a vector. | |
| [VectorStoreVector(1536)] | |
| public string EmbeddingSource { get; set; } = ""; | |
| public required string Text { get; set; } = ""; | |
| // The string value placed here before upsert is automatically converted to a vector. | |
| [VectorStoreVector(1536)] | |
| public required string EmbeddingSource { get; set; } = ""; |
| // <DataModel> | ||
| using Microsoft.Extensions.VectorData; | ||
|
|
||
| public class Hotel |
There was a problem hiding this comment.
same comment here on record:
| public class Hotel | |
| public record class Hotel |
| await collection.UpsertAsync(hotels[0]); | ||
| await collection.UpsertAsync(hotels[1]); | ||
| await collection.UpsertAsync(hotels[2]); |
| IAsyncEnumerable<Hotel> hotelBatch = collection.GetAsync([1, 2, 3]); | ||
| await foreach (Hotel h in hotelBatch) | ||
| { | ||
| Console.WriteLine($"Batch hotel: {h.HotelName}"); | ||
| } |
There was a problem hiding this comment.
Curious: GetAsync returns a nullable. This is a non-nullable enumeration. Is that correct? If so, could the returned enumerable have less than 3 items?
docs/ai/conceptual/vector-databases.mdwith MEVD API concepts and code samplesdocs/ai/how-to/use-vector-stores.mdhow-to guide with working code samples and snippet filesdocs/ai/how-to/snippets/use-vector-stores/csharp/VectorStoresExamples/docs/ai/toc.ymlto add a new "Vector stores" top-level sectionGetCollection<TKey, TRecord>to use<xref:Microsoft.Extensions.VectorData.VectorStore.GetCollection*>UpsertAsyncto use<xref:Microsoft.Extensions.VectorData.VectorStoreCollection\2.UpsertAsync*>`GetAsyncmentions to use<xref:Microsoft.Extensions.VectorData.VectorStoreCollection\2.GetAsync*>`VectorSearchOptions<TRecord>to use<xref:Microsoft.Extensions.VectorData.VectorSearchOptions\1>`Original prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.
Internal previews