Skip to content

Comments

fix: telegram multiformat#89

Merged
Eugene Yurtsev (eyurtsev) merged 5 commits intolangchain-ai:mainfrom
jerryyf:support-multiformat-telegram
Jun 9, 2025
Merged

fix: telegram multiformat#89
Eugene Yurtsev (eyurtsev) merged 5 commits intolangchain-ai:mainfrom
jerryyf:support-multiformat-telegram

Conversation

@jerryyf
Copy link
Contributor

@jerryyf jerryyf commented Jun 2, 2025

This PR adds:

  • support for messages that contain special objects such as links, phone, email, formatting. message.content can be in the form of a list which raises the error when checking for type string
  • support for chats with deleted accounts by adding the value "Deleted Account" if from field is empty. This is an issue when trying to call map_ai_messages() as it won't be able to determine the sender resulting in no AIMessage

Reproducing the bug:

  1. export a Telegram chat that contains links or other special formatting like bold text in JSON format
  2. import and run the function TelegramChatLoader() - it will throw the error Chat Loaders only support messages with content type string, got ...

@eyurtsev
Copy link
Contributor

hi jerryyf could you add tests and relevant doc-strings to the implementation

@jerryyf
Copy link
Contributor Author

jerryyf commented Jun 3, 2025

Eugene Yurtsev (@eyurtsev) added a couple tests for bold text and email formats - they are passing. Testing deleted accounts functionality will need a separate file under telegram_chat_json/

@jerryyf
Copy link
Contributor Author

jerryyf commented Jun 6, 2025

sorry, forgot linting after last commit. CI should pass now Eugene Yurtsev (@eyurtsev)

@eyurtsev Eugene Yurtsev (eyurtsev) enabled auto-merge (squash) June 9, 2025 20:28
@eyurtsev Eugene Yurtsev (eyurtsev) merged commit 5103c8f into langchain-ai:main Jun 9, 2025
12 checks passed
@jerryyf jerryyf deleted the support-multiformat-telegram branch June 11, 2025 13:05
Johann-Peter Hartmann (johannhartmann) pushed a commit to mayflower/langchain-community that referenced this pull request Jun 12, 2025
This PR adds:

- support for messages that contain special objects such as links,
phone, email, formatting. `message.content` can be in the form of a list
which raises the error when checking for type string
- support for chats with deleted accounts by adding the value "Deleted
Account" if `from` field is empty. This is an issue when trying to call
`map_ai_messages()` as it won't be able to determine the sender
resulting in no `AIMessage`

Reproducing the bug:

1. export a Telegram chat that contains links or other special
formatting like bold text in JSON format
2. import and run the function `TelegramChatLoader()` - it will throw
the error `Chat Loaders only support messages with content type string,
got ...`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants