-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor according to Vectorize V2 spec #660
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would this work if the type is JsValue?
ca41a86
to
835f243
Compare
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