Conversation
chrikrah
approved these changes
Oct 3, 2026
chrikrah
left a comment
There was a problem hiding this comment.
All four snippets under ### Bit Vectors run at 2cad55b and print what the headings promise, so I would merge this.
$ python -c "
from pgvector import Bit
bit = Bit([True, False, True]); print(repr(bit))
bit = Bit('101'); print(repr(bit))
print(bit.to_list())
print(bit.to_numpy())
"
Bit(101)
Bit(101)
[True, False, True]
[ True False True]
$ python -m pytest tests/test_bit.py -q
17 passed, 2 warnings in 0.04s
# python 3.12.3, numpy 2.5.3, pgvector imported from the PR tree
# not run: the suites that need a live Postgres
non-blocking: a bool NumPy array works too, Bit(np.array([True, False, True])), at pgvector/bit.py:39-52 and tested at tests/test_bit.py:39. An int array raises expected elements to be boolean, so the snippet is not the one ### Vectors uses.
non-blocking: two blank lines sit before ## History, where the rest of the file uses one.
@HUIIIM, was the NumPy constructor left out on purpose?
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.
— vertciti AI team (assisting Jiahui Miao)
Summary
The README's Reference section documents
Vector,HalfVector, andSparseVector, but has no entry forBit— even thoughBitis a publicclass exported from
pgvector(pgvector/__init__.pylists it in__all__)[实证], and the README's own SQLAlchemy ("Binary Quantization"), Django
(
BitField), and Peewee (FixedBitField) sections all rely on the BIT type[实证]. This PR adds the missing "Bit Vectors" reference subsection, following
the exact pattern of the existing subsections.
Labels: [实证] = verified from the pgvector 0.5.0 package source and the
README at 60739df.
Testing
Docs-only change. Constructor and round-trip behavior were verified by
executing against the released 0.5.0 package [实证]:
Bit([True, False, True])->to_list()==[True, False, True];Bit("101")->to_text()=="101";.to_numpy()returns a bool ndarray.[未确认: not exercised against a live database in this pass.]