Skip to content

Commit 19557eb

Browse files
authored
.Net: Improve docs for VectorData.Abstractions (#12207)
### Motivation and Context I noticed some text that could be improved when importing the docs to Learn in dotnet/dotnet-api-docs#11323. ### Contribution Checklist <!-- Before submitting this PR, please make sure: --> - [x] The code builds clean without any errors or warnings - [x] The PR follows the [SK Contribution Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md) and the [pre-submission formatting script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts) raises no violations - [x] All unit tests pass, and I have added new tests where possible - [ ] I didn't break anyone 😄
1 parent 3e771ec commit 19557eb

30 files changed

+152
-146
lines changed

dotnet/src/Connectors/VectorData.Abstractions/ProviderServices/CollectionJsonModelBuilder.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
namespace Microsoft.Extensions.VectorData.ProviderServices;
1111

1212
/// <summary>
13-
/// A model builder that performs logic specific to connectors which use System.Text.Json for serialization.
14-
/// This is an internal support type meant for use by connectors only, and not for use by applications.
13+
/// Represents a model builder that performs logic specific to connectors that use System.Text.Json for serialization.
14+
/// This is an internal support type meant for use by connectors only and not by applications.
1515
/// </summary>
1616
[Experimental("MEVD9001")]
1717
public abstract class CollectionJsonModelBuilder : CollectionModelBuilder
@@ -27,7 +27,7 @@ protected CollectionJsonModelBuilder(CollectionModelBuildingOptions options)
2727
}
2828

2929
/// <summary>
30-
/// Builds and returns an <see cref="CollectionModel"/> from the given <paramref name="type"/> and <paramref name="definition"/>.
30+
/// Builds and returns a <see cref="CollectionModel"/> from the given <paramref name="type"/> and <paramref name="definition"/>.
3131
/// </summary>
3232
[RequiresDynamicCode("This model building variant is not compatible with NativeAOT. See BuildDynamic() for dynamic mapping, and a third variant accepting source-generated delegates will be introduced in the future.")]
3333
[RequiresUnreferencedCode("This model building variant is not compatible with trimming. See BuildDynamic() for dynamic mapping, and a third variant accepting source-generated delegates will be introduced in the future.")]
@@ -43,7 +43,7 @@ public virtual CollectionModel Build(
4343
}
4444

4545
/// <summary>
46-
/// Builds and returns an <see cref="CollectionModel"/> for dynamic mapping scenarios from the given <paramref name="definition"/>.
46+
/// Builds and returns a <see cref="CollectionModel"/> for dynamic mapping scenarios from the given <paramref name="definition"/>.
4747
/// </summary>
4848
public virtual CollectionModel BuildDynamic(
4949
VectorStoreCollectionDefinition definition,

dotnet/src/Connectors/VectorData.Abstractions/ProviderServices/CollectionModel.cs

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
namespace Microsoft.Extensions.VectorData.ProviderServices;
1313

1414
/// <summary>
15-
/// A model representing a record in a vector store collection.
16-
/// This is an internal support type meant for use by connectors only, and not for use by applications.
15+
/// Represents a record in a vector store collection.
16+
/// This is an internal support type meant for use by connectors only and not by applications.
1717
/// </summary>
1818
[Experimental("MEVD9001")]
1919
public sealed class CollectionModel
@@ -26,32 +26,32 @@ public sealed class CollectionModel
2626
private DataPropertyModel? _singleFullTextSearchProperty;
2727

2828
/// <summary>
29-
/// The key properties of the record.
29+
/// Gets the key properties of the record.
3030
/// </summary>
3131
public IReadOnlyList<KeyPropertyModel> KeyProperties { get; }
3232

3333
/// <summary>
34-
/// The data properties of the record.
34+
/// Gets the data properties of the record.
3535
/// </summary>
3636
public IReadOnlyList<DataPropertyModel> DataProperties { get; }
3737

3838
/// <summary>
39-
/// The vector properties of the record.
39+
/// Gets the vector properties of the record.
4040
/// </summary>
4141
public IReadOnlyList<VectorPropertyModel> VectorProperties { get; }
4242

4343
/// <summary>
44-
/// All properties of the record, of all types.
44+
/// Gets all properties of the record, of all types.
4545
/// </summary>
4646
public IReadOnlyList<PropertyModel> Properties { get; }
4747

4848
/// <summary>
49-
/// All properties of the record, of all types, indexed by their model name.
49+
/// Gets all properties of the record, of all types, indexed by their model name.
5050
/// </summary>
5151
public IReadOnlyDictionary<string, PropertyModel> PropertyMap { get; }
5252

5353
/// <summary>
54-
/// Whether any of the vector properties in the model require embedding generation.
54+
/// Gets a value that indicates whether any of the vector properties in the model require embedding generation.
5555
/// </summary>
5656
public bool EmbeddingGenerationRequired { get; }
5757

@@ -102,12 +102,11 @@ public TRecord CreateRecord<TRecord>()
102102
}
103103

104104
/// <summary>
105-
/// Get the vector property with the provided name if a name is provided, and fall back
106-
/// to a vector property in the schema if not. If no name is provided and there is more
107-
/// than one vector property, an exception will be thrown.
105+
/// Gets the vector property with the provided name if a name is provided, and falls back
106+
/// to a vector property in the schema if not.
108107
/// </summary>
109-
/// <param name="searchOptions">The search options.</param>
110-
/// <exception cref="InvalidOperationException">Thrown if the provided property name is not a valid vector property name.</exception>
108+
/// <param name="searchOptions">The search options, which defines the vector property name.</param>
109+
/// <exception cref="InvalidOperationException"><para>The provided property name is not a valid text data property name.</para><para>OR</para><para>No name was provided and there's more than one vector property.</para></exception>
111110
public VectorPropertyModel GetVectorPropertyOrSingle<TRecord>(VectorSearchOptions<TRecord> searchOptions)
112111
{
113112
if (searchOptions.VectorProperty is not null)
@@ -137,12 +136,11 @@ public VectorPropertyModel GetVectorPropertyOrSingle<TRecord>(VectorSearchOption
137136
}
138137

139138
/// <summary>
140-
/// Get the text data property, that has full text search indexing enabled, with the provided name if a name is provided, and fall back
141-
/// to a text data property in the schema if not. If no name is provided and there is more than one text data property with
142-
/// full text search indexing enabled, an exception will be thrown.
139+
/// Gets the text data property with the provided name that has full text search indexing enabled, or falls back
140+
/// to a text data property in the schema if no name is provided.
143141
/// </summary>
144142
/// <param name="expression">The full text search property selector.</param>
145-
/// <exception cref="InvalidOperationException">Thrown if the provided property name is not a valid text data property name.</exception>
143+
/// <exception cref="InvalidOperationException"><para>The provided property name is not a valid text data property name.</para><para>OR</para><para>No name was provided and there's more than one text data property with full text search indexing enabled.</para></exception>
146144
public DataPropertyModel GetFullTextDataPropertyOrSingle<TRecord>(Expression<Func<TRecord, object?>>? expression)
147145
{
148146
if (expression is not null)
@@ -183,10 +181,10 @@ public DataPropertyModel GetFullTextDataPropertyOrSingle<TRecord>(Expression<Fun
183181
}
184182

185183
/// <summary>
186-
/// Get the data or key property selected by provided expression.
184+
/// Gets the data or key property selected by the provided expression.
187185
/// </summary>
188186
/// <param name="expression">The property selector.</param>
189-
/// <exception cref="InvalidOperationException">Thrown if the provided property name is not a valid data or key property name.</exception>
187+
/// <exception cref="InvalidOperationException">The provided property name is not a valid data or key property name.</exception>
190188
public PropertyModel GetDataOrKeyProperty<TRecord>(Expression<Func<TRecord, object?>> expression)
191189
=> this.GetMatchingProperty<TRecord, PropertyModel>(expression, data: true);
192190

dotnet/src/Connectors/VectorData.Abstractions/ProviderServices/CollectionModelBuilder.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,44 +12,44 @@ namespace Microsoft.Extensions.VectorData.ProviderServices;
1212

1313
/// <summary>
1414
/// Represents a builder for a <see cref="CollectionModel"/>.
15-
/// This is an internal support type meant for use by connectors only, and not for use by applications.
15+
/// This is an internal support type meant for use by connectors only and not by applications.
1616
/// </summary>
17-
/// <remarks>Note that this class is single-use only, and not thread-safe.</remarks>
17+
/// <remarks>This class is single-use only, and not thread-safe.</remarks>
1818
[Experimental("MEVD9001")]
1919
public abstract class CollectionModelBuilder
2020
{
2121
/// <summary>
22-
/// Options for building the model.
22+
/// Gets the options for building the model.
2323
/// </summary>
2424
protected CollectionModelBuildingOptions Options { get; }
2525

2626
/// <summary>
27-
/// The key properties of the record.
27+
/// Gets the key properties of the record.
2828
/// </summary>
2929
protected List<KeyPropertyModel> KeyProperties { get; } = [];
3030

3131
/// <summary>
32-
/// The data properties of the record.
32+
/// Gets the data properties of the record.
3333
/// </summary>
3434
protected List<DataPropertyModel> DataProperties { get; } = [];
3535

3636
/// <summary>
37-
/// The vector properties of the record.
37+
/// Gets the vector properties of the record.
3838
/// </summary>
3939
protected List<VectorPropertyModel> VectorProperties { get; } = [];
4040

4141
/// <summary>
42-
/// All properties of the record, of all types.
42+
/// Gets all properties of the record, of all types.
4343
/// </summary>
4444
protected IEnumerable<PropertyModel> Properties => this.PropertyMap.Values;
4545

4646
/// <summary>
47-
/// All properties of the record, of all types, indexed by their model name.
47+
/// Gets all properties of the record, of all types, indexed by their model name.
4848
/// </summary>
4949
protected Dictionary<string, PropertyModel> PropertyMap { get; } = new();
5050

5151
/// <summary>
52-
/// The default embedding generator to use for vector properties, when none is specified at the property or collection level.
52+
/// Gets the default embedding generator to use for vector properties, when none is specified at the property or collection level.
5353
/// </summary>
5454
protected IEmbeddingGenerator? DefaultEmbeddingGenerator { get; private set; }
5555

@@ -245,7 +245,7 @@ protected virtual void ProcessTypeProperties(Type type, VectorStoreCollectionDef
245245
}
246246

247247
/// <summary>
248-
/// As part of building the model, this method processes the given <paramref name="definition"/>.
248+
/// Processes the given <paramref name="definition"/> as part of building the model.
249249
/// </summary>
250250
protected virtual void ProcessRecordDefinition(VectorStoreCollectionDefinition definition, Type? type)
251251
{

dotnet/src/Connectors/VectorData.Abstractions/ProviderServices/CollectionModelBuildingOptions.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,34 @@ namespace Microsoft.Extensions.VectorData.ProviderServices;
66

77
/// <summary>
88
/// Contains options affecting model building; passed to <see cref="CollectionModelBuilder"/>.
9-
/// This is an internal support type meant for use by connectors only, and not for use by applications.
9+
/// This is an internal support type meant for use by connectors only and not by applications.
1010
/// </summary>
1111
[Experimental("MEVD9001")]
1212
public sealed class CollectionModelBuildingOptions
1313
{
1414
/// <summary>
15-
/// Whether multiple key properties are supported.
15+
/// Gets a value that indicates whether multiple key properties are supported.
1616
/// </summary>
1717
public required bool SupportsMultipleKeys { get; init; }
1818

1919
/// <summary>
20-
/// Whether multiple vector properties are supported.
20+
/// Gets a value that indicates whether multiple vector properties are supported.
2121
/// </summary>
2222
public required bool SupportsMultipleVectors { get; init; }
2323

2424
/// <summary>
25-
/// Whether at least one vector property is required.
25+
/// Gets a value that indicates whether at least one vector property is required.
2626
/// </summary>
2727
public required bool RequiresAtLeastOneVector { get; init; }
2828

2929
/// <summary>
30-
/// Indicates that an external serializer will be used (e.g. System.Text.Json).
30+
/// Gets a value that indicates whether an external serializer will be used (for example, System.Text.Json).
3131
/// </summary>
3232
public bool UsesExternalSerializer { get; init; }
3333

3434
/// <summary>
35-
/// Indicates that the database requires the key property to have a special, reserved name.
36-
/// When set, the model builder will manage the key storage name, and users may not customize it.
35+
/// Gets the special, reserved name for the key property of the database.
36+
/// When set, the model builder manages the key storage name, and users cannot customize it.
3737
/// </summary>
3838
public string? ReservedKeyStorageName { get; init; }
3939
}

dotnet/src/Connectors/VectorData.Abstractions/ProviderServices/DataPropertyModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Microsoft.Extensions.VectorData.ProviderServices;
77

88
/// <summary>
99
/// Represents a data property on a vector store record.
10-
/// This is an internal support type meant for use by connectors only, and not for use by applications.
10+
/// This is an internal support type meant for use by connectors only and not by applications.
1111
/// </summary>
1212
[Experimental("MEVD9001")]
1313
public class DataPropertyModel(string modelName, Type type) : PropertyModel(modelName, type)

dotnet/src/Connectors/VectorData.Abstractions/ProviderServices/Filter/FilterTranslationPreprocessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace Microsoft.Extensions.VectorData.ProviderServices.Filter;
1010

1111
/// <summary>
1212
/// A processor for user-provided filter expressions which performs various common transformations before actual translation takes place.
13-
/// This is an internal support type meant for use by connectors only, and not for use by applications.
13+
/// This is an internal support type meant for use by connectors only and not by applications.
1414
/// </summary>
1515
[Experimental("MEVD9001")]
1616
public class FilterTranslationPreprocessor : ExpressionVisitor

dotnet/src/Connectors/VectorData.Abstractions/ProviderServices/KeyPropertyModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace Microsoft.Extensions.VectorData.ProviderServices;
77

88
/// <summary>
99
/// Represents a key property on a vector store record.
10-
/// This is an internal support type meant for use by connectors only, and not for use by applications.
10+
/// This is an internal support type meant for use by connectors only and not by applications.
1111
/// </summary>
1212
[Experimental("MEVD9001")]
1313
public class KeyPropertyModel(string modelName, Type type) : PropertyModel(modelName, type)

dotnet/src/Connectors/VectorData.Abstractions/ProviderServices/PropertyModel.cs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,20 @@ namespace Microsoft.Extensions.VectorData.ProviderServices;
1010

1111
/// <summary>
1212
/// Represents a property on a vector store record.
13-
/// This is an internal support type meant for use by connectors only, and not for use by applications.
13+
/// This is an internal support type meant for use by connectors only and not by applications.
1414
/// </summary>
1515
[Experimental("MEVD9001")]
1616
public abstract class PropertyModel(string modelName, Type type)
1717
{
1818
private string? _storageName;
1919

2020
/// <summary>
21-
/// The model name of the property. If the property corresponds to a .NET property, this name is the name of that property.
21+
/// Gets or sets the model name of the property. If the property corresponds to a .NET property, this name is the name of that property.
2222
/// </summary>
2323
public string ModelName { get; set; } = modelName;
2424

2525
/// <summary>
26-
/// The storage name of the property. This is the name to which the property is mapped in the vector store.
26+
/// Gets or sets the storage name of the property. This is the name to which the property is mapped in the vector store.
2727
/// </summary>
2828
public string StorageName
2929
{
@@ -35,20 +35,23 @@ public string StorageName
3535
// TODO: Spend more time thinking about this, there may be a less hacky way to handle it.
3636

3737
/// <summary>
38-
/// A temporary storage name for the property, for use during the serialization process by certain connectors.
38+
/// Gets or sets the temporary storage name for the property, for use during the serialization process by certain connectors.
3939
/// </summary>
4040
[Experimental("MEVD9001")]
4141
public string? TemporaryStorageName { get; set; }
4242

4343
/// <summary>
44-
/// The CLR type of the property.
44+
/// Gets or sets the CLR type of the property.
4545
/// </summary>
4646
public Type Type { get; set; } = type;
4747

4848
/// <summary>
49+
/// Gets or sets the reflection <see cref="PropertyInfo"/> for the .NET property.
50+
/// </summary>
51+
/// <value>
4952
/// The reflection <see cref="PropertyInfo"/> for the .NET property.
5053
/// <see langword="null"/> when using dynamic mapping.
51-
/// </summary>
54+
/// </value>
5255
public PropertyInfo? PropertyInfo { get; set; }
5356

5457
/// <summary>

dotnet/src/Connectors/VectorData.Abstractions/ProviderServices/VectorPropertyModel.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ namespace Microsoft.Extensions.VectorData.ProviderServices;
1313

1414
/// <summary>
1515
/// Represents a vector property on a vector store record.
16-
/// This is an internal support type meant for use by connectors only, and not for use by applications.
16+
/// This is an internal support type meant for use by connectors only and not by applications.
1717
/// </summary>
1818
[Experimental("MEVD9001")]
1919
public class VectorPropertyModel(string modelName, Type type) : PropertyModel(modelName, type)
2020
{
2121
private int _dimensions;
2222

2323
/// <summary>
24-
/// The number of dimensions that the vector has.
24+
/// Gets or sets the number of dimensions that the vector has.
2525
/// </summary>
2626
/// <remarks>
2727
/// This property is required when creating collections, but can be omitted if not using that functionality.
@@ -43,25 +43,25 @@ public int Dimensions
4343
}
4444

4545
/// <summary>
46-
/// The kind of index to use.
46+
/// Gets or sets the kind of index to use.
4747
/// </summary>
4848
/// <value>
49-
/// The default varies by database type. See the documentation of your chosen database connector for more information.
49+
/// The default varies by database type. For more information, see the documentation of your chosen database connector.
5050
/// </value>
5151
/// <seealso cref="Microsoft.Extensions.VectorData.IndexKind"/>
5252
public string? IndexKind { get; set; }
5353

5454
/// <summary>
55-
/// The distance function to use when comparing vectors.
55+
/// Gets or sets the distance function to use when comparing vectors.
5656
/// </summary>
5757
/// <value>
58-
/// The default varies by database type. See the documentation of your chosen database connector for more information.
58+
/// The default varies by database type. For more information, see the documentation of your chosen database connector.
5959
/// </value>
6060
/// <seealso cref="Microsoft.Extensions.VectorData.DistanceFunction"/>
6161
public string? DistanceFunction { get; set; }
6262

6363
/// <summary>
64-
/// If <see cref="EmbeddingGenerator"/> is set, contains the type representing the embedding stored in the database.
64+
/// Gets or sets the type representing the embedding stored in the database if <see cref="EmbeddingGenerator"/> is set.
6565
/// Otherwise, this property is identical to <see cref="Type"/>.
6666
/// </summary>
6767
// TODO: sort out the nullability story here: EmbeddingType must be non-null after model building is complete, but can be null during
@@ -70,7 +70,7 @@ public int Dimensions
7070
public Type EmbeddingType { get; set; } = null!;
7171

7272
/// <summary>
73-
/// The embedding generator to use for this property.
73+
/// Gets or sets the embedding generator to use for this property.
7474
/// </summary>
7575
public IEmbeddingGenerator? EmbeddingGenerator { get; set; }
7676

dotnet/src/Connectors/VectorData.Abstractions/RecordAttributes/VectorStoreVectorAttribute.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public VectorStoreVectorAttribute(int Dimensions)
3737
public int Dimensions { get; private set; }
3838

3939
/// <summary>
40-
/// Gets the kind of index to use.
40+
/// Gets or sets the kind of index to use.
4141
/// </summary>
4242
/// <value>
4343
/// The default value varies by database type. See the documentation of your chosen database connector for more information.
@@ -48,7 +48,7 @@ public VectorStoreVectorAttribute(int Dimensions)
4848
#pragma warning restore CA1019
4949

5050
/// <summary>
51-
/// Gets the distance function to use when comparing vectors.
51+
/// Gets or sets the distance function to use when comparing vectors.
5252
/// </summary>
5353
/// <value>
5454
/// The default value varies by database type. See the documentation of your chosen database connector for more information.

0 commit comments

Comments
 (0)