mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-25 21:37:20 +00:00
fix(document_loaders/telegram): fix pandas calls + add tests (#4806)
# Fix Telegram API loader + add tests. I was testing this integration and it was broken with next error: ```python message_threads = loader._get_message_threads(df) KeyError: False ``` Also, this particular loader didn't have any tests / related group in poetry, so I added those as well. @hwchase17 / @eyurtsev please take a look on this fix PR. --------- Co-authored-by: Dev 2049 <dev.dev2049@gmail.com>
This commit is contained in:
committed by
GitHub
parent
206c87d525
commit
00c6ec8a2d
@@ -1,18 +0,0 @@
|
||||
from pathlib import Path
|
||||
|
||||
from langchain.document_loaders import TelegramChatFileLoader
|
||||
|
||||
|
||||
def test_telegram_chat_file_loader() -> None:
|
||||
"""Test TelegramChatLoader."""
|
||||
file_path = Path(__file__).parent.parent / "examples/telegram.json"
|
||||
loader = TelegramChatFileLoader(str(file_path))
|
||||
docs = loader.load()
|
||||
|
||||
assert len(docs) == 1
|
||||
assert docs[0].metadata["source"] == str(file_path)
|
||||
assert docs[0].page_content == (
|
||||
"Henry on 2020-01-01T00:00:02: It's 2020...\n\n"
|
||||
"Henry on 2020-01-01T00:00:04: Fireworks!\n\n"
|
||||
"Grace 🧤 ðŸ\x8d’ on 2020-01-01T00:00:05: You're a minute late!\n\n"
|
||||
)
|
@@ -1,31 +0,0 @@
|
||||
{
|
||||
"name": "Grace 🧤",
|
||||
"type": "personal_chat",
|
||||
"id": 2730825451,
|
||||
"messages": [
|
||||
{
|
||||
"id": 1980499,
|
||||
"type": "message",
|
||||
"date": "2020-01-01T00:00:02",
|
||||
"from": "Henry",
|
||||
"from_id": 4325636679,
|
||||
"text": "It's 2020..."
|
||||
},
|
||||
{
|
||||
"id": 1980500,
|
||||
"type": "message",
|
||||
"date": "2020-01-01T00:00:04",
|
||||
"from": "Henry",
|
||||
"from_id": 4325636679,
|
||||
"text": "Fireworks!"
|
||||
},
|
||||
{
|
||||
"id": 1980501,
|
||||
"type": "message",
|
||||
"date": "2020-01-01T00:00:05",
|
||||
"from": "Grace 🧤 ðŸ’",
|
||||
"from_id": 4720225552,
|
||||
"text": "You're a minute late!"
|
||||
}
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user