Send empty vector index type on new Weavaite versions#2042
Conversation
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
There was a problem hiding this comment.
Pull request overview
This PR updates collection schema creation so that for newer Weaviate servers (>= 1.37.4) the client can omit vectorIndexType in (named) vector configs, letting the server apply its own default vector index type, while preserving the existing HNSW default behavior for older servers.
Changes:
- Add server-version-gated behavior in
CollectionsExecutor.create()to decide whether to emit the client-side defaultvectorIndexType. - Thread a new
emit_default_vector_index_typeoption through_CollectionConfigCreate._to_dict()and into named/default vector config_to_dict()implementations. - Conditionally omit
vectorIndexTypewhen no explicit vector index config is provided and the flag is disabled.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| weaviate/collections/collections/executor.py | Computes the version-gated flag and passes it into config serialization during collection creation. |
| weaviate/collections/classes/config.py | Adds flag plumbing to collection config serialization and conditionally emits top-level default vectorIndexType. |
| weaviate/collections/classes/config_vectors.py | Allows omitting vectorIndexType for (default) vector configs when no explicit index config is set. |
| weaviate/collections/classes/config_named_vectors.py | Allows omitting vectorIndexType for named vector configs when no explicit index config is set. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return_dict["moduleConfig"][addition_key] = addition_val | ||
|
|
||
| def _to_dict(self) -> Dict[str, Any]: | ||
| def _to_dict(self, *, emit_default_vector_index_type: bool = True) -> Dict[str, Any]: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2042 +/- ##
==========================================
- Coverage 87.95% 86.76% -1.20%
==========================================
Files 280 299 +19
Lines 21664 22931 +1267
==========================================
+ Hits 19054 19895 +841
- Misses 2610 3036 +426 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
No description provided.