11// Copyright (c) Microsoft. All rights reserved.
22package com .microsoft .semantickernel .connectors .memory .azureaisearch ;
33
4- import com .azure .search .documents .SearchDocument ;
5- import com .microsoft .semantickernel .data .VectorStoreRecordMapper ;
6- import com .microsoft .semantickernel .data .recorddefinition .VectorStoreRecordDefinition ;
7-
8- /**
9- * Options for an Azure AI Search vector store.
10- *
11- * @param <Record> the record type
12- */
134public class AzureAISearchVectorStoreOptions <Record > {
145 private final Class <Record > recordClass ;
15- private final VectorStoreRecordMapper <Record , SearchDocument > vectorStoreRecordMapper ;
16- private final VectorStoreRecordDefinition recordDefinition ;
6+ private final AzureAISearchVectorStoreRecordCollectionFactory <Record > vectorStoreRecordCollectionFactory ;
7+
8+ /**
9+ * Creates a new instance of the Azure AI Search vector store options.
10+ *
11+ * @param recordClass The record class.
12+ * @param vectorStoreRecordCollectionFactory The vector store record collection factory.
13+ */
14+ public AzureAISearchVectorStoreOptions (Class <Record > recordClass ,
15+ AzureAISearchVectorStoreRecordCollectionFactory <Record > vectorStoreRecordCollectionFactory ) {
16+ this .recordClass = recordClass ;
17+ this .vectorStoreRecordCollectionFactory = vectorStoreRecordCollectionFactory ;
18+ }
1719
1820 /**
1921 * Creates a new builder.
@@ -35,84 +37,54 @@ public Class<Record> getRecordClass() {
3537 }
3638
3739 /**
38- * Gets the record definition .
40+ * Gets the vector store record collection factory .
3941 *
40- * @return the record definition
42+ * @return the vector store record collection factory
4143 */
42- public VectorStoreRecordDefinition getRecordDefinition () {
43- return recordDefinition ;
44+ public AzureAISearchVectorStoreRecordCollectionFactory < Record > getVectorStoreRecordCollectionFactory () {
45+ return vectorStoreRecordCollectionFactory ;
4446 }
4547
4648 /**
47- * Gets the vector store record mapper.
48- *
49- * @return the vector store record mapper
50- */
51- public VectorStoreRecordMapper <Record , SearchDocument > getVectorStoreRecordMapper () {
52- return vectorStoreRecordMapper ;
53- }
54-
55- private AzureAISearchVectorStoreOptions (
56- Class <Record > recordClass ,
57- VectorStoreRecordMapper <Record , SearchDocument > vectorStoreRecordMapper ,
58- VectorStoreRecordDefinition recordDefinition ) {
59- this .recordClass = recordClass ;
60- this .vectorStoreRecordMapper = vectorStoreRecordMapper ;
61- this .recordDefinition = recordDefinition ;
62- }
63-
64- /**
65- * Builder for {@link AzureAISearchVectorStoreOptions}.
49+ * Builder for Azure AI Search vector store options.
6650 *
6751 * @param <Record> the record type
6852 */
6953 public static class Builder <Record > {
70- private VectorStoreRecordMapper <Record , SearchDocument > vectorStoreRecordMapper ;
7154 private Class <Record > recordClass ;
72- private VectorStoreRecordDefinition recordDefinition ;
73-
74- public Builder <Record > withRecordClass (Class <Record > recordClass ) {
75- this .recordClass = recordClass ;
76- return this ;
77- }
55+ private AzureAISearchVectorStoreRecordCollectionFactory <Record > vectorStoreRecordCollectionFactory ;
7856
7957 /**
80- * Sets the vector store record mapper .
58+ * Sets the record class .
8159 *
82- * @param vectorStoreRecordMapper the vector store record mapper
83- * @return the builder
60+ * @param recordClass The record class.
61+ * @return The updated builder instance.
8462 */
85- public Builder <Record > withVectorStoreRecordMapper (
86- VectorStoreRecordMapper <Record , SearchDocument > vectorStoreRecordMapper ) {
87- this .vectorStoreRecordMapper = vectorStoreRecordMapper ;
63+ public Builder <Record > withRecordClass (Class <Record > recordClass ) {
64+ this .recordClass = recordClass ;
8865 return this ;
8966 }
9067
9168 /**
92- * Sets the record definition .
69+ * Sets the vector store record collection factory .
9370 *
94- * @param recordDefinition the record definition
95- * @return the builder
71+ * @param vectorStoreRecordCollectionFactory The vector store record collection factory.
72+ * @return The updated builder instance.
9673 */
97- public Builder <Record > withRecordDefinition (VectorStoreRecordDefinition recordDefinition ) {
98- this .recordDefinition = recordDefinition ;
74+ public Builder <Record > withVectorStoreRecordCollectionFactory (
75+ AzureAISearchVectorStoreRecordCollectionFactory <Record > vectorStoreRecordCollectionFactory ) {
76+ this .vectorStoreRecordCollectionFactory = vectorStoreRecordCollectionFactory ;
9977 return this ;
10078 }
10179
10280 /**
103- * Builds the options.
81+ * Builds the Azure AI Search vector store options.
10482 *
105- * @return the options
83+ * @return The Azure AI Search vector store options.
10684 */
10785 public AzureAISearchVectorStoreOptions <Record > build () {
108- if (recordClass == null ) {
109- throw new IllegalArgumentException ("recordClass must be provided" );
110- }
111-
112- return new AzureAISearchVectorStoreOptions <>(
113- recordClass ,
114- vectorStoreRecordMapper ,
115- recordDefinition );
86+ return new AzureAISearchVectorStoreOptions <>(recordClass ,
87+ vectorStoreRecordCollectionFactory );
11688 }
11789 }
11890}
0 commit comments