From 5bcb6301ac3a2cfcd557b427888f8225196d19af Mon Sep 17 00:00:00 2001 From: "jinli.yl" Date: Thu, 27 Jun 2024 12:27:09 +0800 Subject: [PATCH] [dev] add default class path memory_scope --- config/config.yaml | 12 ++++++------ memory_scope/utils/tool_functions.py | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/config/config.yaml b/config/config.yaml index bb4fad52..f6b0f85a 100644 --- a/config/config.yaml +++ b/config/config.yaml @@ -5,23 +5,23 @@ global_config: open_ai_apikey: memory_chat: cli_memory_chat: - class: memory_scope.chat_v2.cli_memory_chat + class: chat_v2.cli_memory_chat memory_service: memory_chat_service generation_model: dashscope_generation memory_service: memory_chat_service: - class: memory_scope.memory.service.chat_memory_service + class: memory.service.chat_memory_service history_msg_count: 32 contextual_msg_count: 6 read_memory_key: read_memory memory_operations: read_message: - class: memory_scope.memory.operation.read_memory + class: memory.operation.read_memory workflow: dummy_worker description: "read session messages of the user" contextual_msg_count: 0 read_memory: - class: memory_scope.memory.operation.read_memory + class: memory.operation.read_memory workflow: dummy_worker description: "read related memories of the user" list_memory: @@ -34,7 +34,7 @@ memory_service: description: "write observation memories of the user" interval_time: 60 summary_memory: - class: memory_scope.memory.operation.summary_memory + class: memory.operation.summary_memory workflow: dummy_worker description: "summary observation memories of the user" interval_time: 300 @@ -48,7 +48,7 @@ models: module_name: dashscope_embedding model_name: text-embedding-v2 dashscope_rank: - clazz: models.base_rank_model + clazz: models.llama_index_rank_model module_name: dashscope_rank model_name: gte-rerank vector_store: diff --git a/memory_scope/utils/tool_functions.py b/memory_scope/utils/tool_functions.py index a0e847c2..7ac7e565 100644 --- a/memory_scope/utils/tool_functions.py +++ b/memory_scope/utils/tool_functions.py @@ -11,18 +11,18 @@ def under_line_to_hump(underline_str): def init_instance_by_config(config: dict, default_class_path: str = "memory_scope", suffix_name: str = "", **kwargs): - class_name = config.pop("class") - if not class_name: - raise RuntimeError("empty class_name!") + origin_class_path: str = config.pop("class") + if not origin_class_path: + raise RuntimeError("empty class path!") - class_name_split = class_name.split(".") + class_name_split = origin_class_path.split(".") class_name: str = class_name_split[-1] if suffix_name and not class_name.lower().endswith(suffix_name.lower()): class_name = f"{class_name}_{suffix_name}" class_name_split[-1] = class_name class_paths = [] - if default_class_path: + if default_class_path and not origin_class_path.startswith(default_class_path): class_paths.append(default_class_path) class_paths.extend(class_name_split) module = import_module(".".join(class_paths))