Skip to content

The agent engineering platform.

community[patch]: Minor Improvement of extract hyperlinks tool output (#25728)

zysoong25a6790e1a0b
diff --git a/libs/community/langchain_community/tools/playwright/extract_hyperlinks.py b/libs/community/langchain_community/tools/playwright/extract_hyperlinks.py
index 3cac3c496b..0dcd3fd2e0 100644
--- a/libs/community/langchain_community/tools/playwright/extract_hyperlinks.py
+++ b/libs/community/langchain_community/tools/playwright/extract_hyperlinks.py
@@ -63,8 +63,9 @@ class ExtractHyperlinksTool(BaseBrowserTool):
links = [urljoin(base_url, anchor.get("href", "")) for anchor in anchors]
else:
links = [anchor.get("href", "") for anchor in anchors]
- # Return the list of links as a JSON string
- return json.dumps(links)
+ # Return the list of links as a JSON string. Duplicated link
+ # only appears once in the list
+ return json.dumps(list(set(links)))
def _run(
self,