@@ -193,11 +193,11 @@ public async Task GetLimitOffsetIncludeAll()
193
193
}
194
194
195
195
[ Test ]
196
- public async Task GetWhereIncludeAll ( )
196
+ public async Task GetWhereEqualIncludeAll ( )
197
197
{
198
198
var client = await Init ( ) ;
199
199
var result = await client . Get (
200
- where : new Dictionary < string , object > { { MetadataKey2 , Metadata2 [ MetadataKey2 ] } } ,
200
+ where : ChromaWhere . Equal ( MetadataKey2 , Metadata2 [ MetadataKey2 ] ) ,
201
201
include : ChromaGetInclude . Embeddings | ChromaGetInclude . Metadatas | ChromaGetInclude . Documents ) ;
202
202
Assert . That ( result , Has . Count . EqualTo ( 1 ) ) ;
203
203
Assert . That ( result [ 0 ] . Id , Is . EqualTo ( Id2 ) ) ;
@@ -207,11 +207,67 @@ public async Task GetWhereIncludeAll()
207
207
}
208
208
209
209
[ Test ]
210
- public async Task GetWhereOperatorIncludeAll ( )
210
+ public async Task GetWhereNotEqualIncludeAll ( )
211
211
{
212
212
var client = await Init ( ) ;
213
213
var result = await client . Get (
214
- where : new Dictionary < string , object > { { MetadataKey2 , new Dictionary < string , object > { { "$lt" , Metadata2 [ MetadataKey2 ] } } } } ,
214
+ where : ChromaWhere . NotEqual ( MetadataKey2 , Metadata1 [ MetadataKey2 ] ) ,
215
+ include : ChromaGetInclude . Embeddings | ChromaGetInclude . Metadatas | ChromaGetInclude . Documents ) ;
216
+ Assert . That ( result , Has . Count . EqualTo ( 1 ) ) ;
217
+ Assert . That ( result [ 0 ] . Id , Is . EqualTo ( Id2 ) ) ;
218
+ Assert . That ( result [ 0 ] . Embeddings , Is . EqualTo ( Embeddings2 ) . Using ( EmbeddingsComparer . Instance ) ) ;
219
+ Assert . That ( result [ 0 ] . Metadata , Is . EqualTo ( Metadata2 ) ) ;
220
+ Assert . That ( result [ 0 ] . Document , Is . EqualTo ( Doc2 ) ) ;
221
+ }
222
+
223
+ [ Test ]
224
+ public async Task GetWhereInIncludeAll ( )
225
+ {
226
+ var client = await Init ( ) ;
227
+ var result = await client . Get (
228
+ where : ChromaWhere . In ( MetadataKey2 , Metadata2 [ MetadataKey2 ] ) ,
229
+ include : ChromaGetInclude . Embeddings | ChromaGetInclude . Metadatas | ChromaGetInclude . Documents ) ;
230
+ Assert . That ( result , Has . Count . EqualTo ( 1 ) ) ;
231
+ Assert . That ( result [ 0 ] . Id , Is . EqualTo ( Id2 ) ) ;
232
+ Assert . That ( result [ 0 ] . Embeddings , Is . EqualTo ( Embeddings2 ) . Using ( EmbeddingsComparer . Instance ) ) ;
233
+ Assert . That ( result [ 0 ] . Metadata , Is . EqualTo ( Metadata2 ) ) ;
234
+ Assert . That ( result [ 0 ] . Document , Is . EqualTo ( Doc2 ) ) ;
235
+ }
236
+
237
+ [ Test ]
238
+ public async Task GetWhereNotInIncludeAll ( )
239
+ {
240
+ var client = await Init ( ) ;
241
+ var result = await client . Get (
242
+ where : ChromaWhere . NotIn ( MetadataKey2 , Metadata1 [ MetadataKey2 ] ) ,
243
+ include : ChromaGetInclude . Embeddings | ChromaGetInclude . Metadatas | ChromaGetInclude . Documents ) ;
244
+ Assert . That ( result , Has . Count . EqualTo ( 1 ) ) ;
245
+ Assert . That ( result [ 0 ] . Id , Is . EqualTo ( Id2 ) ) ;
246
+ Assert . That ( result [ 0 ] . Embeddings , Is . EqualTo ( Embeddings2 ) . Using ( EmbeddingsComparer . Instance ) ) ;
247
+ Assert . That ( result [ 0 ] . Metadata , Is . EqualTo ( Metadata2 ) ) ;
248
+ Assert . That ( result [ 0 ] . Document , Is . EqualTo ( Doc2 ) ) ;
249
+ }
250
+
251
+ [ Test ]
252
+ public async Task GetWhereGreaterThanIncludeAll ( )
253
+ {
254
+ var client = await Init ( ) ;
255
+ var result = await client . Get (
256
+ where : ChromaWhere . GreaterThan ( MetadataKey2 , Metadata1 [ MetadataKey2 ] ) ,
257
+ include : ChromaGetInclude . Embeddings | ChromaGetInclude . Metadatas | ChromaGetInclude . Documents ) ;
258
+ Assert . That ( result , Has . Count . EqualTo ( 1 ) ) ;
259
+ Assert . That ( result [ 0 ] . Id , Is . EqualTo ( Id2 ) ) ;
260
+ Assert . That ( result [ 0 ] . Embeddings , Is . EqualTo ( Embeddings2 ) . Using ( EmbeddingsComparer . Instance ) ) ;
261
+ Assert . That ( result [ 0 ] . Metadata , Is . EqualTo ( Metadata2 ) ) ;
262
+ Assert . That ( result [ 0 ] . Document , Is . EqualTo ( Doc2 ) ) ;
263
+ }
264
+
265
+ [ Test ]
266
+ public async Task GetWhereLessThanIncludeAll ( )
267
+ {
268
+ var client = await Init ( ) ;
269
+ var result = await client . Get (
270
+ where : ChromaWhere . LessThan ( MetadataKey2 , Metadata2 [ MetadataKey2 ] ) ,
215
271
include : ChromaGetInclude . Embeddings | ChromaGetInclude . Metadatas | ChromaGetInclude . Documents ) ;
216
272
Assert . That ( result , Has . Count . EqualTo ( 1 ) ) ;
217
273
Assert . That ( result [ 0 ] . Id , Is . EqualTo ( Id1 ) ) ;
@@ -221,39 +277,67 @@ public async Task GetWhereOperatorIncludeAll()
221
277
}
222
278
223
279
[ Test ]
224
- public async Task GetWhereDocumentContainsIncludeDocuments ( )
280
+ public async Task GetWhereGreaterThanOrEqualIncludeAll ( )
225
281
{
226
282
var client = await Init ( ) ;
227
283
var result = await client . Get (
228
- whereDocument : ChromaWhereDocument . Contains ( Doc1 [ ^ 1 ] ) ,
229
- include : ChromaGetInclude . Documents ) ;
284
+ where : ChromaWhere . GreaterThanOrEqual ( MetadataKey2 , Metadata2 [ MetadataKey2 ] ) ,
285
+ include : ChromaGetInclude . Embeddings | ChromaGetInclude . Metadatas | ChromaGetInclude . Documents ) ;
230
286
Assert . That ( result , Has . Count . EqualTo ( 1 ) ) ;
231
- Assert . That ( result [ 0 ] . Id , Is . EqualTo ( Id1 ) ) ;
232
- Assert . That ( result [ 0 ] . Embeddings , Is . Null ) ;
233
- Assert . That ( result [ 0 ] . Metadata , Is . Null ) ;
234
- Assert . That ( result [ 0 ] . Document , Is . EqualTo ( Doc1 ) ) ;
287
+ Assert . That ( result [ 0 ] . Id , Is . EqualTo ( Id2 ) ) ;
288
+ Assert . That ( result [ 0 ] . Embeddings , Is . EqualTo ( Embeddings2 ) . Using ( EmbeddingsComparer . Instance ) ) ;
289
+ Assert . That ( result [ 0 ] . Metadata , Is . EqualTo ( Metadata2 ) ) ;
290
+ Assert . That ( result [ 0 ] . Document , Is . EqualTo ( Doc2 ) ) ;
235
291
}
236
292
237
293
[ Test ]
238
- public async Task GetWhereDocumentNotContainsIncludeDocuments ( )
294
+ public async Task GetWhereLessThanOrEqualIncludeAll ( )
239
295
{
240
296
var client = await Init ( ) ;
241
297
var result = await client . Get (
242
- whereDocument : ChromaWhereDocument . NotContains ( Doc2 [ ^ 1 ] ) ,
243
- include : ChromaGetInclude . Documents ) ;
298
+ where : ChromaWhere . LessThanOrEqual ( MetadataKey2 , Metadata1 [ MetadataKey2 ] ) ,
299
+ include : ChromaGetInclude . Embeddings | ChromaGetInclude . Metadatas | ChromaGetInclude . Documents ) ;
244
300
Assert . That ( result , Has . Count . EqualTo ( 1 ) ) ;
245
301
Assert . That ( result [ 0 ] . Id , Is . EqualTo ( Id1 ) ) ;
246
- Assert . That ( result [ 0 ] . Embeddings , Is . Null ) ;
247
- Assert . That ( result [ 0 ] . Metadata , Is . Null ) ;
302
+ Assert . That ( result [ 0 ] . Embeddings , Is . EqualTo ( Embeddings1 ) . Using ( EmbeddingsComparer . Instance ) ) ;
303
+ Assert . That ( result [ 0 ] . Metadata , Is . EqualTo ( Metadata1 ) ) ;
248
304
Assert . That ( result [ 0 ] . Document , Is . EqualTo ( Doc1 ) ) ;
249
305
}
250
306
251
307
[ Test ]
252
- public async Task GetWhereDocumentAndIncludeDocuments ( )
308
+ public async Task GetWhereAndIncludeAll ( )
309
+ {
310
+ var client = await Init ( ) ;
311
+ var result = await client . Get (
312
+ where : ChromaWhere . Equal ( MetadataKey2 , Metadata2 [ MetadataKey2 ] ) && ChromaWhere . NotEqual ( MetadataKey2 , Metadata1 [ MetadataKey2 ] ) ,
313
+ include : ChromaGetInclude . Embeddings | ChromaGetInclude . Metadatas | ChromaGetInclude . Documents ) ;
314
+ Assert . That ( result , Has . Count . EqualTo ( 1 ) ) ;
315
+ Assert . That ( result [ 0 ] . Id , Is . EqualTo ( Id2 ) ) ;
316
+ Assert . That ( result [ 0 ] . Embeddings , Is . EqualTo ( Embeddings2 ) . Using ( EmbeddingsComparer . Instance ) ) ;
317
+ Assert . That ( result [ 0 ] . Metadata , Is . EqualTo ( Metadata2 ) ) ;
318
+ Assert . That ( result [ 0 ] . Document , Is . EqualTo ( Doc2 ) ) ;
319
+ }
320
+
321
+ [ Test ]
322
+ public async Task GetWhereOrIncludeAll ( )
323
+ {
324
+ var client = await Init ( ) ;
325
+ var result = await client . Get (
326
+ where : ChromaWhere . Equal ( MetadataKey2 , Metadata2 [ MetadataKey2 ] ) || ChromaWhere . NotEqual ( MetadataKey2 , Metadata1 [ MetadataKey2 ] ) ,
327
+ include : ChromaGetInclude . Embeddings | ChromaGetInclude . Metadatas | ChromaGetInclude . Documents ) ;
328
+ Assert . That ( result , Has . Count . EqualTo ( 1 ) ) ;
329
+ Assert . That ( result [ 0 ] . Id , Is . EqualTo ( Id2 ) ) ;
330
+ Assert . That ( result [ 0 ] . Embeddings , Is . EqualTo ( Embeddings2 ) . Using ( EmbeddingsComparer . Instance ) ) ;
331
+ Assert . That ( result [ 0 ] . Metadata , Is . EqualTo ( Metadata2 ) ) ;
332
+ Assert . That ( result [ 0 ] . Document , Is . EqualTo ( Doc2 ) ) ;
333
+ }
334
+
335
+ [ Test ]
336
+ public async Task GetWhereDocumentContainsIncludeDocuments ( )
253
337
{
254
338
var client = await Init ( ) ;
255
339
var result = await client . Get (
256
- whereDocument : ChromaWhereDocument . Contains ( Doc1 [ ^ 1 ] ) && ChromaWhereDocument . NotContains ( Doc2 [ ^ 1 ] ) ,
340
+ whereDocument : ChromaWhereDocument . Contains ( Doc1 [ ^ 1 ] ) ,
257
341
include : ChromaGetInclude . Documents ) ;
258
342
Assert . That ( result , Has . Count . EqualTo ( 1 ) ) ;
259
343
Assert . That ( result [ 0 ] . Id , Is . EqualTo ( Id1 ) ) ;
@@ -263,11 +347,11 @@ public async Task GetWhereDocumentAndIncludeDocuments()
263
347
}
264
348
265
349
[ Test ]
266
- public async Task GetWhereDocumentOrIncludeDocuments ( )
350
+ public async Task GetWhereDocumentNotContainsIncludeDocuments ( )
267
351
{
268
352
var client = await Init ( ) ;
269
353
var result = await client . Get (
270
- whereDocument : ChromaWhereDocument . Contains ( Doc1 [ ^ 1 ] ) || ChromaWhereDocument . NotContains ( Doc2 [ ^ 1 ] ) ,
354
+ whereDocument : ChromaWhereDocument . NotContains ( Doc2 [ ^ 1 ] ) ,
271
355
include : ChromaGetInclude . Documents ) ;
272
356
Assert . That ( result , Has . Count . EqualTo ( 1 ) ) ;
273
357
Assert . That ( result [ 0 ] . Id , Is . EqualTo ( Id1 ) ) ;
0 commit comments