feat: add vchordrq vector index support for PostgreSQL#2378
feat: add vchordrq vector index support for PostgreSQL#2378danielaskdd merged 2 commits intoHKUDS:mainfrom
Conversation
…or index creation logic
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
lightrag/kg/postgres_impl.py
Outdated
| async def configure_vchordrq(self, connection: asyncpg.Connection) -> None: | ||
| """Configure VCHORDRQ extension for vector similarity search.""" | ||
| try: | ||
| await connection.execute(f"SET vchordrq.probes TO '{self.vchordrq_probes}'") | ||
| await connection.execute(f"SET vchordrq.epsilon TO {self.vchordrq_epsilon}") | ||
| except Exception: |
There was a problem hiding this comment.
Allow epsilon to be configured when probes unset
The new configure_vchordrq wraps both SET statements in a single try and always tries to execute SET vchordrq.probes TO '' when POSTGRES_VCHORDRQ_PROBES is left empty (which is the default in both env.example and config.ini.example). That command fails with invalid value for parameter "vchordrq.probes", the exception is swallowed, and the method exits before the second SET runs, so vchordrq.epsilon (which defaults to 1.9 in the config) is never applied unless the user also supplies a valid probes value. This makes the documented epsilon setting impossible to use in the default configuration. Please skip issuing the probes SET when no value is provided or handle the two SETs independently so that a missing probes value does not block vchordrq.epsilon from being configured.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Empty string is actually accepted for 'vchordrq.probes', so the 'SET' statement itself shouldn’t fail. However, to make this more robust across environments, we could either wrap each 'SET' in its own try block or let exceptions propagate instead of swallowing them
There was a problem hiding this comment.
This method should not catch exceptions. Configuration errors should fail-fast, while transient connection errors will be retried by _run_with_retry.
|
This PR has been merged with the updated configure_vchordrq. Please pull the latest code and verify that it functions as expected: |
Description
This PR refactors the vector index handling in
postgres_impland adds support for a new index type, vchordrqRelated Issues
#2377
Changes Made
postgres_impl.pyby merging_create_hnsw_vector_indexesand_create_ivfflat_vector_indexesinto a single_create_vector_indexesmethod.vchordrq_build_options,vchordrq_probes, andvchordrq_epsilon.env.exampleand config.ini.example to include the new VCHORDRQ-related settings and reflect the unified index creation workflow.Checklist
Additional Notes