diff --git a/examples/doca/vdb_realtime/vdb.py b/examples/doca/vdb_realtime/vdb.py index 371c39cf34..79c9aee420 100644 --- a/examples/doca/vdb_realtime/vdb.py +++ b/examples/doca/vdb_realtime/vdb.py @@ -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): diff --git a/examples/llm/common/utils.py b/examples/llm/common/utils.py index 93681d66da..fd6d21451a 100644 --- a/examples/llm/common/utils.py +++ b/examples/llm/common/utils.py @@ -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__) diff --git a/examples/llm/vdb_upload/pipeline.py b/examples/llm/vdb_upload/pipeline.py index 5d5fbee8e4..1d841dea4b 100644 --- a/examples/llm/vdb_upload/pipeline.py +++ b/examples/llm/vdb_upload/pipeline.py @@ -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__) diff --git a/examples/llm/vdb_upload/vdb_utils.py b/examples/llm/vdb_upload/vdb_utils.py index 496df72797..fb853f8cf2 100644 --- a/examples/llm/vdb_upload/vdb_utils.py +++ b/examples/llm/vdb_upload/vdb_utils.py @@ -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__) @@ -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) diff --git a/python/morpheus_llm/morpheus_llm/llm/nodes/rag_node.py b/python/morpheus_llm/morpheus_llm/llm/nodes/rag_node.py index b9852d0350..e5adeb377c 100644 --- a/python/morpheus_llm/morpheus_llm/llm/nodes/rag_node.py +++ b/python/morpheus_llm/morpheus_llm/llm/nodes/rag_node.py @@ -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__) diff --git a/python/morpheus_llm/morpheus_llm/llm/nodes/retriever_node.py b/python/morpheus_llm/morpheus_llm/llm/nodes/retriever_node.py index e319cc19af..ac57752c00 100644 --- a/python/morpheus_llm/morpheus_llm/llm/nodes/retriever_node.py +++ b/python/morpheus_llm/morpheus_llm/llm/nodes/retriever_node.py @@ -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__) diff --git a/python/morpheus_llm/morpheus_llm/modules/output/write_to_vector_db.py b/python/morpheus_llm/morpheus_llm/modules/output/write_to_vector_db.py index 9e1fd4d11a..266fff21ee 100644 --- a/python/morpheus_llm/morpheus_llm/modules/output/write_to_vector_db.py +++ b/python/morpheus_llm/morpheus_llm/modules/output/write_to_vector_db.py @@ -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__) diff --git a/python/morpheus_llm/morpheus_llm/service/__init__.py b/python/morpheus_llm/morpheus_llm/service/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/python/morpheus_llm/morpheus_llm/service/vdb/faiss_vdb_service.py b/python/morpheus_llm/morpheus_llm/service/vdb/faiss_vdb_service.py index 36cf754252..82e6c146d2 100644 --- a/python/morpheus_llm/morpheus_llm/service/vdb/faiss_vdb_service.py +++ b/python/morpheus_llm/morpheus_llm/service/vdb/faiss_vdb_service.py @@ -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__) diff --git a/python/morpheus_llm/morpheus_llm/service/vdb/milvus_vector_db_service.py b/python/morpheus_llm/morpheus_llm/service/vdb/milvus_vector_db_service.py index 09c68f15cd..f43fbbf79c 100644 --- a/python/morpheus_llm/morpheus_llm/service/vdb/milvus_vector_db_service.py +++ b/python/morpheus_llm/morpheus_llm/service/vdb/milvus_vector_db_service.py @@ -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__) @@ -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 diff --git a/python/morpheus_llm/morpheus_llm/service/vdb/utils.py b/python/morpheus_llm/morpheus_llm/service/vdb/utils.py index 44d8fae889..a33c14da4d 100644 --- a/python/morpheus_llm/morpheus_llm/service/vdb/utils.py +++ b/python/morpheus_llm/morpheus_llm/service/vdb/utils.py @@ -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): @@ -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 @@ -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 @@ -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 @@ -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) diff --git a/python/morpheus_llm/morpheus_llm/stages/output/__init__.py b/python/morpheus_llm/morpheus_llm/stages/output/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/python/morpheus_llm/morpheus_llm/stages/output/write_to_vector_db_stage.py b/python/morpheus_llm/morpheus_llm/stages/output/write_to_vector_db_stage.py index 2b2fddc394..5ebb31eb4d 100644 --- a/python/morpheus_llm/morpheus_llm/stages/output/write_to_vector_db_stage.py +++ b/python/morpheus_llm/morpheus_llm/stages/output/write_to_vector_db_stage.py @@ -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__) diff --git a/tests/_utils/milvus.py b/tests/_utils/milvus.py index ac5e08b7e6..534abbb09d 100644 --- a/tests/_utils/milvus.py +++ b/tests/_utils/milvus.py @@ -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, diff --git a/tests/benchmarks/test_bench_vdb_upload_pipeline.py b/tests/benchmarks/test_bench_vdb_upload_pipeline.py index d54c536780..f7864fb779 100644 --- a/tests/benchmarks/test_bench_vdb_upload_pipeline.py +++ b/tests/benchmarks/test_bench_vdb_upload_pipeline.py @@ -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 diff --git a/tests/llm/nodes/test_llm_retriever_node_pipe.py b/tests/llm/nodes/test_llm_retriever_node_pipe.py index 40c726f65d..4c070f7964 100644 --- a/tests/llm/nodes/test_llm_retriever_node_pipe.py +++ b/tests/llm/nodes/test_llm_retriever_node_pipe.py @@ -22,8 +22,6 @@ 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 @@ -31,6 +29,8 @@ 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 diff --git a/tests/llm/test_vdb_upload_pipe.py b/tests/llm/test_vdb_upload_pipe.py index f6051ebb55..88a51c631f 100755 --- a/tests/llm/test_vdb_upload_pipe.py +++ b/tests/llm/test_vdb_upload_pipe.py @@ -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 diff --git a/tests/common/test_determine_file_type.py b/tests/morpheus/common/test_determine_file_type.py similarity index 100% rename from tests/common/test_determine_file_type.py rename to tests/morpheus/common/test_determine_file_type.py diff --git a/tests/common/test_fiber_queue.py b/tests/morpheus/common/test_fiber_queue.py similarity index 100% rename from tests/common/test_fiber_queue.py rename to tests/morpheus/common/test_fiber_queue.py diff --git a/tests/common/test_http_server.py b/tests/morpheus/common/test_http_server.py similarity index 100% rename from tests/common/test_http_server.py rename to tests/morpheus/common/test_http_server.py diff --git a/tests/test_faiss_vector_db_service.py b/tests/test_faiss_vector_db_service.py index 98a428bbe3..248d25d78a 100644 --- a/tests/test_faiss_vector_db_service.py +++ b/tests/test_faiss_vector_db_service.py @@ -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 diff --git a/tests/test_milvus_vector_db_service.py b/tests/test_milvus_vector_db_service.py index 3d0548176d..39a2b2c495 100644 --- a/tests/test_milvus_vector_db_service.py +++ b/tests/test_milvus_vector_db_service.py @@ -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 = { diff --git a/tests/test_milvus_write_to_vector_db_stage_pipe.py b/tests/test_milvus_write_to_vector_db_stage_pipe.py index d5e8efee99..da0428c1bc 100755 --- a/tests/test_milvus_write_to_vector_db_stage_pipe.py +++ b/tests/test_milvus_write_to_vector_db_stage_pipe.py @@ -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):