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

feat: Added telegram platform support! #84

Merged
merged 3 commits into from
Oct 22, 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
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)
Loading