-
Notifications
You must be signed in to change notification settings - Fork 257
feat: psycopg 3.1.0 update #597
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
Conversation
features: updated pyproject dependency group added close and check function to postgresindex class updated old code to be compatible with latest release of psycopg added support for different index types such as flat and ivfflat added rollbacks to prevent errors from previous attempts to make sql commands
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #597 +/- ##
==========================================
+ Coverage 74.25% 75.88% +1.62%
==========================================
Files 48 48
Lines 4374 4520 +146
==========================================
+ Hits 3248 3430 +182
+ Misses 1126 1090 -36 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
bugbot run verbose=true |
bugbot is starting with request id serverGenReqId_a0d0cc0a-67b2-4f69-a488-f04ffa22bea6 |
bugbot run |
bugbot run |
…s/semantic-router into josh/postgres/psycopg-update merge
bugbot run |
…s/semantic-router into josh/postgres/psycopg-update merge
…s/semantic-router into josh/postgres/psycopg-update merge
…elio-labs/semantic-router into josh/postgres/psycopg-update
…elio-labs/semantic-router into josh/postgres/psycopg-update
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.
Bug: PostgresIndex Initialization Requires Manual Call
The PostgresIndex
no longer automatically creates its database table and indexes. The setup_index()
call was removed from its constructor, and the new _init_index()
method is not automatically invoked by the PostgresIndex
constructor or the Router
's _init_index_state()
method. This breaks backward compatibility, requiring users to manually call _init_index()
and provide dimensions
when initializing PostgresIndex
instances.
semantic_router/routers/base.py#L470-L478
semantic-router/semantic_router/routers/base.py
Lines 470 to 478 in fe68a10
self, sparse_encoder: Optional[SparseEncoder] | |
) -> Optional[SparseEncoder]: | |
"""Get the sparse encoder to be used for creating sparse vector embeddings. | |
:param sparse_encoder: The sparse encoder to use. | |
:type sparse_encoder: Optional[SparseEncoder] | |
:return: The sparse encoder to use. | |
:rtype: Optional[SparseEncoder] | |
""" |
semantic_router/index/postgres.py#L177-L181
semantic-router/semantic_router/index/postgres.py
Lines 177 to 181 in fe68a10
self.namespace = namespace | |
self.conn = psycopg.connect(conninfo=self.connection_string) | |
if not self.has_connection(): | |
raise ValueError("Index has not established a connection to Postgres") | |
Was this report helpful? Give feedback by reacting with 👍 or 👎
…s/semantic-router into josh/postgres/psycopg-update merge
User description
features:
updated pyproject dependency group
added close and check function to postgresindex class updated old code to be compatible with latest release of psycopg added support for different index types such as flat and ivfflat added rollbacks to prevent errors from previous attempts to make sql commands
PR Type
Enhancement, Documentation
Description
Migrate PostgresIndex from psycopg2 to psycopg v3
Introduce IndexType enum for flat, hnsw, ivfflat
Enhance connection management and validation methods
Update dependency and add usage notebook docs
Changes walkthrough 📝
postgres.py
Migrate to psycopg v3 and index type support
semantic_router/index/postgres.py
IndexType
enum (FLAT, HNSW, IVFFLAT)index_type
has_connection
,close
,__del__
, and rollbackspostgres-sync.ipynb
Add Postgres index usage notebook
docs/indexes/postgres-sync.ipynb
pyproject.toml
Update psycopg dependency version
pyproject.toml
postgres
dependency from psycopg2 to psycopg>=3.1