Skip to content
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

Add codecs for ext::pgvector::halfvec+ext::pgvector::sparsevec and add SparseVector datatype #1124

Merged
merged 6 commits into from
Oct 30, 2024

Conversation

jaclarke
Copy link
Member

@jaclarke jaclarke commented Oct 29, 2024

Closes #1123

For the halfvec type, decoding to Float16Array seems like the correct thing (similar to decoding vector type tp Float32Array), but it currently seems unsupported everywhere except deno (and firefox), so I've bundled a Float16Array polyfill: https://www.npmjs.com/package/@petamoriken/float16. (For deno it uses the native implementation via the adaptor). @scotttrinh Does this seem ok? We could also make users provide their own polyfill, but since nothing supports it currently and there seems to be no types for it in ts, bundling it seems easier.

@jaclarke jaclarke marked this pull request as ready for review October 29, 2024 23:43
Copy link
Collaborator

@scotttrinh scotttrinh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🏆

@scotttrinh
Copy link
Collaborator

Does this seem ok?

Yeah, I think this is great, and we can remove it once it ever hits baseline support, but that's likely years away at this point. FWIW, the official pgvector package itself just uses a number array for both regular and sparse vectors so this is already a huge improvement over that.

@jaclarke jaclarke merged commit e433ee2 into master Oct 30, 2024
10 checks passed
@jaclarke jaclarke deleted the new-pgvector-types branch October 30, 2024 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add codecs for new pgvector types
2 participants