@@ -78,24 +78,24 @@ Now you can query for similar items:
78
78
await vec.search([1.0 , 9.0 ])
79
79
```
80
80
81
- [<Record id=UUID('1bd6a985-a837-4742-a007-d8a785e7089f ') metadata={'action': 'jump', 'animal': 'fox'} contents='jumped over the' embedding=array([ 1. , 10.8], dtype=float32) distance=0.00016793422934946456>,
82
- <Record id=UUID('2e52b4a4-3422-42d7-8e62-fd40731e7ffa ') metadata={'animal': 'fox'} contents='the brown fox' embedding=array([1. , 1.3], dtype=float32) distance=0.14489260377438218>]
81
+ [<Record id=UUID('9b567b36-209e-4240-aa93-f8e7e74277cd ') metadata={'action': 'jump', 'animal': 'fox'} contents='jumped over the' embedding=array([ 1. , 10.8], dtype=float32) distance=0.00016793422934946456>,
82
+ <Record id=UUID('2d49fd73-3db1-4061-81f3-a4ed7529eb61 ') metadata={'animal': 'fox'} contents='the brown fox' embedding=array([1. , 1.3], dtype=float32) distance=0.14489260377438218>]
83
83
84
84
You can specify the number of records to return.
85
85
86
86
``` python
87
87
await vec.search([1.0 , 9.0 ], limit = 1 )
88
88
```
89
89
90
- [<Record id=UUID('1bd6a985-a837-4742-a007-d8a785e7089f ') metadata={'action': 'jump', 'animal': 'fox'} contents='jumped over the' embedding=array([ 1. , 10.8], dtype=float32) distance=0.00016793422934946456>]
90
+ [<Record id=UUID('9b567b36-209e-4240-aa93-f8e7e74277cd ') metadata={'action': 'jump', 'animal': 'fox'} contents='jumped over the' embedding=array([ 1. , 10.8], dtype=float32) distance=0.00016793422934946456>]
91
91
92
92
You can also specify a filter on the metadata as a simple dictionary
93
93
94
94
``` python
95
95
await vec.search([1.0 , 9.0 ], limit = 1 , filter = {" action" : " jump" })
96
96
```
97
97
98
- [<Record id=UUID('1bd6a985-a837-4742-a007-d8a785e7089f ') metadata={'action': 'jump', 'animal': 'fox'} contents='jumped over the' embedding=array([ 1. , 10.8], dtype=float32) distance=0.00016793422934946456>]
98
+ [<Record id=UUID('9b567b36-209e-4240-aa93-f8e7e74277cd ') metadata={'action': 'jump', 'animal': 'fox'} contents='jumped over the' embedding=array([ 1. , 10.8], dtype=float32) distance=0.00016793422934946456>]
99
99
100
100
You can also specify a list of filter dictionaries, where an item is
101
101
returned if it matches any dict
@@ -104,8 +104,8 @@ returned if it matches any dict
104
104
await vec.search([1.0 , 9.0 ], limit = 2 , filter = [{" action" : " jump" }, {" animal" : " fox" }])
105
105
```
106
106
107
- [<Record id=UUID('1bd6a985-a837-4742-a007-d8a785e7089f ') metadata={'action': 'jump', 'animal': 'fox'} contents='jumped over the' embedding=array([ 1. , 10.8], dtype=float32) distance=0.00016793422934946456>,
108
- <Record id=UUID('2e52b4a4-3422-42d7-8e62-fd40731e7ffa ') metadata={'animal': 'fox'} contents='the brown fox' embedding=array([1. , 1.3], dtype=float32) distance=0.14489260377438218>]
107
+ [<Record id=UUID('9b567b36-209e-4240-aa93-f8e7e74277cd ') metadata={'action': 'jump', 'animal': 'fox'} contents='jumped over the' embedding=array([ 1. , 10.8], dtype=float32) distance=0.00016793422934946456>,
108
+ <Record id=UUID('2d49fd73-3db1-4061-81f3-a4ed7529eb61 ') metadata={'animal': 'fox'} contents='the brown fox' embedding=array([1. , 1.3], dtype=float32) distance=0.14489260377438218>]
109
109
110
110
You can access the fields as follows
111
111
@@ -114,7 +114,7 @@ records = await vec.search([1.0, 9.0], limit=1, filter={"action": "jump"})
114
114
records[0 ][client.SEARCH_RESULT_ID_IDX ]
115
115
```
116
116
117
- UUID('1bd6a985-a837-4742-a007-d8a785e7089f ')
117
+ UUID('9b567b36-209e-4240-aa93-f8e7e74277cd ')
118
118
119
119
``` python
120
120
records[0 ][client.SEARCH_RESULT_METADATA_IDX ]
@@ -176,7 +176,7 @@ You can create an ivfflat index with the following command after the
176
176
table has been populated.
177
177
178
178
``` python
179
- await vec.create_ivfflat_index( )
179
+ await vec.create_embedding_index(client.IvfflatIndex() )
180
180
```
181
181
182
182
Please note it is very important to do this only after you have data in
0 commit comments