Name | llama-index-readers-telegram JSON |
Version |
0.1.5
JSON |
| download |
home_page | None |
Summary | llama-index readers telegram integration |
upload_time | 2024-03-20 20:52:05 |
maintainer | diicell |
docs_url | None |
author | Dias Kalkamanov |
requires_python | <4.0,>=3.8.1 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Telegram Loader
```bash
pip install llama-index-readers-telegram
```
This loader fetches posts/chat messages/comments from Telegram channels or chats into `Document`s.
Before working with Telegram’s API, you need to get your own API ID and hash:
1. [Login to your Telegram account](https://my.telegram.org) with the phone number of the developer account to use.
2. Click under API Development tools.
3. A Create new application window will appear. Fill in your application details. There is no need to enter any URL, and only the first two fields (App title and Short name) can currently be changed later.
4. Click on Create application at the end. Remember that your API hash is secret and Telegram won’t let you revoke it. Don’t post it anywhere!
This API ID and hash is the one used by your application, not your phone number. You can use this API ID and hash with any phone number.
## Usage
The first parameter you pass to the constructor of the TelegramReader is the session_name, and defaults to be the session name (or full path). That is, if you create a TelegramReader(session_name='anon', ...) instance and run load_data(), an `anon.session` file will be created in the working directory where you run this loader.
The Auth procedure asks for:
- Security Code
- Password
```bash
Please enter the code you received: 12345
Please enter your password: *******
(You are now logged in)
```
If the `.session` file already existed, it will not login again, so be aware of this if you move or rename the file! See [here](https://docs.telethon.dev/en/stable/index.html) for more instructions.
To use this loader, you simply need to pass in a entity name.
```python
from llama_index.readers.telegram import TelegramReader
loader = TelegramReader(
session_name="[YOUR_SESSION_NAME]",
api_id="[YOUR_API_ID]",
api_hash="[YOUR_API_HASH]",
phone_number="[YOUR_PHONE_NUMBER]",
)
documents = loader.load_data(
entity_name="https://t.me/[ENTITY_NAME]", limit=100
)
```
## Examples
This loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/tree/main/llama_index) and/or subsequently used as a Tool in a [LangChain](https://github.com/hwchase17/langchain) Agent.
Raw data
{
"_id": null,
"home_page": null,
"name": "llama-index-readers-telegram",
"maintainer": "diicell",
"docs_url": null,
"requires_python": "<4.0,>=3.8.1",
"maintainer_email": null,
"keywords": null,
"author": "Dias Kalkamanov",
"author_email": "diicellman@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/9b/50/7026e05c96648db52342ee53cc27c66f57aacec5362ff3bcc57f2d131027/llama_index_readers_telegram-0.1.5.tar.gz",
"platform": null,
"description": "# Telegram Loader\n\n```bash\npip install llama-index-readers-telegram\n```\n\nThis loader fetches posts/chat messages/comments from Telegram channels or chats into `Document`s.\n\nBefore working with Telegram\u2019s API, you need to get your own API ID and hash:\n\n1. [Login to your Telegram account](https://my.telegram.org) with the phone number of the developer account to use.\n2. Click under API Development tools.\n3. A Create new application window will appear. Fill in your application details. There is no need to enter any URL, and only the first two fields (App title and Short name) can currently be changed later.\n4. Click on Create application at the end. Remember that your API hash is secret and Telegram won\u2019t let you revoke it. Don\u2019t post it anywhere!\n\nThis API ID and hash is the one used by your application, not your phone number. You can use this API ID and hash with any phone number.\n\n## Usage\n\nThe first parameter you pass to the constructor of the TelegramReader is the session_name, and defaults to be the session name (or full path). That is, if you create a TelegramReader(session_name='anon', ...) instance and run load_data(), an `anon.session` file will be created in the working directory where you run this loader.\n\nThe Auth procedure asks for:\n\n- Security Code\n- Password\n\n```bash\nPlease enter the code you received: 12345\nPlease enter your password: *******\n(You are now logged in)\n```\n\nIf the `.session` file already existed, it will not login again, so be aware of this if you move or rename the file! See [here](https://docs.telethon.dev/en/stable/index.html) for more instructions.\n\nTo use this loader, you simply need to pass in a entity name.\n\n```python\nfrom llama_index.readers.telegram import TelegramReader\n\nloader = TelegramReader(\n session_name=\"[YOUR_SESSION_NAME]\",\n api_id=\"[YOUR_API_ID]\",\n api_hash=\"[YOUR_API_HASH]\",\n phone_number=\"[YOUR_PHONE_NUMBER]\",\n)\ndocuments = loader.load_data(\n entity_name=\"https://t.me/[ENTITY_NAME]\", limit=100\n)\n```\n\n## Examples\n\nThis loader is designed to be used as a way to load data into [LlamaIndex](https://github.com/run-llama/llama_index/tree/main/llama_index) and/or subsequently used as a Tool in a [LangChain](https://github.com/hwchase17/langchain) Agent.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "llama-index readers telegram integration",
"version": "0.1.5",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "84ad906637138112b665b74dc45db3aef2d970d2d112d23af9884a9285bde132",
"md5": "537a8ef75199a886cab7fef59070ce79",
"sha256": "778826437d52b646583ff761753f9354320b824084cda44ac61cddc7a73087b8"
},
"downloads": -1,
"filename": "llama_index_readers_telegram-0.1.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "537a8ef75199a886cab7fef59070ce79",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8.1",
"size": 4367,
"upload_time": "2024-03-20T20:52:04",
"upload_time_iso_8601": "2024-03-20T20:52:04.237545Z",
"url": "https://files.pythonhosted.org/packages/84/ad/906637138112b665b74dc45db3aef2d970d2d112d23af9884a9285bde132/llama_index_readers_telegram-0.1.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "9b507026e05c96648db52342ee53cc27c66f57aacec5362ff3bcc57f2d131027",
"md5": "28f84f041186df11b48ddb95f7c885ca",
"sha256": "229c984f048550e4530b72a6cca7e402f523116a46460050b0a00c3e05ab57b9"
},
"downloads": -1,
"filename": "llama_index_readers_telegram-0.1.5.tar.gz",
"has_sig": false,
"md5_digest": "28f84f041186df11b48ddb95f7c885ca",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8.1",
"size": 3792,
"upload_time": "2024-03-20T20:52:05",
"upload_time_iso_8601": "2024-03-20T20:52:05.369033Z",
"url": "https://files.pythonhosted.org/packages/9b/50/7026e05c96648db52342ee53cc27c66f57aacec5362ff3bcc57f2d131027/llama_index_readers_telegram-0.1.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-03-20 20:52:05",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "llama-index-readers-telegram"
}