Skip to content

Commit

Permalink
update the namespace for imported vdb files
Browse files Browse the repository at this point in the history
Signed-off-by: Anuradha Karuppiah <[email protected]>
  • Loading branch information
AnuradhaKaruppiah committed Sep 10, 2024
1 parent b6a3ef9 commit 32f0881
Show file tree
Hide file tree
Showing 23 changed files with 38 additions and 37 deletions.
2 changes: 1 addition & 1 deletion examples/doca/vdb_realtime/vdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
from morpheus.stages.doca.doca_source_stage import DocaSourceStage
from morpheus.stages.general.monitor_stage import MonitorStage
from morpheus.stages.inference.triton_inference_stage import TritonInferenceStage
from morpheus.stages.output.write_to_vector_db_stage import WriteToVectorDBStage
from morpheus.stages.preprocess.deserialize_stage import DeserializeStage
from morpheus.stages.preprocess.preprocess_nlp_stage import PreprocessNLPStage
from morpheus.utils.logger import configure_logging
from morpheus_llm.stages.output.write_to_vector_db_stage import WriteToVectorDBStage


def build_milvus_service(embedding_size):
Expand Down
6 changes: 3 additions & 3 deletions examples/llm/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@
import pymilvus
from langchain.embeddings import HuggingFaceEmbeddings # pylint: disable=no-name-in-module

from morpheus.service.vdb.milvus_client import DATA_TYPE_MAP
from morpheus.service.vdb.milvus_vector_db_service import MilvusVectorDBService
from morpheus.service.vdb.utils import VectorDBServiceFactory
from morpheus_llm.llm.services.llm_service import LLMService
from morpheus_llm.llm.services.nemo_llm_service import NeMoLLMService
from morpheus_llm.llm.services.openai_chat_service import OpenAIChatService
from morpheus_llm.service.vdb.milvus_client import DATA_TYPE_MAP
from morpheus_llm.service.vdb.milvus_vector_db_service import MilvusVectorDBService
from morpheus_llm.service.vdb.utils import VectorDBServiceFactory

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion examples/llm/vdb_upload/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
from morpheus.stages.general.monitor_stage import MonitorStage
from morpheus.stages.general.trigger_stage import TriggerStage
from morpheus.stages.inference.triton_inference_stage import TritonInferenceStage
from morpheus.stages.output.write_to_vector_db_stage import WriteToVectorDBStage
from morpheus.stages.preprocess.preprocess_nlp_stage import PreprocessNLPStage
from morpheus_llm.stages.output.write_to_vector_db_stage import WriteToVectorDBStage

logger = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions examples/llm/vdb_upload/vdb_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from morpheus.config import Config
from morpheus.config import PipelineModes
from morpheus.service.vdb.milvus_client import DATA_TYPE_MAP
from morpheus_llm.service.vdb.milvus_client import DATA_TYPE_MAP

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -184,7 +184,7 @@ def is_valid_service(ctx, param, value): # pylint: disable=unused-argument
click.BadParameter
If the provided service name is not supported or invalid.
"""
from morpheus.service.vdb.utils import validate_service
from morpheus_llm.service.vdb.utils import validate_service
value = value.lower()
return validate_service(service_name=value)

Expand Down
2 changes: 1 addition & 1 deletion python/morpheus_llm/morpheus_llm/llm/nodes/rag_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
import logging
import typing

from morpheus.service.vdb.vector_db_service import VectorDBResourceService
from morpheus_llm.llm import LLMNode
from morpheus_llm.llm.nodes.llm_generate_node import LLMGenerateNode
from morpheus_llm.llm.nodes.prompt_template_node import PromptTemplateNode
from morpheus_llm.llm.nodes.retriever_node import RetrieverNode
from morpheus_llm.llm.services.llm_service import LLMClient
from morpheus_llm.service.vdb.vector_db_service import VectorDBResourceService

logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import logging
import typing

from morpheus.service.vdb.vector_db_service import VectorDBResourceService
from morpheus_llm.llm import LLMContext
from morpheus_llm.llm import LLMNodeBase
from morpheus_llm.service.vdb.vector_db_service import VectorDBResourceService

logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
from morpheus.messages import ControlMessage
from morpheus.messages import MultiMessage
from morpheus.messages import MultiResponseMessage
from morpheus.modules.schemas.write_to_vector_db_schema import WriteToVDBSchema
from morpheus.service.vdb.milvus_client import DATA_TYPE_MAP
from morpheus.service.vdb.utils import VectorDBServiceFactory
from morpheus.service.vdb.vector_db_service import VectorDBService
from morpheus.utils.module_ids import MORPHEUS_MODULE_NAMESPACE
from morpheus.utils.module_ids import WRITE_TO_VECTOR_DB
from morpheus.utils.module_utils import ModuleLoaderFactory
from morpheus.utils.module_utils import register_module
from morpheus_llm.modules.schemas.write_to_vector_db_schema import WriteToVDBSchema
from morpheus_llm.service.vdb.milvus_client import DATA_TYPE_MAP
from morpheus_llm.service.vdb.utils import VectorDBServiceFactory
from morpheus_llm.service.vdb.vector_db_service import VectorDBService

logger = logging.getLogger(__name__)

Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@

import cudf

from morpheus.service.vdb.vector_db_service import VectorDBResourceService
from morpheus.service.vdb.vector_db_service import VectorDBService
from morpheus_llm.service.vdb.vector_db_service import VectorDBResourceService
from morpheus_llm.service.vdb.vector_db_service import VectorDBService

logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

from morpheus.io.utils import cudf_string_cols_exceed_max_bytes
from morpheus.io.utils import truncate_string_cols_by_bytes
from morpheus.service.vdb.vector_db_service import VectorDBResourceService
from morpheus.service.vdb.vector_db_service import VectorDBService
from morpheus.utils.type_aliases import DataFrameType
from morpheus_llm.service.vdb.vector_db_service import VectorDBResourceService
from morpheus_llm.service.vdb.vector_db_service import VectorDBService

logger = logging.getLogger(__name__)

Expand All @@ -42,7 +42,7 @@
import pymilvus
from pymilvus.orm.mutation import MutationResult

from morpheus.service.vdb.milvus_client import MilvusClient # pylint: disable=ungrouped-imports
from morpheus_llm.service.vdb.milvus_client import MilvusClient # pylint: disable=ungrouped-imports
except ImportError as import_exc:
IMPORT_EXCEPTION = import_exc

Expand Down
11 changes: 6 additions & 5 deletions python/morpheus_llm/morpheus_llm/service/vdb/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import importlib
import typing

import morpheus.service # pylint: disable=unused-import
import morpheus_llm.service # pylint: disable=unused-import


def handle_service_exceptions(func):
Expand Down Expand Up @@ -43,7 +43,7 @@ def wrapper(*args, **kwargs):
return func(*args, **kwargs)
except (ModuleNotFoundError, AttributeError) as exc:
service_name = args[0] if args else kwargs.get('service_name', 'Unknown')
module_name = f"morpheus.service.vdb.{service_name}_vector_db_service"
module_name = f"morpheus_llm.service.vdb.{service_name}_vector_db_service"
raise ValueError(f"Service {service_name} not found. Ensure that the corresponding service class, " +
f"such as {module_name}, has been implemented.") from exc

Expand All @@ -68,7 +68,7 @@ def validate_service(service_name: str):
If the specified service name is not found or does not correspond to a valid service class.
"""

module_name = f"morpheus.service.vdb.{service_name}_vector_db_service"
module_name = f"morpheus_llm.service.vdb.{service_name}_vector_db_service"
importlib.import_module(module_name)

return service_name
Expand All @@ -80,7 +80,8 @@ class VectorDBServiceFactory:
@classmethod
def create_instance(
cls, service_name: typing.Literal["milvus"], *args: typing.Any,
**kwargs: dict[str, typing.Any]) -> "morpheus.service.vdb.milvus_vector_db_service.MilvusVectorDBService":
**kwargs: dict[str, typing.Any]) ->\
"morpheus_llm.service.vdb.milvus_vector_db_service.MilvusVectorDBService":
pass

@classmethod
Expand Down Expand Up @@ -109,7 +110,7 @@ def create_instance(cls, service_name: str, *args: typing.Any, **kwargs: dict[st
ValueError
If the specified service name is not found or does not correspond to a valid service class.
"""
module_name = f"morpheus.service.vdb.{service_name}_vector_db_service"
module_name = f"morpheus_llm.service.vdb.{service_name}_vector_db_service"
module = importlib.import_module(module_name)
class_name = f"{service_name.capitalize()}VectorDBService"
class_ = getattr(module, class_name)
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
from morpheus.messages import ControlMessage
from morpheus.messages import MultiResponseMessage
from morpheus.messages.multi_message import MultiMessage
from morpheus.modules.output.write_to_vector_db import WriteToVectorDBLoaderFactory
from morpheus.pipeline.pass_thru_type_mixin import PassThruTypeMixin
from morpheus.pipeline.single_port_stage import SinglePortStage
from morpheus.service.vdb.vector_db_service import VectorDBService
from morpheus.utils.module_utils import ModuleLoader
from morpheus_llm.modules.output.write_to_vector_db import WriteToVectorDBLoaderFactory
from morpheus_llm.service.vdb.vector_db_service import VectorDBService

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion tests/_utils/milvus.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

import cudf

from morpheus.service.vdb.milvus_vector_db_service import MilvusVectorDBService
from morpheus_llm.service.vdb.milvus_vector_db_service import MilvusVectorDBService


def populate_milvus(milvus_server_uri: str,
Expand Down
2 changes: 1 addition & 1 deletion tests/benchmarks/test_bench_vdb_upload_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
from morpheus.pipeline.linear_pipeline import LinearPipeline
from morpheus.stages.inference.triton_inference_stage import TritonInferenceStage
from morpheus.stages.input.rss_source_stage import RSSSourceStage
from morpheus.stages.output.write_to_vector_db_stage import WriteToVectorDBStage
from morpheus.stages.preprocess.deserialize_stage import DeserializeStage
from morpheus.stages.preprocess.preprocess_nlp_stage import PreprocessNLPStage
from morpheus_llm.stages.output.write_to_vector_db_stage import WriteToVectorDBStage

EMBEDDING_SIZE = 384
MODEL_MAX_BATCH_SIZE = 64
Expand Down
4 changes: 2 additions & 2 deletions tests/llm/nodes/test_llm_retriever_node_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
from morpheus.config import Config
from morpheus.messages import ControlMessage
from morpheus.pipeline.linear_pipeline import LinearPipeline
from morpheus.service.vdb.milvus_vector_db_service import MilvusVectorDBResourceService
from morpheus.service.vdb.milvus_vector_db_service import MilvusVectorDBService
from morpheus.stages.input.in_memory_source_stage import InMemorySourceStage
from morpheus.stages.output.in_memory_sink_stage import InMemorySinkStage
from morpheus.stages.preprocess.deserialize_stage import DeserializeStage
from morpheus_llm.llm import LLMEngine
from morpheus_llm.llm.nodes.extracter_node import ExtracterNode
from morpheus_llm.llm.nodes.retriever_node import RetrieverNode
from morpheus_llm.llm.task_handlers.simple_task_handler import SimpleTaskHandler
from morpheus_llm.service.vdb.milvus_vector_db_service import MilvusVectorDBResourceService
from morpheus_llm.service.vdb.milvus_vector_db_service import MilvusVectorDBService
from morpheus_llm.stages.llm.llm_engine_stage import LLMEngineStage


Expand Down
2 changes: 1 addition & 1 deletion tests/llm/test_vdb_upload_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from _utils import mk_async_infer
from _utils.dataset_manager import DatasetManager
from morpheus.config import Config
from morpheus.service.vdb.milvus_vector_db_service import MilvusVectorDBService
from morpheus_llm.service.vdb.milvus_vector_db_service import MilvusVectorDBService


@pytest.mark.milvus
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tests/test_faiss_vector_db_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@

import pytest

from morpheus.service.vdb.faiss_vdb_service import FaissVectorDBResourceService
from morpheus.service.vdb.faiss_vdb_service import FaissVectorDBService
from morpheus_llm.service.vdb.faiss_vdb_service import FaissVectorDBResourceService
from morpheus_llm.service.vdb.faiss_vdb_service import FaissVectorDBService

if (typing.TYPE_CHECKING):
from langchain_core.embeddings import Embeddings
Expand Down
6 changes: 3 additions & 3 deletions tests/test_milvus_vector_db_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
import cudf

from _utils.dataset_manager import DatasetManager
from morpheus.service.vdb.milvus_vector_db_service import MAX_STRING_LENGTH_BYTES
from morpheus.service.vdb.milvus_vector_db_service import FieldSchemaEncoder
from morpheus.service.vdb.milvus_vector_db_service import MilvusVectorDBService
from morpheus_llm.service.vdb.milvus_vector_db_service import MAX_STRING_LENGTH_BYTES
from morpheus_llm.service.vdb.milvus_vector_db_service import FieldSchemaEncoder
from morpheus_llm.service.vdb.milvus_vector_db_service import MilvusVectorDBService

# Milvus data type mapping dictionary
MILVUS_DATA_TYPE_MAP = {
Expand Down
4 changes: 2 additions & 2 deletions tests/test_milvus_write_to_vector_db_stage_pipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
from morpheus.messages.multi_response_message import MultiResponseMessage
from morpheus.modules import to_control_message # noqa: F401 # pylint: disable=unused-import
from morpheus.pipeline import LinearPipeline
from morpheus.service.vdb.milvus_vector_db_service import MilvusVectorDBService
from morpheus.stages.general.linear_modules_stage import LinearModulesStage
from morpheus.stages.input.in_memory_source_stage import InMemorySourceStage
from morpheus.stages.output.in_memory_sink_stage import InMemorySinkStage
from morpheus.stages.output.write_to_vector_db_stage import WriteToVectorDBStage
from morpheus.stages.preprocess.deserialize_stage import DeserializeStage
from morpheus.utils.module_ids import MORPHEUS_MODULE_NAMESPACE
from morpheus.utils.module_ids import TO_CONTROL_MESSAGE
from morpheus_llm.service.vdb.milvus_vector_db_service import MilvusVectorDBService
from morpheus_llm.stages.output.write_to_vector_db_stage import WriteToVectorDBStage


def get_test_df(num_input_rows):
Expand Down

0 comments on commit 32f0881

Please sign in to comment.