Repository navigation
Decode embeddings returned by pgvector Python 0.5 - #1752
Merged
serengil merged 1 commit intoNov 16, 2026
Merged
Conversation
serengil
approved these changes
Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tickets
Self-contained pgvector driver compatibility fix.
What has been done
pgvector Python 0.5 changed Psycopg's decoded
vectorvalue from a NumPy array to aVectorobject. That object is not iterable, so the existinglist(value)calls raiseTypeError: 'Vector' object is not iterable. This breaks single-identity reads, full-gallery reads, exact searches, and identification with the current driver.Use the driver's
to_list()method when available and retain the existing conversion for older array-returning drivers. The production change is two return-value conversions.The driver change is recorded in pgvector Python's 0.5.0 changelog.
How to test
Validation run, using real PostgreSQL 16.16, pgvector extension 0.8.7, and Psycopg 3.3.9:
The tests read actual database values through both decoder generations, verify single-row and streamed batch results, exercise public exact search and identification, and preserve missing-identity, empty-gallery, and native ANN-search behavior. Recognition is replaced at the embedding boundary; database reads, decoded values, and distance calculations are real.