Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds an initial Python client for VortexDB, providing a Pythonic wrapper around the VortexDB gRPC API. The client enables users to insert, retrieve, search, and delete vector embeddings with associated payloads through a clean, typed interface.
Changes:
- Added a complete Python client package with models, connection handling, configuration management, and error handling
- Included comprehensive test coverage using pytest for all major components
- Provided usage examples and detailed documentation in README.md
Reviewed changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 18 comments.
Show a summary per file
| File | Description |
|---|---|
| client/python/vortexdb/models.py | Defines core data models (DenseVector, Payload, Point) with validation and protobuf conversion |
| client/python/vortexdb/grpc/vector_db_pb2.py | Auto-generated protobuf message definitions |
| client/python/vortexdb/grpc/vector_db_pb2_grpc.py | Auto-generated gRPC stub for VectorDB service |
| client/python/vortexdb/grpc/init.py | Empty init file for grpc subpackage |
| client/python/vortexdb/exceptions.py | Custom exception classes for error handling |
| client/python/vortexdb/connection.py | gRPC connection wrapper with error mapping |
| client/python/vortexdb/config.py | Configuration management with environment variable support |
| client/python/vortexdb/client.py | Main VortexDB client class with CRUD operations |
| client/python/vortexdb/init.py | Package exports and public API surface |
| client/python/tests/test_models.py | Unit tests for model classes |
| client/python/tests/test_connection.py | Unit tests for gRPC connection layer |
| client/python/tests/test_config.py | Unit tests for configuration loading |
| client/python/tests/test_client.py | Unit tests for client API methods |
| client/python/pyproject.toml | Package metadata and dependencies |
| client/python/proto/vector-db.proto | Protobuf schema definition |
| client/python/examples/context_manager_usage.py | Example showing context manager usage pattern |
| client/python/examples/basic_usage.py | Example demonstrating basic client operations |
| client/python/README.md | Comprehensive documentation for the Python client |
| .gitignore | Added Python-specific ignore patterns |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| raise TypeError( | ||
| "vector must be a DenseVector. " | ||
| "Use: DenseVector([1.0, 2.0, 3.0])" | ||
| ) |
There was a problem hiding this comment.
The insert method validates that vector is a DenseVector but does not validate that payload is a Payload instance. For API consistency and better error messages, add a similar isinstance check for the payload parameter.
| ) | |
| ) | |
| if not isinstance(payload, Payload): | |
| raise TypeError( | |
| "payload must be a Payload. " | |
| "Use: Payload({...})" | |
| ) |
| "vector must be a DenseVector. " | ||
| "Use: DenseVector([1.0, 2.0, 3.0])" | ||
| ) | ||
|
|
There was a problem hiding this comment.
The search method does not validate that similarity is a Similarity enum instance. For consistency with the vector validation and better error messages, consider adding an isinstance check for the similarity parameter.
| if not isinstance(similarity, Similarity): | |
| raise TypeError( | |
| "similarity must be a Similarity enum instance." | |
| ) |
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
This comment has extra blank lines at the end (lines 73-74). Remove the trailing blank lines for cleaner code formatting.
| api_key: str | None = None, | ||
| timeout: float | None = None, | ||
| ): | ||
| # Config order followed - args -> env vars -> defaults |
There was a problem hiding this comment.
The indentation for the comment is inconsistent with standard Python formatting. The comment should be indented at the same level as the code block it precedes, not aligned with the method definition.
| # Config order followed - args -> env vars -> defaults | |
| # Config order followed - args -> env vars -> defaults |
|
|
||
| self._conn = GRPCConnection(self._config) | ||
|
|
||
| # The basic operations |
There was a problem hiding this comment.
The comment should be part of the class docstring or removed, as it's not formatted as a proper Python comment block. Standard convention is to use a docstring immediately after the class definition or keep comments aligned with code blocks.
| # The basic operations | |
| # The basic operations |
| def search( | ||
| self, | ||
| *, | ||
| vector: DenseVector, | ||
| similarity: Similarity, | ||
| limit: int, |
There was a problem hiding this comment.
The search method does not validate that the limit parameter is positive. A negative or zero limit value could cause unexpected behavior or errors. Consider adding validation to ensure limit is a positive integer before making the gRPC call.
| from vortexdb.client import VortexDB | ||
| from vortexdb.connection import GRPCConnection | ||
| from vortexdb.models import DenseVector, Payload, Similarity, ContentType, Point | ||
| from vortexdb.exceptions import InvalidArgumentError |
There was a problem hiding this comment.
Import of 'InvalidArgumentError' is not used.
| from vortexdb.exceptions import InvalidArgumentError |
| @@ -0,0 +1,75 @@ | |||
| import os | |||
There was a problem hiding this comment.
Import of 'os' is not used.
| import os |
| _sym_db = _symbol_database.Default() | ||
|
|
||
|
|
||
| from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 |
There was a problem hiding this comment.
Import of 'google_dot_protobuf_dot_empty__pb2' is not used.
| # Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! | ||
| """Client and server classes corresponding to protobuf-defined services.""" | ||
| import grpc | ||
| import warnings |
There was a problem hiding this comment.
Import of 'warnings' is not used.
| import warnings |
No description provided.