@@ -120,12 +120,12 @@ Now, you can query for similar items:
120
120
vec.search([1.0 , 9.0 ])
121
121
```
122
122
123
- [[UUID('73d05df0-84c1-11ee-98da-6ee10b77fd08 '),
123
+ [[UUID('45ecb666-0f15-11ef-8d89-e666703872d0 '),
124
124
{'action': 'jump', 'animal': 'fox'},
125
125
'jumped over the',
126
126
array([ 1. , 10.8], dtype=float32),
127
127
0.00016793422934946456],
128
- [UUID('73d05d6e-84c1-11ee-98da-6ee10b77fd08 '),
128
+ [UUID('45ecb350-0f15-11ef-8d89-e666703872d0 '),
129
129
{'animal': 'fox'},
130
130
'the brown fox',
131
131
array([1. , 1.3], dtype=float32),
@@ -141,7 +141,7 @@ constrained by a metadata filter.
141
141
vec.search([1.0 , 9.0 ], limit = 1 , filter = {" action" : " jump" })
142
142
```
143
143
144
- [[UUID('73d05df0-84c1-11ee-98da-6ee10b77fd08 '),
144
+ [[UUID('45ecb666-0f15-11ef-8d89-e666703872d0 '),
145
145
{'action': 'jump', 'animal': 'fox'},
146
146
'jumped over the',
147
147
array([ 1. , 10.8], dtype=float32),
@@ -165,7 +165,7 @@ records = vec.search([1.0, 9.0], limit=1, filter={"action": "jump"})
165
165
(records[0 ][" id" ],records[0 ][" metadata" ], records[0 ][" contents" ], records[0 ][" embedding" ], records[0 ][" distance" ])
166
166
```
167
167
168
- (UUID('73d05df0-84c1-11ee-98da-6ee10b77fd08 '),
168
+ (UUID('45ecb666-0f15-11ef-8d89-e666703872d0 '),
169
169
{'action': 'jump', 'animal': 'fox'},
170
170
'jumped over the',
171
171
array([ 1. , 10.8], dtype=float32),
@@ -228,12 +228,12 @@ The basic query looks like:
228
228
vec.search([1.0 , 9.0 ])
229
229
```
230
230
231
- [[UUID('7487af96-84c1-11ee-98da-6ee10b77fd08 '),
231
+ [[UUID('4d629b54-0f15-11ef-8d89-e666703872d0 '),
232
232
{'times': 100, 'action': 'jump', 'animal': 'fox'},
233
233
'jumped over the',
234
234
array([ 1. , 10.8], dtype=float32),
235
235
0.00016793422934946456],
236
- [UUID('7487af14-84c1-11ee-98da-6ee10b77fd08 '),
236
+ [UUID('4d629a50-0f15-11ef-8d89-e666703872d0 '),
237
237
{'times': 1, 'action': 'sit', 'animal': 'fox'},
238
238
'the brown fox',
239
239
array([1. , 1.3], dtype=float32),
@@ -245,7 +245,7 @@ You could provide a limit for the number of items returned:
245
245
vec.search([1.0 , 9.0 ], limit = 1 )
246
246
```
247
247
248
- [[UUID('7487af96-84c1-11ee-98da-6ee10b77fd08 '),
248
+ [[UUID('4d629b54-0f15-11ef-8d89-e666703872d0 '),
249
249
{'times': 100, 'action': 'jump', 'animal': 'fox'},
250
250
'jumped over the',
251
251
array([ 1. , 10.8], dtype=float32),
@@ -270,7 +270,7 @@ unconstrained):
270
270
vec.search([1.0 , 9.0 ], limit = 1 , filter = {" action" : " sit" })
271
271
```
272
272
273
- [[UUID('7487af14-84c1-11ee-98da-6ee10b77fd08 '),
273
+ [[UUID('4d629a50-0f15-11ef-8d89-e666703872d0 '),
274
274
{'times': 1, 'action': 'sit', 'animal': 'fox'},
275
275
'the brown fox',
276
276
array([1. , 1.3], dtype=float32),
@@ -283,12 +283,12 @@ returned if it matches any dict:
283
283
vec.search([1.0 , 9.0 ], limit = 2 , filter = [{" action" : " jump" }, {" animal" : " fox" }])
284
284
```
285
285
286
- [[UUID('7487af96-84c1-11ee-98da-6ee10b77fd08 '),
286
+ [[UUID('4d629b54-0f15-11ef-8d89-e666703872d0 '),
287
287
{'times': 100, 'action': 'jump', 'animal': 'fox'},
288
288
'jumped over the',
289
289
array([ 1. , 10.8], dtype=float32),
290
290
0.00016793422934946456],
291
- [UUID('7487af14-84c1-11ee-98da-6ee10b77fd08 '),
291
+ [UUID('4d629a50-0f15-11ef-8d89-e666703872d0 '),
292
292
{'times': 1, 'action': 'sit', 'animal': 'fox'},
293
293
'the brown fox',
294
294
array([1. , 1.3], dtype=float32),
@@ -303,7 +303,7 @@ could use greater than and less than conditions on numeric values.
303
303
vec.search([1.0 , 9.0 ], limit = 2 , predicates = client.Predicates(" times" , " >" , 1 ))
304
304
```
305
305
306
- [[UUID('7487af96-84c1-11ee-98da-6ee10b77fd08 '),
306
+ [[UUID('4d629b54-0f15-11ef-8d89-e666703872d0 '),
307
307
{'times': 100, 'action': 'jump', 'animal': 'fox'},
308
308
'jumped over the',
309
309
array([ 1. , 10.8], dtype=float32),
@@ -327,7 +327,7 @@ use the right type. Supported Python types are: `str`, `int`, and
327
327
vec.search([1.0 , 9.0 ], limit = 2 , predicates = client.Predicates(" action" , " ==" , " jump" ))
328
328
```
329
329
330
- [[UUID('7487af96-84c1-11ee-98da-6ee10b77fd08 '),
330
+ [[UUID('4d629b54-0f15-11ef-8d89-e666703872d0 '),
331
331
{'times': 100, 'action': 'jump', 'animal': 'fox'},
332
332
'jumped over the',
333
333
array([ 1. , 10.8], dtype=float32),
@@ -341,7 +341,7 @@ combining using OR semantic). So you can do:
341
341
vec.search([1.0 , 9.0 ], limit = 2 , predicates = client.Predicates(" action" , " ==" , " jump" ) & client.Predicates(" times" , " >" , 1 ))
342
342
```
343
343
344
- [[UUID('7487af96-84c1-11ee-98da-6ee10b77fd08 '),
344
+ [[UUID('4d629b54-0f15-11ef-8d89-e666703872d0 '),
345
345
{'times': 100, 'action': 'jump', 'animal': 'fox'},
346
346
'jumped over the',
347
347
array([ 1. , 10.8], dtype=float32),
@@ -364,7 +364,7 @@ my_predicates = client.Predicates("action", "==", "jump") & (client.Predicates("
364
364
vec.search([1.0 , 9.0 ], limit = 2 , predicates = my_predicates)
365
365
```
366
366
367
- [[UUID('7487af96-84c1-11ee-98da-6ee10b77fd08 '),
367
+ [[UUID('4d629b54-0f15-11ef-8d89-e666703872d0 '),
368
368
{'times': 100, 'action': 'jump', 'animal': 'fox'},
369
369
'jumped over the',
370
370
array([ 1. , 10.8], dtype=float32),
@@ -378,7 +378,7 @@ semantics. You can pass in multiple 3-tuples to
378
378
vec.search([1.0 , 9.0 ], limit = 2 , predicates = client.Predicates((" action" , " ==" , " jump" ), (" times" , " >" , 10 )))
379
379
```
380
380
381
- [[UUID('7487af96-84c1-11ee-98da-6ee10b77fd08 '),
381
+ [[UUID('4d629b54-0f15-11ef-8d89-e666703872d0 '),
382
382
{'times': 100, 'action': 'jump', 'animal': 'fox'},
383
383
'jumped over the',
384
384
array([ 1. , 10.8], dtype=float32),
@@ -410,7 +410,7 @@ Then, you can filter using the timestamps by specifing a
410
410
tpvec.search([1.0 , 9.0 ], limit = 4 , uuid_time_filter = client.UUIDTimeRange(specific_datetime, specific_datetime+ timedelta(days = 1 )))
411
411
```
412
412
413
- [[UUID('33c52800-ef15 -11e7-be03-4f1f9a1bde5a '),
413
+ [[UUID('95899000-ef1d -11e7-990e-7d2f7e013038 '),
414
414
{'times': 1, 'action': 'sit', 'animal': 'fox'},
415
415
'the brown fox',
416
416
array([1. , 1.3], dtype=float32),
@@ -426,12 +426,12 @@ unconstrained.
426
426
tpvec.search([1.0 , 9.0 ], limit = 4 , uuid_time_filter = client.UUIDTimeRange(start_date = specific_datetime))
427
427
```
428
428
429
- [[UUID('ac8be800-0de6 -11e9-889a-5eec84ba8a7b '),
429
+ [[UUID('0e505000-0def -11e9-8732-a154fea6fb50 '),
430
430
{'times': 100, 'action': 'jump', 'animal': 'fox'},
431
431
'jumped over the',
432
432
array([ 1. , 10.8], dtype=float32),
433
433
0.00016793422934946456],
434
- [UUID('33c52800-ef15 -11e7-be03-4f1f9a1bde5a '),
434
+ [UUID('95899000-ef1d -11e7-990e-7d2f7e013038 '),
435
435
{'times': 1, 'action': 'sit', 'animal': 'fox'},
436
436
'the brown fox',
437
437
array([1. , 1.3], dtype=float32),
@@ -448,7 +448,7 @@ One example:
448
448
tpvec.search([1.0 , 9.0 ], limit = 4 , uuid_time_filter = client.UUIDTimeRange(start_date = specific_datetime, start_inclusive = False ))
449
449
```
450
450
451
- [[UUID('ac8be800-0de6 -11e9-889a-5eec84ba8a7b '),
451
+ [[UUID('0e505000-0def -11e9-8732-a154fea6fb50 '),
452
452
{'times': 100, 'action': 'jump', 'animal': 'fox'},
453
453
'jumped over the',
454
454
array([ 1. , 10.8], dtype=float32),
@@ -470,7 +470,7 @@ filters and `__uuid_timestamp` for predicates. Some examples below:
470
470
tpvec.search([1.0 , 9.0 ], limit = 4 , filter = { " __start_date" : specific_datetime, " __end_date" : specific_datetime+ timedelta(days = 1 )})
471
471
```
472
472
473
- [[UUID('33c52800-ef15 -11e7-be03-4f1f9a1bde5a '),
473
+ [[UUID('95899000-ef1d -11e7-990e-7d2f7e013038 '),
474
474
{'times': 1, 'action': 'sit', 'animal': 'fox'},
475
475
'the brown fox',
476
476
array([1. , 1.3], dtype=float32),
@@ -481,7 +481,7 @@ tpvec.search([1.0, 9.0], limit=4,
481
481
predicates = client.Predicates(" __uuid_timestamp" , " >" , specific_datetime) & client.Predicates(" __uuid_timestamp" , " <" , specific_datetime+ timedelta(days = 1 )))
482
482
```
483
483
484
- [[UUID('33c52800-ef15 -11e7-be03-4f1f9a1bde5a '),
484
+ [[UUID('95899000-ef1d -11e7-990e-7d2f7e013038 '),
485
485
{'times': 1, 'action': 'sit', 'animal': 'fox'},
486
486
'the brown fox',
487
487
array([1. , 1.3], dtype=float32),
@@ -850,7 +850,7 @@ import psycopg2
850
850
from langchain.docstore.document import Document
851
851
from langchain.text_splitter import CharacterTextSplitter
852
852
from timescale_vector import client, pgvectorizer
853
- from langchain.embeddings.openai import OpenAIEmbeddings
853
+ from langchain_openai import OpenAIEmbeddings
854
854
from langchain.vectorstores.timescalevector import TimescaleVector
855
855
from datetime import timedelta
856
856
```
@@ -963,8 +963,8 @@ res = vector_store.similarity_search_with_score("Blogs about cats")
963
963
res
964
964
```
965
965
966
- [(Document(page_content='Author Matvey Arye, title: First Post, contents:some super interesting content about cats.', metadata={'id': '4a784000-4bc4-11eb-855a-06302dbc8ce7 ', 'author': 'Matvey Arye', 'blog_id': 1, 'category': 'AI', 'published_time': '2021-01-01T00:00:00+00:00'}),
967
- 0.12595687795193833 )]
966
+ [(Document(page_content='Author Matvey Arye, title: First Post, contents:some super interesting content about cats.', metadata={'id': '4a784000-4bc4-11eb-979c-e8748f6439f2 ', 'author': 'Matvey Arye', 'blog_id': 1, 'category': 'AI', 'published_time': '2021-01-01T00:00:00+00:00'}),
967
+ 0.12657619616729976 )]
968
968
969
969
## Development
970
970
0 commit comments