Skip to content

Commit

Permalink
Merge pull request #84 from TogetherCrew/feat/83-add-telegram-datasource
Browse files Browse the repository at this point in the history
feat: Added telegram platform support!
  • Loading branch information
amindadgar authored Oct 22, 2024
2 parents 07a786d + 3d0b708 commit b22b823
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
17 changes: 16 additions & 1 deletion subquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
GitHubQueryEngine,
MediaWikiQueryEngine,
NotionQueryEngine,
TelegramQueryEngine,
prepare_discord_engine_auto_filter,
)

Expand Down Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions utils/query_engine/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions utils/query_engine/telegram.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit b22b823

Please sign in to comment.