fix crawl tool

This commit is contained in:
LE Quoc Dat 2025-04-19 15:10:15 +01:00
parent f06ce14f0a
commit db3e236f34
1 changed files with 3 additions and 2 deletions

View File

@ -278,7 +278,7 @@ class WebSearchTool(Tool):
formatted_result = { formatted_result = {
"Title": item.get("title"), "Title": item.get("title"),
"URL": item.get("url") or url, "URL": item.get("url") or url,
"Text": item.get("content") or item.get("text") or "", "Text":item.get("raw_content") or item.get("content") or item.get("text")
} }
if item.get("published_date"): if item.get("published_date"):
formatted_result["Published Date"] = item["published_date"] formatted_result["Published Date"] = item["published_date"]
@ -312,7 +312,8 @@ if __name__ == "__main__":
"""Test function for the webpage crawl tool""" """Test function for the webpage crawl tool"""
search_tool = WebSearchTool() search_tool = WebSearchTool()
result = await search_tool.crawl_webpage( result = await search_tool.crawl_webpage(
url="https://google.com" # url="https://google.com",
url = "https://www.wired.com/story/anthropic-benevolent-artificial-intelligence/",
) )
print(result) print(result)