@@ -32,27 +32,18 @@ pub enum VectorizeIndexConfig {
32
32
#[ derive( Debug , Deserialize ) ]
33
33
#[ serde( rename_all = "camelCase" ) ]
34
34
/// Metadata about an existing index.
35
- ///
36
- /// This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
37
35
pub struct VectorizeIndexDetails {
38
- pub id : String ,
39
36
pub name : String ,
40
37
pub description : Option < String > ,
41
38
pub config : VectorizeIndexConfig ,
42
- pub vectors_count : u64 ,
43
39
}
44
40
45
41
#[ derive( Debug , Deserialize ) ]
46
42
#[ serde( rename_all = "camelCase" ) ]
47
43
/// Results of an operation that performed a mutation on a set of vectors.
48
- /// Here, `ids` is a list of vectors that were successfully processed.
49
- ///
50
- /// This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
51
- pub struct VectorizeVectorMutation {
52
- /// List of ids of vectors that were successfully processed.
53
- pub ids : Vec < String > ,
54
- /// Total count of the number of processed vectors.
55
- pub count : u64 ,
44
+ pub struct VectorizeVectorAsyncMutation {
45
+ /// The unique identifier for the async mutation operation containing the changeset.
46
+ pub mutation_id : String ,
56
47
}
57
48
58
49
#[ derive( Debug , Serialize ) ]
@@ -90,7 +81,7 @@ impl<'a> VectorizeVector<'a> {
90
81
}
91
82
}
92
83
93
- #[ derive( Debug , Serialize ) ]
84
+ #[ derive( Debug , Default , Serialize ) ]
94
85
#[ serde( rename_all = "kebab-case" ) ]
95
86
/// Metadata return levels for a Vectorize query.
96
87
pub enum VectorizeMetadataRetrievalLevel {
@@ -99,6 +90,7 @@ pub enum VectorizeMetadataRetrievalLevel {
99
90
/// Return all metadata fields configured for indexing in the vector return set. This level of retrieval is "free" in that no additional overhead is incurred returning this data. However, note that indexed metadata is subject to truncation (especially for larger strings).
100
91
Indexed ,
101
92
/// No indexed metadata will be returned.
93
+ #[ default]
102
94
None ,
103
95
}
104
96
@@ -120,13 +112,14 @@ type VectorizeVectorMetadataFilter =
120
112
#[ derive( Debug , Serialize ) ]
121
113
#[ serde( rename_all = "camelCase" ) ]
122
114
pub struct VectorizeQueryOptions {
123
- // Default 3 , max 20
115
+ // Default 5 , max 100
124
116
top_k : u8 ,
117
+ /// Return vectors from the specified namespace. Default `none`.
125
118
namespace : Option < String > ,
126
119
/// Return vector values. Default `false`.
127
120
return_values : bool ,
128
- /// Return vector metadata. Default `false `.
129
- return_metadata : bool ,
121
+ /// Return vector metadata. Default `None `.
122
+ return_metadata : VectorizeMetadataRetrievalLevel ,
130
123
/// Default `none`.
131
124
filter : Option < VectorizeVectorMetadataFilter > ,
132
125
}
@@ -151,7 +144,10 @@ impl VectorizeQueryOptions {
151
144
self
152
145
}
153
146
154
- pub fn with_return_metadata ( mut self , return_metadata : bool ) -> Self {
147
+ pub fn with_return_metadata (
148
+ mut self ,
149
+ return_metadata : VectorizeMetadataRetrievalLevel ,
150
+ ) -> Self {
155
151
self . return_metadata = return_metadata;
156
152
self
157
153
}
@@ -173,10 +169,10 @@ impl VectorizeQueryOptions {
173
169
impl Default for VectorizeQueryOptions {
174
170
fn default ( ) -> Self {
175
171
Self {
176
- top_k : 3 ,
172
+ top_k : 5 ,
177
173
namespace : None ,
178
174
return_values : false ,
179
- return_metadata : false ,
175
+ return_metadata : VectorizeMetadataRetrievalLevel :: None ,
180
176
filter : None ,
181
177
}
182
178
}
@@ -191,6 +187,8 @@ pub struct VectorizeVectorResult {
191
187
pub values : Option < Vec < f32 > > ,
192
188
/// Metadata associated with the vector. Includes the values of other fields and potentially additional details.
193
189
pub metadata : Option < serde_json:: Map < String , serde_json:: Value > > ,
190
+ /** The namespace the vector belongs to. */
191
+ pub namespace : Option < String > ,
194
192
}
195
193
196
194
#[ derive( Debug , Deserialize ) ]
@@ -209,8 +207,6 @@ pub struct VectorizeMatches {
209
207
}
210
208
211
209
/// A Vectorize Vector Search Index for querying vectors/embeddings.
212
- ///
213
- /// This type is exclusively for the Vectorize **beta** and will be deprecated once Vectorize RC is released.
214
210
pub struct VectorizeIndex ( VectorizeIndexSys ) ;
215
211
216
212
unsafe impl Send for VectorizeIndex { }
@@ -233,7 +229,7 @@ impl VectorizeIndex {
233
229
pub async fn insert < ' a > (
234
230
& self ,
235
231
vectors : & [ VectorizeVector < ' a > ] ,
236
- ) -> Result < VectorizeVectorMutation > {
232
+ ) -> Result < VectorizeVectorAsyncMutation > {
237
233
let promise = self
238
234
. 0
239
235
. insert ( serde_wasm_bindgen:: to_value ( & vectors) ?. into ( ) ) ?;
@@ -246,7 +242,7 @@ impl VectorizeIndex {
246
242
pub async fn upsert < ' a > (
247
243
& self ,
248
244
vectors : & [ VectorizeVector < ' a > ] ,
249
- ) -> Result < VectorizeVectorMutation > {
245
+ ) -> Result < VectorizeVectorAsyncMutation > {
250
246
let promise = self
251
247
. 0
252
248
. upsert ( serde_wasm_bindgen:: to_value ( & vectors) ?. into ( ) ) ?;
@@ -269,7 +265,7 @@ impl VectorizeIndex {
269
265
}
270
266
271
267
/// Delete a list of vectors with a matching id.
272
- pub async fn delete_by_ids < ' a , T > ( & self , ids : T ) -> Result < VectorizeVectorMutation >
268
+ pub async fn delete_by_ids < ' a , T > ( & self , ids : T ) -> Result < VectorizeVectorAsyncMutation >
273
269
where
274
270
T : IntoIterator < Item = & ' a str > ,
275
271
{
0 commit comments