Refactor according to Vectorize V2 spec#660
Refactor according to Vectorize V2 spec#660garvit-gupta wants to merge 2 commits intocloudflare:mainfrom
Conversation
worker-sys/src/types/vectorize.rs
Outdated
| #[wasm_bindgen(method, catch)] | ||
| pub fn query( | ||
| this: &VectorizeIndex, | ||
| vector: &[f32], |
There was a problem hiding this comment.
I think we should make this JsValue since according to the generated types it accepts a number array or a Float32Array/Float64Array.
There was a problem hiding this comment.
I am using wasm for the first time, so I would defer to your guidance on the appropriate type. I have changed the vector type to JsValue, but I wanted to enquire if there is any specific handling needed to ensure that it is processed as Float32Array | Float64Array?
worker/src/vectorize.rs
Outdated
| /// Use the provided vector to perform a similarity search across the index. | ||
| pub async fn query( | ||
| &self, | ||
| vector: &[f32], |
There was a problem hiding this comment.
nit: it'd be nice to just use impl AsRef<[f32]>. Also does Vectorize support 64-bit floating point internally? There JS api supports 64 bit floats with Float64Array.
There was a problem hiding this comment.
How would this work if the type is JsValue?
ca41a86 to
835f243
Compare
|
This needs further review and work ASAP as the spec of Workers-RS is lagging behind Workers |
Hey @danzlarkin. What can I do to get this task completed? I had been hoping for some more guidance to get this merged, but had to park this and switch to tasks with a higher priority. |
|
|
@zebp, please review this asap? If you're not willing to merge let me know what the problem is so I can get the repo ready for merge |
Update the Vectorize interface according to the V2 schema.
This PR is built on top of @kflansburg's PR: #609, but includes the changes needed for the V2 spec.
For details about Vectorize, refer to https://developers.cloudflare.com/vectorize/.
API Reference: https://developers.cloudflare.com/api/operations/vectorize-list-vectorize-indexes