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 milvus vdb prototype impl
  • Loading branch information
bsuryadevara committed Sep 26, 2023
commit 4807f3d36ac2ad60e6c4f912b16b5660581181da
2 changes: 1 addition & 1 deletion morpheus/controllers/milvus_vector_db_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from pymilvus import utility
bsuryadevara marked this conversation as resolved.
Show resolved Hide resolved

from morpheus.controllers.vector_db_controller import VectorDBController
from morpheus.controllers.vector_db_controller import with_mutex
from morpheus.utils.vector_db_utils import with_mutex

logger = logging.getLogger(__name__)

Expand Down
1 change: 1 addition & 0 deletions morpheus/controllers/qdrant_vector_db_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from qdrant_openapi_client.qdrant_client import QdrantClient

from morpheus.controllers.vector_db_controller import VectorDatabaseController
from morpheus.utils.vector_db_utils import with_mutex


class QdrantVectorDBController(VectorDatabaseController):
Expand Down
45 changes: 2 additions & 43 deletions morpheus/controllers/vector_db_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,13 @@
from abc import abstractmethod


def with_mutex(lock_name):

def decorator(func):

def wrapper(*args, **kwargs):
with getattr(args[0], lock_name):
return func(*args, **kwargs)

return wrapper

return decorator


class VectorDBController(ABC):

_mutex = threading.Lock()
"""
Abstract class for vector document store implementation.
"""

_mutex = threading.Lock()

@abstractmethod
def insert(self, name, data, **kwargs):
"""
Expand All @@ -58,46 +45,18 @@ def drop(self):
# @abstractmethod
# def update(self, vector: list[float], vector_id: str):
# """
# Update an existing vector in the vector document store.

# Parameters:
# - vector (List[float]): The updated vector data.
# - vector_id (str): The unique identifier of the vector to update.

# Returns:
# - None

# Raises:
# - RuntimeError: If an error occurs while updating the vector.
# """
# pass

# @abstractmethod
# def get_by_name(self, name: str) -> list[float]:
# """
# Retrieve a vector from the vector document store by its ID.

# Parameters:
# - vector_id (str): The unique identifier of the vector to retrieve.

# Returns:
# - List[float]: The vector data.

# Raises:
# - RuntimeError: If an error occurs while retrieving the vector.
# """
# pass

# @abstractmethod
# def count(self) -> int:
# """
# Get the total count of vectors in the vector document store.

# Returns:
# - int: The total count of vectors.

# Raises:
# - RuntimeError: If an error occurs while counting the vectors.
# """
# pass

Expand Down
15 changes: 15 additions & 0 deletions morpheus/utils/vector_db_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,21 @@
from morpheus.controllers.vector_db_controller import VectorDBController


def with_mutex(lock_name):
"""
"""

def decorator(func):

def wrapper(*args, **kwargs):
with getattr(args[0], lock_name):
return func(*args, **kwargs)

return wrapper

return decorator


def load_handler_by_path(handler_class_path, kwargs):
"""
Dynamically loads and instantiates a handler class specified by its import path.
Expand Down
Loading