Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
OurBuilding Ambient Agents with LangGraph course is now available on LangChain Academy!
Open In ColabOpen on GitHub

Telegram

Telegram Messenger is a globally accessible freemium, cross-platform, encrypted, cloud-based and centralized instant messaging service. The application also provides optional end-to-end encrypted chats and video calling, VoIP, file sharing and several other features.

This notebook covers how to load data fromTelegram into a format that can be ingested into LangChain.

from langchain_community.document_loadersimport(
TelegramChatApiLoader,
TelegramChatFileLoader,
)
loader= TelegramChatFileLoader("example_data/telegram.json")
loader.load()
[Document(page_content="Henry on 2020-01-01T00:00:02: It's 2020...\n\nHenry on 2020-01-01T00:00:04: Fireworks!\n\nGrace 🧤 ðŸ\x8d’ on 2020-01-01T00:00:05: You're a minute late!\n\n", metadata={'source': 'example_data/telegram.json'})]

TelegramChatApiLoader loads data directly from any specified chat from Telegram. In order to export the data, you will need to authenticate your Telegram account.

You can get the API_HASH and API_ID fromhttps://my.telegram.org/auth?to=apps

chat_entity – recommended to be theentity of a channel.

loader= TelegramChatApiLoader(
chat_entity="<CHAT_URL>",# recommended to use Entity here
api_hash="<API HASH >",
api_id="<API_ID>",
username="",# needed only for caching the session.
)
loader.load()

Related


[8]ページ先頭

©2009-2025 Movatter.jp