diff --git a/subquery.py b/subquery.py index 8b11c73..eeaa24f 100644 --- a/subquery.py +++ b/subquery.py @@ -14,6 +14,7 @@ GitHubQueryEngine, MediaWikiQueryEngine, NotionQueryEngine, + TelegramQueryEngine, prepare_discord_engine_auto_filter, ) @@ -133,7 +134,21 @@ def query_multiple_source( ) ) if telegram and check_collection("telegram"): - raise NotImplementedError + telegram_query_engine = TelegramQueryEngine(community_id=community_id).prepare() + tool_metadata = ToolMetadata( + name="Telegram", + description=( + "Contains messages, conversations, and media from the Telegram platform," + " used for group discussions within the community." + ), + ) + query_engine_tools.append( + QueryEngineTool( + query_engine=telegram_query_engine, + metadata=tool_metadata, + ) + ) + if github and check_collection("github"): github_query_engine = GitHubQueryEngine(community_id=community_id).prepare() tool_metadata = ToolMetadata( diff --git a/utils/query_engine/__init__.py b/utils/query_engine/__init__.py index ed43657..b1ae299 100644 --- a/utils/query_engine/__init__.py +++ b/utils/query_engine/__init__.py @@ -5,3 +5,4 @@ from .notion import NotionQueryEngine from .prepare_discord_query_engine import prepare_discord_engine_auto_filter from .subquery_gen_prompt import DEFAULT_GUIDANCE_SUB_QUESTION_PROMPT_TMPL +from .telegram import TelegramQueryEngine diff --git a/utils/query_engine/telegram.py b/utils/query_engine/telegram.py new file mode 100644 index 0000000..9f0ba48 --- /dev/null +++ b/utils/query_engine/telegram.py @@ -0,0 +1,7 @@ +from utils.query_engine.base_qdrant_engine import BaseQdrantEngine + + +class TelegramQueryEngine(BaseQdrantEngine): + def __init__(self, community_id: str) -> None: + platform_name = "telegram" + super().__init__(platform_name, community_id)