From 6d1a07dc4199c4c0626653f0543b97edb15e7522 Mon Sep 17 00:00:00 2001 From: zhangqianze Date: Thu, 7 Nov 2024 01:10:54 +0800 Subject: [PATCH] fix: set extension to lazy loading --- .../aliyun_analyticdb_vector_storage/vector_storage_addon.py | 4 ++-- .../extension/aliyun_text_embedding/embedding_addon.py | 4 ++-- agents/ten_packages/extension/bingsearch_tool_python/addon.py | 4 ++-- .../ten_packages/extension/cartesia_tts/cartesia_tts_addon.py | 2 +- .../chat_transcriber_python/chat_transcriber_addon.py | 2 +- agents/ten_packages/extension/cosy_tts/cosy_tts_addon.py | 2 +- .../extension/deepgram_asr_python/deepgram_asr_addon.py | 4 ++-- .../extension/elevenlabs_tts_python/elevenlabs_tts_addon.py | 2 +- agents/ten_packages/extension/fashionai/src/addon.py | 4 ++-- .../ten_packages/extension/file_chunker/file_chunker_addon.py | 4 ++-- .../extension/gemini_llm_python/gemini_llm_addon.py | 4 ++-- agents/ten_packages/extension/glue_python_async/addon.py | 4 ++-- .../extension/http_server_python/http_server_addon.py | 4 ++-- .../interrupt_detector_python/interrupt_detector_addon.py | 2 +- .../ten_packages/extension/llama_index_chat_engine/addon.py | 4 ++-- agents/ten_packages/extension/message_collector/src/addon.py | 4 ++-- agents/ten_packages/extension/minimax_v2v_python/addon.py | 2 +- agents/ten_packages/extension/openai_chatgpt_python/addon.py | 3 +-- agents/ten_packages/extension/openai_v2v_python/addon.py | 4 ++-- agents/ten_packages/extension/polly_tts/polly_tts_addon.py | 4 ++-- .../ten_packages/extension/qwen_llm_python/qwen_llm_addon.py | 2 +- .../extension/transcribe_asr_python/transcribe_asr_addon.py | 4 ++-- agents/ten_packages/extension/tsdb_firestore/addon.py | 4 ++-- agents/ten_packages/extension/weatherapi_tool_python/addon.py | 4 ++-- 24 files changed, 40 insertions(+), 41 deletions(-) diff --git a/agents/ten_packages/extension/aliyun_analyticdb_vector_storage/vector_storage_addon.py b/agents/ten_packages/extension/aliyun_analyticdb_vector_storage/vector_storage_addon.py index fd84df4d..747b091b 100644 --- a/agents/ten_packages/extension/aliyun_analyticdb_vector_storage/vector_storage_addon.py +++ b/agents/ten_packages/extension/aliyun_analyticdb_vector_storage/vector_storage_addon.py @@ -3,12 +3,12 @@ register_addon_as_extension, TenEnv, ) -from .log import logger -from .vector_storage_extension import AliPGDBExtension @register_addon_as_extension("aliyun_analyticdb_vector_storage") class AliPGDBExtensionAddon(Addon): def on_create_instance(self, ten: TenEnv, addon_name: str, context) -> None: + from .log import logger + from .vector_storage_extension import AliPGDBExtension logger.info("on_create_instance") ten.on_create_instance_done(AliPGDBExtension(addon_name), context) diff --git a/agents/ten_packages/extension/aliyun_text_embedding/embedding_addon.py b/agents/ten_packages/extension/aliyun_text_embedding/embedding_addon.py index 69f68e10..8c085efc 100644 --- a/agents/ten_packages/extension/aliyun_text_embedding/embedding_addon.py +++ b/agents/ten_packages/extension/aliyun_text_embedding/embedding_addon.py @@ -3,12 +3,12 @@ register_addon_as_extension, TenEnv, ) -from .log import logger -from .embedding_extension import EmbeddingExtension @register_addon_as_extension("aliyun_text_embedding") class EmbeddingExtensionAddon(Addon): def on_create_instance(self, ten: TenEnv, addon_name: str, context) -> None: + from .log import logger + from .embedding_extension import EmbeddingExtension logger.info("on_create_instance") ten.on_create_instance_done(EmbeddingExtension(addon_name), context) diff --git a/agents/ten_packages/extension/bingsearch_tool_python/addon.py b/agents/ten_packages/extension/bingsearch_tool_python/addon.py index b2a6e95e..93f4e691 100644 --- a/agents/ten_packages/extension/bingsearch_tool_python/addon.py +++ b/agents/ten_packages/extension/bingsearch_tool_python/addon.py @@ -10,13 +10,13 @@ register_addon_as_extension, TenEnv, ) -from .extension import BingSearchToolExtension -from .log import logger @register_addon_as_extension("bingsearch_tool_python") class BingSearchToolExtensionAddon(Addon): def on_create_instance(self, ten_env: TenEnv, name: str, context) -> None: + from .extension import BingSearchToolExtension + from .log import logger logger.info("BingSearchToolExtensionAddon on_create_instance") ten_env.on_create_instance_done(BingSearchToolExtension(name), context) diff --git a/agents/ten_packages/extension/cartesia_tts/cartesia_tts_addon.py b/agents/ten_packages/extension/cartesia_tts/cartesia_tts_addon.py index f633d7e3..1883fb5e 100644 --- a/agents/ten_packages/extension/cartesia_tts/cartesia_tts_addon.py +++ b/agents/ten_packages/extension/cartesia_tts/cartesia_tts_addon.py @@ -12,12 +12,12 @@ TenEnv, ) from .extension import EXTENSION_NAME -from .log import logger @register_addon_as_extension(EXTENSION_NAME) class CartesiaTTSExtensionAddon(Addon): def on_create_instance(self, ten: TenEnv, addon_name: str, context) -> None: + from .log import logger logger.info("on_create_instance") from .cartesia_tts_extension import CartesiaTTSExtension diff --git a/agents/ten_packages/extension/chat_transcriber_python/chat_transcriber_addon.py b/agents/ten_packages/extension/chat_transcriber_python/chat_transcriber_addon.py index bddb3386..12b36ce8 100644 --- a/agents/ten_packages/extension/chat_transcriber_python/chat_transcriber_addon.py +++ b/agents/ten_packages/extension/chat_transcriber_python/chat_transcriber_addon.py @@ -3,12 +3,12 @@ register_addon_as_extension, TenEnv, ) -from .log import logger @register_addon_as_extension("chat_transcriber_python") class ChatTranscriberExtensionAddon(Addon): def on_create_instance(self, ten: TenEnv, addon_name: str, context) -> None: + from .log import logger logger.info("on_create_instance") from .chat_transcriber_extension import ChatTranscriberExtension diff --git a/agents/ten_packages/extension/cosy_tts/cosy_tts_addon.py b/agents/ten_packages/extension/cosy_tts/cosy_tts_addon.py index 04711700..2b36e02d 100644 --- a/agents/ten_packages/extension/cosy_tts/cosy_tts_addon.py +++ b/agents/ten_packages/extension/cosy_tts/cosy_tts_addon.py @@ -3,12 +3,12 @@ register_addon_as_extension, TenEnv, ) -from .log import logger @register_addon_as_extension("cosy_tts") class CosyTTSExtensionAddon(Addon): def on_create_instance(self, ten: TenEnv, addon_name: str, context) -> None: + from .log import logger logger.info("on_create_instance") from .cosy_tts_extension import CosyTTSExtension diff --git a/agents/ten_packages/extension/deepgram_asr_python/deepgram_asr_addon.py b/agents/ten_packages/extension/deepgram_asr_python/deepgram_asr_addon.py index 8551dd87..bf8c0422 100644 --- a/agents/ten_packages/extension/deepgram_asr_python/deepgram_asr_addon.py +++ b/agents/ten_packages/extension/deepgram_asr_python/deepgram_asr_addon.py @@ -4,11 +4,11 @@ TenEnv, ) from .extension import EXTENSION_NAME -from .log import logger -from .deepgram_asr_extension import DeepgramASRExtension @register_addon_as_extension(EXTENSION_NAME) class DeepgramASRExtensionAddon(Addon): def on_create_instance(self, ten: TenEnv, addon_name: str, context) -> None: + from .log import logger + from .deepgram_asr_extension import DeepgramASRExtension logger.info("on_create_instance") ten.on_create_instance_done(DeepgramASRExtension(addon_name), context) diff --git a/agents/ten_packages/extension/elevenlabs_tts_python/elevenlabs_tts_addon.py b/agents/ten_packages/extension/elevenlabs_tts_python/elevenlabs_tts_addon.py index 99c448a8..a6361f63 100644 --- a/agents/ten_packages/extension/elevenlabs_tts_python/elevenlabs_tts_addon.py +++ b/agents/ten_packages/extension/elevenlabs_tts_python/elevenlabs_tts_addon.py @@ -12,12 +12,12 @@ TenEnv, ) from .extension import EXTENSION_NAME -from .log import logger @register_addon_as_extension(EXTENSION_NAME) class ElevenlabsTTSExtensionAddon(Addon): def on_create_instance(self, ten: TenEnv, addon_name: str, context) -> None: + from .log import logger logger.info("on_create_instance") from .elevenlabs_tts_extension import ElevenlabsTTSExtension diff --git a/agents/ten_packages/extension/fashionai/src/addon.py b/agents/ten_packages/extension/fashionai/src/addon.py index c0378773..d638453a 100644 --- a/agents/ten_packages/extension/fashionai/src/addon.py +++ b/agents/ten_packages/extension/fashionai/src/addon.py @@ -10,13 +10,13 @@ register_addon_as_extension, TenEnv, ) -from .extension import FashionAIExtension -from .log import logger @register_addon_as_extension("fashionai") class FashionAIExtensionAddon(Addon): def on_create_instance(self, ten_env: TenEnv, name: str, context) -> None: + from .extension import FashionAIExtension + from .log import logger logger.info("FashionAIExtensionAddon on_create_instance") ten_env.on_create_instance_done(FashionAIExtension(name), context) diff --git a/agents/ten_packages/extension/file_chunker/file_chunker_addon.py b/agents/ten_packages/extension/file_chunker/file_chunker_addon.py index e12f5c64..ac6be319 100644 --- a/agents/ten_packages/extension/file_chunker/file_chunker_addon.py +++ b/agents/ten_packages/extension/file_chunker/file_chunker_addon.py @@ -3,12 +3,12 @@ register_addon_as_extension, TenEnv, ) -from .log import logger -from .file_chunker_extension import FileChunkerExtension @register_addon_as_extension("file_chunker") class FileChunkerExtensionAddon(Addon): def on_create_instance(self, ten: TenEnv, addon_name: str, context) -> None: + from .log import logger + from .file_chunker_extension import FileChunkerExtension logger.info("on_create_instance") ten.on_create_instance_done(FileChunkerExtension(addon_name), context) diff --git a/agents/ten_packages/extension/gemini_llm_python/gemini_llm_addon.py b/agents/ten_packages/extension/gemini_llm_python/gemini_llm_addon.py index b68e150c..3e07752a 100644 --- a/agents/ten_packages/extension/gemini_llm_python/gemini_llm_addon.py +++ b/agents/ten_packages/extension/gemini_llm_python/gemini_llm_addon.py @@ -11,13 +11,13 @@ TenEnv, ) from .extension import EXTENSION_NAME -from .log import logger -from .gemini_llm_extension import GeminiLLMExtension @register_addon_as_extension(EXTENSION_NAME) class GeminiLLMExtensionAddon(Addon): def on_create_instance(self, ten: TenEnv, addon_name: str, context) -> None: + from .log import logger + from .gemini_llm_extension import GeminiLLMExtension logger.info("on_create_instance") ten.on_create_instance_done(GeminiLLMExtension(addon_name), context) diff --git a/agents/ten_packages/extension/glue_python_async/addon.py b/agents/ten_packages/extension/glue_python_async/addon.py index 61d685b6..107c7394 100644 --- a/agents/ten_packages/extension/glue_python_async/addon.py +++ b/agents/ten_packages/extension/glue_python_async/addon.py @@ -8,13 +8,13 @@ register_addon_as_extension, TenEnv, ) -from .extension import AsyncGlueExtension -from .log import logger @register_addon_as_extension("glue_python_async") class AsyncGlueExtensionAddon(Addon): def on_create_instance(self, ten_env: TenEnv, name: str, context) -> None: + from .extension import AsyncGlueExtension + from .log import logger logger.info("AsyncGlueExtensionAddon on_create_instance") ten_env.on_create_instance_done(AsyncGlueExtension(name), context) diff --git a/agents/ten_packages/extension/http_server_python/http_server_addon.py b/agents/ten_packages/extension/http_server_python/http_server_addon.py index 6786cd1a..97f269aa 100644 --- a/agents/ten_packages/extension/http_server_python/http_server_addon.py +++ b/agents/ten_packages/extension/http_server_python/http_server_addon.py @@ -3,12 +3,12 @@ register_addon_as_extension, TenEnv, ) -from .log import logger -from .http_server_extension import HTTPServerExtension @register_addon_as_extension("http_server_python") class HTTPServerExtensionAddon(Addon): def on_create_instance(self, ten: TenEnv, addon_name: str, context): + from .log import logger + from .http_server_extension import HTTPServerExtension logger.info("on_create_instance") ten.on_create_instance_done(HTTPServerExtension(addon_name), context) diff --git a/agents/ten_packages/extension/interrupt_detector_python/interrupt_detector_addon.py b/agents/ten_packages/extension/interrupt_detector_python/interrupt_detector_addon.py index 48b57698..0de07b5a 100644 --- a/agents/ten_packages/extension/interrupt_detector_python/interrupt_detector_addon.py +++ b/agents/ten_packages/extension/interrupt_detector_python/interrupt_detector_addon.py @@ -11,12 +11,12 @@ register_addon_as_extension, TenEnv, ) -from .log import logger @register_addon_as_extension("interrupt_detector_python") class InterruptDetectorExtensionAddon(Addon): def on_create_instance(self, ten: TenEnv, addon_name: str, context) -> None: + from .log import logger logger.info("on_create_instance") from .interrupt_detector_extension import InterruptDetectorExtension diff --git a/agents/ten_packages/extension/llama_index_chat_engine/addon.py b/agents/ten_packages/extension/llama_index_chat_engine/addon.py index bfdebc39..e127870d 100644 --- a/agents/ten_packages/extension/llama_index_chat_engine/addon.py +++ b/agents/ten_packages/extension/llama_index_chat_engine/addon.py @@ -1,10 +1,10 @@ from ten import Addon, register_addon_as_extension, TenEnv -from .extension import LlamaIndexExtension -from .log import logger @register_addon_as_extension("llama_index_chat_engine") class LlamaIndexExtensionAddon(Addon): def on_create_instance(self, ten: TenEnv, addon_name: str, context) -> None: + from .extension import LlamaIndexExtension + from .log import logger logger.info("on_create_instance") ten.on_create_instance_done(LlamaIndexExtension(addon_name), context) diff --git a/agents/ten_packages/extension/message_collector/src/addon.py b/agents/ten_packages/extension/message_collector/src/addon.py index ce0629df..94fa5800 100644 --- a/agents/ten_packages/extension/message_collector/src/addon.py +++ b/agents/ten_packages/extension/message_collector/src/addon.py @@ -10,13 +10,13 @@ register_addon_as_extension, TenEnv, ) -from .extension import MessageCollectorExtension -from .log import logger @register_addon_as_extension("message_collector") class MessageCollectorExtensionAddon(Addon): def on_create_instance(self, ten_env: TenEnv, name: str, context) -> None: + from .extension import MessageCollectorExtension + from .log import logger logger.info("MessageCollectorExtensionAddon on_create_instance") ten_env.on_create_instance_done(MessageCollectorExtension(name), context) diff --git a/agents/ten_packages/extension/minimax_v2v_python/addon.py b/agents/ten_packages/extension/minimax_v2v_python/addon.py index f6c0f882..248c8a12 100644 --- a/agents/ten_packages/extension/minimax_v2v_python/addon.py +++ b/agents/ten_packages/extension/minimax_v2v_python/addon.py @@ -8,11 +8,11 @@ register_addon_as_extension, TenEnv, ) -from .extension import MinimaxV2VExtension @register_addon_as_extension("minimax_v2v_python") class MinimaxV2VExtensionAddon(Addon): def on_create_instance(self, ten_env: TenEnv, name: str, context) -> None: + from .extension import MinimaxV2VExtension ten_env.log_info("on_create_instance") ten_env.on_create_instance_done(MinimaxV2VExtension(name), context) diff --git a/agents/ten_packages/extension/openai_chatgpt_python/addon.py b/agents/ten_packages/extension/openai_chatgpt_python/addon.py index 3c5400a9..18fed90c 100644 --- a/agents/ten_packages/extension/openai_chatgpt_python/addon.py +++ b/agents/ten_packages/extension/openai_chatgpt_python/addon.py @@ -10,13 +10,12 @@ register_addon_as_extension, TenEnv, ) -from .extension import OpenAIChatGPTExtension -from .log import logger @register_addon_as_extension("openai_chatgpt_python") class OpenAIChatGPTExtensionAddon(Addon): def on_create_instance(self, ten_env: TenEnv, name: str, context) -> None: + from .extension import OpenAIChatGPTExtension ten_env.log_info("OpenAIChatGPTExtensionAddon on_create_instance") ten_env.on_create_instance_done(OpenAIChatGPTExtension(name), context) diff --git a/agents/ten_packages/extension/openai_v2v_python/addon.py b/agents/ten_packages/extension/openai_v2v_python/addon.py index 8cac9953..79cc9e59 100644 --- a/agents/ten_packages/extension/openai_v2v_python/addon.py +++ b/agents/ten_packages/extension/openai_v2v_python/addon.py @@ -10,13 +10,13 @@ register_addon_as_extension, TenEnv, ) -from .extension import OpenAIV2VExtension -from .log import logger @register_addon_as_extension("openai_v2v_python") class OpenAIV2VExtensionAddon(Addon): def on_create_instance(self, ten_env: TenEnv, name: str, context) -> None: + from .extension import OpenAIV2VExtension + from .log import logger logger.info("OpenAIV2VExtensionAddon on_create_instance") ten_env.on_create_instance_done(OpenAIV2VExtension(name), context) diff --git a/agents/ten_packages/extension/polly_tts/polly_tts_addon.py b/agents/ten_packages/extension/polly_tts/polly_tts_addon.py index e8b9ab6a..6dc74b9b 100644 --- a/agents/ten_packages/extension/polly_tts/polly_tts_addon.py +++ b/agents/ten_packages/extension/polly_tts/polly_tts_addon.py @@ -4,12 +4,12 @@ TenEnv, ) from .extension import EXTENSION_NAME -from .log import logger -from .polly_tts_extension import PollyTTSExtension @register_addon_as_extension(EXTENSION_NAME) class PollyTTSExtensionAddon(Addon): def on_create_instance(self, ten: TenEnv, addon_name: str, context) -> None: + from .log import logger + from .polly_tts_extension import PollyTTSExtension logger.info("on_create_instance") ten.on_create_instance_done(PollyTTSExtension(addon_name), context) diff --git a/agents/ten_packages/extension/qwen_llm_python/qwen_llm_addon.py b/agents/ten_packages/extension/qwen_llm_python/qwen_llm_addon.py index 3af6f95c..7fe49cbd 100644 --- a/agents/ten_packages/extension/qwen_llm_python/qwen_llm_addon.py +++ b/agents/ten_packages/extension/qwen_llm_python/qwen_llm_addon.py @@ -10,12 +10,12 @@ register_addon_as_extension, TenEnv, ) -from .log import logger @register_addon_as_extension("qwen_llm_python") class QWenLLMExtensionAddon(Addon): def on_create_instance(self, ten: TenEnv, addon_name: str, context): + from .log import logger logger.info("on_create_instance") from .qwen_llm_extension import QWenLLMExtension diff --git a/agents/ten_packages/extension/transcribe_asr_python/transcribe_asr_addon.py b/agents/ten_packages/extension/transcribe_asr_python/transcribe_asr_addon.py index e9ebf7a9..ad9c5391 100644 --- a/agents/ten_packages/extension/transcribe_asr_python/transcribe_asr_addon.py +++ b/agents/ten_packages/extension/transcribe_asr_python/transcribe_asr_addon.py @@ -4,12 +4,12 @@ TenEnv, ) from .extension import EXTENSION_NAME -from .log import logger -from .transcribe_asr_extension import TranscribeAsrExtension @register_addon_as_extension(EXTENSION_NAME) class TranscribeAsrExtensionAddon(Addon): def on_create_instance(self, ten: TenEnv, addon_name: str, context) -> None: + from .log import logger + from .transcribe_asr_extension import TranscribeAsrExtension logger.info("on_create_instance") ten.on_create_instance_done(TranscribeAsrExtension(addon_name), context) diff --git a/agents/ten_packages/extension/tsdb_firestore/addon.py b/agents/ten_packages/extension/tsdb_firestore/addon.py index b264634f..e994e72b 100644 --- a/agents/ten_packages/extension/tsdb_firestore/addon.py +++ b/agents/ten_packages/extension/tsdb_firestore/addon.py @@ -10,13 +10,13 @@ register_addon_as_extension, TenEnv, ) -from .extension import TSDBFirestoreExtension -from .log import logger @register_addon_as_extension("tsdb_firestore") class TSDBFirestoreExtensionAddon(Addon): def on_create_instance(self, ten_env: TenEnv, name: str, context) -> None: + from .extension import TSDBFirestoreExtension + from .log import logger logger.info("TSDBFirestoreExtensionAddon on_create_instance") ten_env.on_create_instance_done(TSDBFirestoreExtension(name), context) diff --git a/agents/ten_packages/extension/weatherapi_tool_python/addon.py b/agents/ten_packages/extension/weatherapi_tool_python/addon.py index bf5e0284..ba56a0c6 100644 --- a/agents/ten_packages/extension/weatherapi_tool_python/addon.py +++ b/agents/ten_packages/extension/weatherapi_tool_python/addon.py @@ -10,13 +10,13 @@ register_addon_as_extension, TenEnv, ) -from .extension import WeatherToolExtension -from .log import logger @register_addon_as_extension("weatherapi_tool_python") class WeatherToolExtensionAddon(Addon): def on_create_instance(self, ten_env: TenEnv, name: str, context) -> None: + from .extension import WeatherToolExtension + from .log import logger logger.info("WeatherToolExtensionAddon on_create_instance") ten_env.on_create_instance_done(WeatherToolExtension(name), context)