Spaces:
Sleeping
Sleeping
Update tools/social_media_search.py
Browse files
tools/social_media_search.py
CHANGED
|
@@ -4,8 +4,12 @@ import re
|
|
| 4 |
|
| 5 |
|
| 6 |
class SocialMediaSearchTool:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
def __init__(self):
|
| 8 |
-
self.ddgs = DDGS()
|
| 9 |
self.platforms = {
|
| 10 |
"LinkedIn": r"linkedin\.com/in/",
|
| 11 |
"GitHub": r"github\.com/",
|
|
@@ -15,7 +19,7 @@ class SocialMediaSearchTool:
|
|
| 15 |
"Instagram": r"instagram\.com/"
|
| 16 |
}
|
| 17 |
|
| 18 |
-
def
|
| 19 |
query = f"{name} {platform}"
|
| 20 |
results = self.ddgs.text(query, max_results=5)
|
| 21 |
|
|
|
|
| 4 |
|
| 5 |
|
| 6 |
class SocialMediaSearchTool:
|
| 7 |
+
name = "social_media_search"
|
| 8 |
+
description = "Visits a each and every social accounts web page of a particular person at the given url and reads its content as a markdown string. Use this to browse webpages."
|
| 9 |
+
inputs = {'url': {'type': 'string', 'description': 'The url of the social account webpage to visit.'}}
|
| 10 |
+
output_type = "string"
|
| 11 |
def __init__(self):
|
| 12 |
+
self.ddgs = DDGS(**kwargs)
|
| 13 |
self.platforms = {
|
| 14 |
"LinkedIn": r"linkedin\.com/in/",
|
| 15 |
"GitHub": r"github\.com/",
|
|
|
|
| 19 |
"Instagram": r"instagram\.com/"
|
| 20 |
}
|
| 21 |
|
| 22 |
+
def forward(self, name: str, platform: str) -> Dict:
|
| 23 |
query = f"{name} {platform}"
|
| 24 |
results = self.ddgs.text(query, max_results=5)
|
| 25 |
|