mirror of
https://github.com/langchain-ai/langchain-postgres.git
synced 2026-07-16 09:54:28 -04:00
[PR #226] feat: support for Halfvec and Sparsevec vector types #251
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/langchain-ai/langchain-postgres/pull/226
Author: @nazarpechka
Created: 6/26/2025
Status: 🔄 Open
Base:
main← Head:support_halfvec_sparsevec📝 Commits (4)
b70add0feat: support for HALFVEC and SPARSEVEC vector typesb2d91f5revert uv.lock changed77b076check if vector type is SPARSEVEC in IVFFlatIndex81a2fb8formatting📊 Changes
6 files changed (+160 additions, -14 deletions)
View changed files
📝
langchain_postgres/v2/async_vectorstore.py(+2 -2)📝
langchain_postgres/v2/engine.py(+15 -1)📝
langchain_postgres/v2/indexes.py(+34 -6)📝
tests/unit_tests/v2/test_async_pg_vectorstore_index.py(+29 -2)📝
tests/unit_tests/v2/test_engine.py(+39 -0)📝
tests/unit_tests/v2/test_indexes.py(+41 -3)📄 Description
This PR adds full support for pgvector’s Halfvec and Sparsevec vector types in both table and index creation.
This adresses the 2 000-dimension limit of the standard vector type, not enough for models like text-embedding-3-large.
halfvecstores embeddings as INT8 quantized values and supports indexing up to 16 000 dimensions.sparsevecstores sparse embeddings and also supports up to 16 000 dimensions.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.