-
Notifications
You must be signed in to change notification settings - Fork 16.2k
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
community: add Discord send and read message tools #29690
base: master
Are you sure you want to change the base?
Conversation
- Introduce `DiscordClientWrapper` in `tools/discord/base.py` that uses aiohttp to interact with the Discord REST API. - Added asynchronous `send_message` method for posting messages. - Added asynchronous `read_messages` method for retrieving messages. - Add `DiscordSendMessage` tool in `tools/discord/send_message.py` with pydantic input validation and both sync (via asyncio.run) and async interfaces. - Add `DiscordReadMessages` tool in `tools/discord/read_messages.py` to read messages from a channel, with proper error handling and input validation.
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…ools - Updated DiscordReadMessages description to improve line wrapping. - Adjusted DiscordSendMessageSchema description to ensure consistent formatting.
…ools - Updated DiscordReadMessages description to improve line wrapping. - Adjusted DiscordSendMessageSchema description to ensure consistent formatting.
…update client usage
…es, update configuration and dependencies
…es, update configuration and dependencies
can somebody help. i cant seem to find the error here :( |
Hey, I’ve resolved the lint/test issues by adding: # type: ignore[override, override] in the same spots as in the other tools. This makes it consistent with the existing LangChain codebase and fixes the override warning. Everything now passes successfully. Let me know if there’s anything else you’d like me to address! |
PR message:
Description:
This PR introduces a new Discord integration to the LangChain community tools. It adds a
DiscordClientWrapper
inlibs/community/langchain_community/tools/discord/base.py
that leveragesaiohttp
to perform asynchronous HTTP requests to the Discord REST API. The wrapper provides two key functionalities:In addition, two new tools have been added:
libs/community/langchain_community/tools/discord/send_message.py
): A tool for sending messages. It includes both synchronous and asynchronous interfaces, input validation using Pydantic, and robust error handling.libs/community/langchain_community/tools/discord/read_messages.py
): A tool for reading messages from a Discord channel, also featuring both sync and async interfaces along with proper validation and error handling.This integration follows best practices for secure token management (via the
DISCORD_BOT_TOKEN
environment variable), asynchronous processing, and error logging, and it adheres to the established LangChain tool structure.Issue:
N/A
Dependencies:
This change introduces an optional dependency on
aiohttp
for asynchronous HTTP operations. The dependency is only imported within the functions that require it.