Skip to content

Commit 4b1df0c

Browse files
committed
Remove DeleteRecordOptions and UpsertRecordOptions from MEVD
Closes #10172
1 parent 8d46ee7 commit 4b1df0c

File tree

21 files changed

+121
-218
lines changed

21 files changed

+121
-218
lines changed

dotnet/samples/Concepts/Memory/VectorStoreEmbeddingGeneration/TextEmbeddingVectorStoreRecordCollection.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,15 +77,15 @@ public Task DeleteCollectionAsync(CancellationToken cancellationToken = default)
7777
}
7878

7979
/// <inheritdoc />
80-
public Task DeleteAsync(TKey key, DeleteRecordOptions? options = null, CancellationToken cancellationToken = default)
80+
public Task DeleteAsync(TKey key, CancellationToken cancellationToken = default)
8181
{
82-
return this._decoratedVectorStoreRecordCollection.DeleteAsync(key, options, cancellationToken);
82+
return this._decoratedVectorStoreRecordCollection.DeleteAsync(key, cancellationToken);
8383
}
8484

8585
/// <inheritdoc />
86-
public Task DeleteBatchAsync(IEnumerable<TKey> keys, DeleteRecordOptions? options = null, CancellationToken cancellationToken = default)
86+
public Task DeleteBatchAsync(IEnumerable<TKey> keys, CancellationToken cancellationToken = default)
8787
{
88-
return this._decoratedVectorStoreRecordCollection.DeleteBatchAsync(keys, options, cancellationToken);
88+
return this._decoratedVectorStoreRecordCollection.DeleteBatchAsync(keys, cancellationToken);
8989
}
9090

9191
/// <inheritdoc />
@@ -101,18 +101,18 @@ public IAsyncEnumerable<TRecord> GetBatchAsync(IEnumerable<TKey> keys, GetRecord
101101
}
102102

103103
/// <inheritdoc />
104-
public async Task<TKey> UpsertAsync(TRecord record, UpsertRecordOptions? options = null, CancellationToken cancellationToken = default)
104+
public async Task<TKey> UpsertAsync(TRecord record, CancellationToken cancellationToken = default)
105105
{
106106
var recordWithEmbeddings = await this.AddEmbeddingsAsync(record, cancellationToken).ConfigureAwait(false);
107-
return await this._decoratedVectorStoreRecordCollection.UpsertAsync(recordWithEmbeddings, options, cancellationToken).ConfigureAwait(false);
107+
return await this._decoratedVectorStoreRecordCollection.UpsertAsync(recordWithEmbeddings, cancellationToken).ConfigureAwait(false);
108108
}
109109

110110
/// <inheritdoc />
111-
public async IAsyncEnumerable<TKey> UpsertBatchAsync(IEnumerable<TRecord> records, UpsertRecordOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default)
111+
public async IAsyncEnumerable<TKey> UpsertBatchAsync(IEnumerable<TRecord> records, [EnumeratorCancellation] CancellationToken cancellationToken = default)
112112
{
113113
var recordWithEmbeddingsTasks = records.Select(r => this.AddEmbeddingsAsync(r, cancellationToken));
114114
var recordWithEmbeddings = await Task.WhenAll(recordWithEmbeddingsTasks).ConfigureAwait(false);
115-
var upsertResults = this._decoratedVectorStoreRecordCollection.UpsertBatchAsync(recordWithEmbeddings, options, cancellationToken);
115+
var upsertResults = this._decoratedVectorStoreRecordCollection.UpsertBatchAsync(recordWithEmbeddings, cancellationToken);
116116
await foreach (var upsertResult in upsertResults.ConfigureAwait(false))
117117
{
118118
yield return upsertResult;

dotnet/samples/Concepts/Memory/VectorStoreLangchainInterop/MappingVectorStoreRecordCollection.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ public Task CreateCollectionIfNotExistsAsync(CancellationToken cancellationToken
6464
}
6565

6666
/// <inheritdoc />
67-
public Task DeleteAsync(TPublicKey key, DeleteRecordOptions? options = null, CancellationToken cancellationToken = default)
67+
public Task DeleteAsync(TPublicKey key, CancellationToken cancellationToken = default)
6868
{
69-
return this._collection.DeleteAsync(this._publicToInternalKeyMapper(key), options, cancellationToken);
69+
return this._collection.DeleteAsync(this._publicToInternalKeyMapper(key), cancellationToken);
7070
}
7171

7272
/// <inheritdoc />
73-
public Task DeleteBatchAsync(IEnumerable<TPublicKey> keys, DeleteRecordOptions? options = null, CancellationToken cancellationToken = default)
73+
public Task DeleteBatchAsync(IEnumerable<TPublicKey> keys, CancellationToken cancellationToken = default)
7474
{
75-
return this._collection.DeleteBatchAsync(keys.Select(this._publicToInternalKeyMapper), options, cancellationToken);
75+
return this._collection.DeleteBatchAsync(keys.Select(this._publicToInternalKeyMapper), cancellationToken);
7676
}
7777

7878
/// <inheritdoc />
@@ -101,18 +101,18 @@ public IAsyncEnumerable<TPublicRecord> GetBatchAsync(IEnumerable<TPublicKey> key
101101
}
102102

103103
/// <inheritdoc />
104-
public async Task<TPublicKey> UpsertAsync(TPublicRecord record, UpsertRecordOptions? options = null, CancellationToken cancellationToken = default)
104+
public async Task<TPublicKey> UpsertAsync(TPublicRecord record, CancellationToken cancellationToken = default)
105105
{
106106
var internalRecord = this._publicToInternalRecordMapper(record);
107-
var internalKey = await this._collection.UpsertAsync(internalRecord, options, cancellationToken).ConfigureAwait(false);
107+
var internalKey = await this._collection.UpsertAsync(internalRecord, cancellationToken).ConfigureAwait(false);
108108
return this._internalToPublicKeyMapper(internalKey);
109109
}
110110

111111
/// <inheritdoc />
112-
public async IAsyncEnumerable<TPublicKey> UpsertBatchAsync(IEnumerable<TPublicRecord> records, UpsertRecordOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default)
112+
public async IAsyncEnumerable<TPublicKey> UpsertBatchAsync(IEnumerable<TPublicRecord> records, [EnumeratorCancellation] CancellationToken cancellationToken = default)
113113
{
114114
var internalRecords = records.Select(this._publicToInternalRecordMapper);
115-
var internalKeys = this._collection.UpsertBatchAsync(internalRecords, options, cancellationToken);
115+
var internalKeys = this._collection.UpsertBatchAsync(internalRecords, cancellationToken);
116116
await foreach (var internalKey in internalKeys.ConfigureAwait(false))
117117
{
118118
yield return this._internalToPublicKeyMapper(internalKey);

dotnet/samples/GettingStartedWithVectorStores/Step4_NonStringKey_VectorStore.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,15 @@ public Task CreateCollectionIfNotExistsAsync(CancellationToken cancellationToken
124124
}
125125

126126
/// <inheritdoc />
127-
public Task DeleteAsync(TPublicKey key, DeleteRecordOptions? options = null, CancellationToken cancellationToken = default)
127+
public Task DeleteAsync(TPublicKey key, CancellationToken cancellationToken = default)
128128
{
129-
return this._collection.DeleteAsync(this._publicToInternalKeyMapper(key), options, cancellationToken);
129+
return this._collection.DeleteAsync(this._publicToInternalKeyMapper(key), cancellationToken);
130130
}
131131

132132
/// <inheritdoc />
133-
public Task DeleteBatchAsync(IEnumerable<TPublicKey> keys, DeleteRecordOptions? options = null, CancellationToken cancellationToken = default)
133+
public Task DeleteBatchAsync(IEnumerable<TPublicKey> keys, CancellationToken cancellationToken = default)
134134
{
135-
return this._collection.DeleteBatchAsync(keys.Select(this._publicToInternalKeyMapper), options, cancellationToken);
135+
return this._collection.DeleteBatchAsync(keys.Select(this._publicToInternalKeyMapper), cancellationToken);
136136
}
137137

138138
/// <inheritdoc />
@@ -161,18 +161,18 @@ public IAsyncEnumerable<TPublicRecord> GetBatchAsync(IEnumerable<TPublicKey> key
161161
}
162162

163163
/// <inheritdoc />
164-
public async Task<TPublicKey> UpsertAsync(TPublicRecord record, UpsertRecordOptions? options = null, CancellationToken cancellationToken = default)
164+
public async Task<TPublicKey> UpsertAsync(TPublicRecord record, CancellationToken cancellationToken = default)
165165
{
166166
var internalRecord = this._publicToInternalRecordMapper(record);
167-
var internalKey = await this._collection.UpsertAsync(internalRecord, options, cancellationToken).ConfigureAwait(false);
167+
var internalKey = await this._collection.UpsertAsync(internalRecord, cancellationToken).ConfigureAwait(false);
168168
return this._internalToPublicKeyMapper(internalKey);
169169
}
170170

171171
/// <inheritdoc />
172-
public async IAsyncEnumerable<TPublicKey> UpsertBatchAsync(IEnumerable<TPublicRecord> records, UpsertRecordOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default)
172+
public async IAsyncEnumerable<TPublicKey> UpsertBatchAsync(IEnumerable<TPublicRecord> records, [EnumeratorCancellation] CancellationToken cancellationToken = default)
173173
{
174174
var internalRecords = records.Select(this._publicToInternalRecordMapper);
175-
var internalKeys = this._collection.UpsertBatchAsync(internalRecords, options, cancellationToken);
175+
var internalKeys = this._collection.UpsertBatchAsync(internalRecords, cancellationToken);
176176
await foreach (var internalKey in internalKeys.ConfigureAwait(false))
177177
{
178178
yield return this._internalToPublicKeyMapper(internalKey);

dotnet/src/Connectors/Connectors.AzureAISearch.UnitTests/AzureAISearchVectorStoreRecordCollectionTests.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -514,10 +514,7 @@ public async Task CanUpsertRecordWithCustomMapperAsync()
514514
});
515515

516516
// Act.
517-
await sut.UpsertAsync(
518-
model,
519-
null,
520-
this._testCancellationToken);
517+
await sut.UpsertAsync(model, this._testCancellationToken);
521518

522519
// Assert.
523520
mapperMock

dotnet/src/Connectors/Connectors.Memory.AzureAISearch/AzureAISearchVectorStoreRecordCollection.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ public async IAsyncEnumerable<TRecord> GetBatchAsync(IEnumerable<string> keys, G
263263
}
264264

265265
/// <inheritdoc />
266-
public Task DeleteAsync(string key, DeleteRecordOptions? options = default, CancellationToken cancellationToken = default)
266+
public Task DeleteAsync(string key, CancellationToken cancellationToken = default)
267267
{
268268
Verify.NotNullOrWhiteSpace(key);
269269

@@ -274,7 +274,7 @@ public Task DeleteAsync(string key, DeleteRecordOptions? options = default, Canc
274274
}
275275

276276
/// <inheritdoc />
277-
public Task DeleteBatchAsync(IEnumerable<string> keys, DeleteRecordOptions? options = default, CancellationToken cancellationToken = default)
277+
public Task DeleteBatchAsync(IEnumerable<string> keys, CancellationToken cancellationToken = default)
278278
{
279279
Verify.NotNull(keys);
280280

@@ -285,7 +285,7 @@ public Task DeleteBatchAsync(IEnumerable<string> keys, DeleteRecordOptions? opti
285285
}
286286

287287
/// <inheritdoc />
288-
public async Task<string> UpsertAsync(TRecord record, UpsertRecordOptions? options = default, CancellationToken cancellationToken = default)
288+
public async Task<string> UpsertAsync(TRecord record, CancellationToken cancellationToken = default)
289289
{
290290
Verify.NotNull(record);
291291

@@ -298,7 +298,7 @@ public async Task<string> UpsertAsync(TRecord record, UpsertRecordOptions? optio
298298
}
299299

300300
/// <inheritdoc />
301-
public async IAsyncEnumerable<string> UpsertBatchAsync(IEnumerable<TRecord> records, UpsertRecordOptions? options = default, [EnumeratorCancellation] CancellationToken cancellationToken = default)
301+
public async IAsyncEnumerable<string> UpsertBatchAsync(IEnumerable<TRecord> records, [EnumeratorCancellation] CancellationToken cancellationToken = default)
302302
{
303303
Verify.NotNull(records);
304304

dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBMongoDB/AzureCosmosDBMongoDBVectorStoreRecordCollection.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public async Task CreateCollectionIfNotExistsAsync(CancellationToken cancellatio
117117
}
118118

119119
/// <inheritdoc />
120-
public async Task DeleteAsync(string key, DeleteRecordOptions? options = null, CancellationToken cancellationToken = default)
120+
public async Task DeleteAsync(string key, CancellationToken cancellationToken = default)
121121
{
122122
Verify.NotNullOrWhiteSpace(key);
123123

@@ -126,7 +126,7 @@ await this.RunOperationAsync("DeleteOne", () => this._mongoCollection.DeleteOneA
126126
}
127127

128128
/// <inheritdoc />
129-
public async Task DeleteBatchAsync(IEnumerable<string> keys, DeleteRecordOptions? options = null, CancellationToken cancellationToken = default)
129+
public async Task DeleteBatchAsync(IEnumerable<string> keys, CancellationToken cancellationToken = default)
130130
{
131131
Verify.NotNull(keys);
132132

@@ -199,7 +199,7 @@ public async IAsyncEnumerable<TRecord> GetBatchAsync(
199199
}
200200

201201
/// <inheritdoc />
202-
public Task<string> UpsertAsync(TRecord record, UpsertRecordOptions? options = null, CancellationToken cancellationToken = default)
202+
public Task<string> UpsertAsync(TRecord record, CancellationToken cancellationToken = default)
203203
{
204204
Verify.NotNull(record);
205205

@@ -225,14 +225,11 @@ await this._mongoCollection
225225
}
226226

227227
/// <inheritdoc />
228-
public async IAsyncEnumerable<string> UpsertBatchAsync(
229-
IEnumerable<TRecord> records,
230-
UpsertRecordOptions? options = null,
231-
[EnumeratorCancellation] CancellationToken cancellationToken = default)
228+
public async IAsyncEnumerable<string> UpsertBatchAsync(IEnumerable<TRecord> records, [EnumeratorCancellation] CancellationToken cancellationToken = default)
232229
{
233230
Verify.NotNull(records);
234231

235-
var tasks = records.Select(record => this.UpsertAsync(record, options, cancellationToken));
232+
var tasks = records.Select(record => this.UpsertAsync(record, cancellationToken));
236233
var results = await Task.WhenAll(tasks).ConfigureAwait(false);
237234

238235
foreach (var result in results)
@@ -278,7 +275,7 @@ public async Task<VectorSearchResults<TRecord>> VectorizedSearchAsync<TVector>(
278275
this._storagePropertyNames);
279276

280277
// Constructing a query to fetch "skip + top" total items
281-
// to perform skip logic locally, since skip option is not part of API.
278+
// to perform skip logic locally, since skip option is not part of API.
282279
var itemsAmount = searchOptions.Skip + searchOptions.Top;
283280

284281
var vectorPropertyIndexKind = AzureCosmosDBMongoDBVectorStoreCollectionSearchMapping.GetVectorPropertyIndexKind(vectorProperty.IndexKind);

dotnet/src/Connectors/Connectors.Memory.AzureCosmosDBNoSQL/AzureCosmosDBNoSQLVectorStoreRecordCollection.cs

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public Task DeleteCollectionAsync(CancellationToken cancellationToken = default)
215215
#region Implementation of IVectorStoreRecordCollection<string, TRecord>
216216

217217
/// <inheritdoc />
218-
public Task DeleteAsync(string key, DeleteRecordOptions? options = null, CancellationToken cancellationToken = default)
218+
public Task DeleteAsync(string key, CancellationToken cancellationToken = default)
219219
{
220220
// Use record key as partition key
221221
var compositeKey = new AzureCosmosDBNoSQLCompositeKey(recordKey: key, partitionKey: key);
@@ -224,7 +224,7 @@ public Task DeleteAsync(string key, DeleteRecordOptions? options = null, Cancell
224224
}
225225

226226
/// <inheritdoc />
227-
public Task DeleteBatchAsync(IEnumerable<string> keys, DeleteRecordOptions? options = null, CancellationToken cancellationToken = default)
227+
public Task DeleteBatchAsync(IEnumerable<string> keys, CancellationToken cancellationToken = default)
228228
{
229229
// Use record keys as partition keys
230230
var compositeKeys = keys.Select(key => new AzureCosmosDBNoSQLCompositeKey(recordKey: key, partitionKey: key));
@@ -262,18 +262,15 @@ public async IAsyncEnumerable<TRecord> GetBatchAsync(
262262
}
263263

264264
/// <inheritdoc />
265-
public async Task<string> UpsertAsync(TRecord record, UpsertRecordOptions? options = null, CancellationToken cancellationToken = default)
265+
public async Task<string> UpsertAsync(TRecord record, CancellationToken cancellationToken = default)
266266
{
267267
var key = await this.InternalUpsertAsync(record, cancellationToken).ConfigureAwait(false);
268268

269269
return key.RecordKey;
270270
}
271271

272272
/// <inheritdoc />
273-
public async IAsyncEnumerable<string> UpsertBatchAsync(
274-
IEnumerable<TRecord> records,
275-
UpsertRecordOptions? options = null,
276-
[EnumeratorCancellation] CancellationToken cancellationToken = default)
273+
public async IAsyncEnumerable<string> UpsertBatchAsync(IEnumerable<TRecord> records, [EnumeratorCancellation] CancellationToken cancellationToken = default)
277274
{
278275
Verify.NotNull(records);
279276

@@ -318,27 +315,26 @@ public async IAsyncEnumerable<TRecord> GetBatchAsync(
318315
}
319316

320317
/// <inheritdoc />
321-
public Task DeleteAsync(AzureCosmosDBNoSQLCompositeKey key, DeleteRecordOptions? options = null, CancellationToken cancellationToken = default)
318+
public Task DeleteAsync(AzureCosmosDBNoSQLCompositeKey key, CancellationToken cancellationToken = default)
322319
{
323320
return this.InternalDeleteAsync([key], cancellationToken);
324321
}
325322

326323
/// <inheritdoc />
327-
public Task DeleteBatchAsync(IEnumerable<AzureCosmosDBNoSQLCompositeKey> keys, DeleteRecordOptions? options = null, CancellationToken cancellationToken = default)
324+
public Task DeleteBatchAsync(IEnumerable<AzureCosmosDBNoSQLCompositeKey> keys, CancellationToken cancellationToken = default)
328325
{
329326
return this.InternalDeleteAsync(keys, cancellationToken);
330327
}
331328

332329
/// <inheritdoc />
333-
Task<AzureCosmosDBNoSQLCompositeKey> IVectorStoreRecordCollection<AzureCosmosDBNoSQLCompositeKey, TRecord>.UpsertAsync(TRecord record, UpsertRecordOptions? options, CancellationToken cancellationToken)
330+
Task<AzureCosmosDBNoSQLCompositeKey> IVectorStoreRecordCollection<AzureCosmosDBNoSQLCompositeKey, TRecord>.UpsertAsync(TRecord record, CancellationToken cancellationToken)
334331
{
335332
return this.InternalUpsertAsync(record, cancellationToken);
336333
}
337334

338335
/// <inheritdoc />
339336
async IAsyncEnumerable<AzureCosmosDBNoSQLCompositeKey> IVectorStoreRecordCollection<AzureCosmosDBNoSQLCompositeKey, TRecord>.UpsertBatchAsync(
340337
IEnumerable<TRecord> records,
341-
UpsertRecordOptions? options,
342338
[EnumeratorCancellation] CancellationToken cancellationToken)
343339
{
344340
Verify.NotNull(records);

dotnet/src/Connectors/Connectors.Memory.InMemory/InMemoryVectorStoreRecordCollection.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ public async IAsyncEnumerable<TRecord> GetBatchAsync(IEnumerable<TKey> keys, Get
165165
}
166166

167167
/// <inheritdoc />
168-
public Task DeleteAsync(TKey key, DeleteRecordOptions? options = null, CancellationToken cancellationToken = default)
168+
public Task DeleteAsync(TKey key, CancellationToken cancellationToken = default)
169169
{
170170
var collectionDictionary = this.GetCollectionDictionary();
171171

@@ -174,7 +174,7 @@ public Task DeleteAsync(TKey key, DeleteRecordOptions? options = null, Cancellat
174174
}
175175

176176
/// <inheritdoc />
177-
public Task DeleteBatchAsync(IEnumerable<TKey> keys, DeleteRecordOptions? options = null, CancellationToken cancellationToken = default)
177+
public Task DeleteBatchAsync(IEnumerable<TKey> keys, CancellationToken cancellationToken = default)
178178
{
179179
var collectionDictionary = this.GetCollectionDictionary();
180180

@@ -187,7 +187,7 @@ public Task DeleteBatchAsync(IEnumerable<TKey> keys, DeleteRecordOptions? option
187187
}
188188

189189
/// <inheritdoc />
190-
public Task<TKey> UpsertAsync(TRecord record, UpsertRecordOptions? options = null, CancellationToken cancellationToken = default)
190+
public Task<TKey> UpsertAsync(TRecord record, CancellationToken cancellationToken = default)
191191
{
192192
Verify.NotNull(record);
193193

@@ -200,11 +200,11 @@ public Task<TKey> UpsertAsync(TRecord record, UpsertRecordOptions? options = nul
200200
}
201201

202202
/// <inheritdoc />
203-
public async IAsyncEnumerable<TKey> UpsertBatchAsync(IEnumerable<TRecord> records, UpsertRecordOptions? options = null, [EnumeratorCancellation] CancellationToken cancellationToken = default)
203+
public async IAsyncEnumerable<TKey> UpsertBatchAsync(IEnumerable<TRecord> records, [EnumeratorCancellation] CancellationToken cancellationToken = default)
204204
{
205205
foreach (var record in records)
206206
{
207-
yield return await this.UpsertAsync(record, options, cancellationToken).ConfigureAwait(false);
207+
yield return await this.UpsertAsync(record, cancellationToken).ConfigureAwait(false);
208208
}
209209
}
210210

0 commit comments

Comments
 (0)