Skip to content
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

Add a Vector Database Service to allow stages to read and write to VDBs #1225

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5d7b3cb
Added milvus vdb prototype impl
bsuryadevara Sep 26, 2023
4807f3d
Added milvus vdb prototype impl
bsuryadevara Sep 26, 2023
b1f94fb
Added llamaindex and langchain prototypes
bsuryadevara Sep 27, 2023
d912645
doc updates
bsuryadevara Sep 27, 2023
4ecd37f
updates to milvus vd service
bsuryadevara Sep 30, 2023
c18125a
updated search and upsert functions
bsuryadevara Oct 2, 2023
a6ef60e
Added write_to_vector_db stage
bsuryadevara Oct 3, 2023
7389542
Added tests to get started
bsuryadevara Oct 3, 2023
3a31cee
Added tests to get started
bsuryadevara Oct 3, 2023
4cfba55
Added MilvusClient extension class to support missing functions
bsuryadevara Oct 4, 2023
b83f517
Added tests for Milvus vector database serivce
bsuryadevara Oct 4, 2023
b7fee57
Added tests for Milvus vector database service
bsuryadevara Oct 4, 2023
cde18b2
Added tests for Milvus vector database service
bsuryadevara Oct 4, 2023
c9316c0
Added milvus lite to pipeline tests
bsuryadevara Oct 9, 2023
36f1f18
Added tests with milvus lite
bsuryadevara Oct 11, 2023
2f24cc2
Updated Milvus VDB tests
bsuryadevara Oct 11, 2023
9670c97
Merge remote-tracking branch 'upstream/branch-23.11' into 1177-fea-ad…
bsuryadevara Oct 11, 2023
e4b8a02
Updated Milvus VDB tests
bsuryadevara Oct 11, 2023
a5e742e
Added tests with milvus lite
bsuryadevara Oct 11, 2023
3d0e01b
Renamed a file
bsuryadevara Oct 11, 2023
cd52a5f
Feedback changes
bsuryadevara Oct 12, 2023
5ce3402
Feedback changes
bsuryadevara Oct 12, 2023
9e6989a
Removed register stage decorator
bsuryadevara Oct 12, 2023
cf327b5
Ignore pymilvus in the docs
bsuryadevara Oct 13, 2023
a6a6f43
Update variable names
bsuryadevara Oct 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added tests with milvus lite
  • Loading branch information
bsuryadevara committed Oct 11, 2023
commit a5e742eb29fe3a79d7b3f618ab99d9edbd75b385
11 changes: 6 additions & 5 deletions morpheus/service/milvus_vector_db_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,16 @@ def create(self, name: str, overwrite: bool = False, **kwargs: dict[str, typing.
self._client.create_partition(collection_name=name, partition_name=part["name"], timeout=timeout)

@with_collection_lock
def insert(self, name: str, data: typing.Any, **kwargs: dict[str, typing.Any]) -> dict:
def insert(self, name: str, data: typing.Union[list[list], list[dict], dict], **kwargs: dict[str,
typing.Any]) -> dict:
"""
Insert a collection specific data in the Milvus vector database.

Parameters
----------
name : str
Name of the collection to be inserted.
data : typing.Any
data : typing.Union[list[list], list[dict], dict]
bsuryadevara marked this conversation as resolved.
Show resolved Hide resolved
Data to be inserted in the collection.
**kwargs : dict[str, typing.Any]
Additional keyword arguments containing collection configuration.
Expand Down Expand Up @@ -436,7 +437,7 @@ def delete_by_keys(self, name: str, keys: typing.Union[int, str, list], **kwargs
----------
name : str
Name of the resource.
keys : typing.Any
keys : typing.Union[int, str, list]
Primary keys to delete vectors.
**kwargs : dict[str, typing.Any]
Extra keyword arguments specific to the vector database implementation.
Expand All @@ -452,15 +453,15 @@ def delete_by_keys(self, name: str, keys: typing.Union[int, str, list], **kwargs
return response

@with_collection_lock
def delete(self, name: str, expr: str, **kwargs: dict[str, typing.Any]) -> typing.Any:
def delete(self, name: str, expr: typing.Union[str, dict], **kwargs: dict[str, typing.Any]) -> typing.Any:
"""
Delete vectors from the resource using expressions.

Parameters
----------
name : str
Name of the resource.
expr : str
expr : typing.Union[str, dict]
Delete expression.
**kwargs : dict[str, typing.Any]
Extra keyword arguments specific to the vector database implementation.
Expand Down
17 changes: 10 additions & 7 deletions morpheus/service/vector_db_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,16 @@ class VectorDBService(ABC):
"""

@abstractmethod
def insert(self, name: str, data: typing.Any, **kwargs: dict[str, typing.Any]) -> dict:
def insert(self, name: str, data: typing.Union[list[list], list[dict], dict], **kwargs: dict[str,
typing.Any]) -> dict:
"""
Insert data into the vector database.

Parameters
----------
name : str
Name of the resource.
data : typing.Any
data : typing.Union[list[list], list[dict], dict]
Data to be inserted into the resource.
**kwargs : dict[str, typing.Any]
Extra keyword arguments specific to the vector database implementation.
Expand Down Expand Up @@ -140,13 +141,13 @@ def update(self, name: str, data: typing.Any, **kwargs: dict[str, typing.Any]) -
pass

@abstractmethod
def delete(self, name: str, expr: typing.Any, **kwargs: dict[str, typing.Any]) -> None:
def delete(self, name: str, expr: typing.Union[str, dict], **kwargs: dict[str, typing.Any]) -> None:
"""
Delete data in the vector database.

Parameters
----------
name : str
name : typing.Union[str, dict]
Name of the resource.
expr : typing.Any
E.
Expand Down Expand Up @@ -257,7 +258,8 @@ def transform(self, data: typing.Any, **kwargs: dict[str, typing.Any]) -> typing
return data

@abstractmethod
def retrieve_by_keys(self, name: str, keys: typing.Any, **kwargs: dict[str, typing.Any]) -> typing.Any:
def retrieve_by_keys(self, name: str, keys: typing.Union[int, str, list], **kwargs: dict[str,
typing.Any]) -> typing.Any:
"""
Retrieve the inserted vectors using keys from the resource.

Expand All @@ -278,15 +280,16 @@ def retrieve_by_keys(self, name: str, keys: typing.Any, **kwargs: dict[str, typi
pass

@abstractmethod
def delete_by_keys(self, name: str, keys: typing.Any, **kwargs: dict[str, typing.Any]) -> typing.Any:
def delete_by_keys(self, name: str, keys: typing.Union[int, str, list], **kwargs: dict[str,
typing.Any]) -> typing.Any:
"""
Delete vectors by keys from the resource.

Parameters
----------
name : str
Name of the resource.
keys : typing.Any
keys : typing.Union[int, str, list]
Primary keys to delete vectors.
**kwargs : dict[str, typing.Any]
Extra keyword arguments specific to the vector database implementation.
Expand Down
Loading