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

fix: set extension to lazy loading #386

Merged
merged 1 commit into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions agents/ten_packages/extension/bingsearch_tool_python/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion agents/ten_packages/extension/cosy_tts/cosy_tts_addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions agents/ten_packages/extension/fashionai/src/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions agents/ten_packages/extension/glue_python_async/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 2 additions & 2 deletions agents/ten_packages/extension/message_collector/src/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion agents/ten_packages/extension/minimax_v2v_python/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
3 changes: 1 addition & 2 deletions agents/ten_packages/extension/openai_chatgpt_python/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions agents/ten_packages/extension/openai_v2v_python/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions agents/ten_packages/extension/polly_tts/polly_tts_addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions agents/ten_packages/extension/tsdb_firestore/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
4 changes: 2 additions & 2 deletions agents/ten_packages/extension/weatherapi_tool_python/addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)