The agent engineering platform.
Python agentsaiai-agentsanthropicchatgptdeepagentsenterpriseframeworkgeminigenerative-ailangchainlanggraphllmmultiagentopen-sourceopenaipydanticpythonragtypescript
community[patch]: added latin-1 decoder to gmail search tool (#18116)
Sanjaypranav V Mb9a495e56ebb
diff --git a/libs/community/langchain_community/tools/gmail/search.py b/libs/community/langchain_community/tools/gmail/search.pyindex bcd16e0931..8c49db5e86 100644--- a/libs/community/langchain_community/tools/gmail/search.py+++ b/libs/community/langchain_community/tools/gmail/search.py@@ -98,7 +98,12 @@ class GmailSearch(GmailBaseTool):ctype = part.get_content_type()cdispo = str(part.get("Content-Disposition"))if ctype == "text/plain" and "attachment" not in cdispo:- message_body = part.get_payload(decode=True).decode("utf-8")+ try:+ message_body = part.get_payload(decode=True).decode("utf-8")+ except UnicodeDecodeError:+ message_body = part.get_payload(decode=True).decode(+ "latin-1"+ )breakelse:message_body = email_msg.get_payload(decode=True).decode("utf-8")