Spaces:
Sleeping
Sleeping
browser support
Browse files- browser.py +13 -0
- community_tools.py +1 -9
- scripts.sh +8 -7
browser.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import subprocess
|
2 |
+
|
3 |
+
subprocess.run(["bash", "scripts.sh"])
|
4 |
+
|
5 |
+
from smolagents.tools import Tool
|
6 |
+
from langchain_community.tools.playwright.utils import (
|
7 |
+
create_async_playwright_browser
|
8 |
+
)
|
9 |
+
from langchain_community.agent_toolkits import PlayWrightBrowserToolkit
|
10 |
+
|
11 |
+
async_browser = create_async_playwright_browser()
|
12 |
+
browser_toolkit = PlayWrightBrowserToolkit.from_browser(async_browser=async_browser)
|
13 |
+
browser_tools = [Tool.from_langchain(tool) for tool in browser_toolkit.get_tools()]
|
community_tools.py
CHANGED
@@ -3,10 +3,6 @@ from langchain_community.agent_toolkits.load_tools import load_tools
|
|
3 |
from smolagents.tools import Tool, tool
|
4 |
from youtube_transcript_api import YouTubeTranscriptApi
|
5 |
from youtube_transcript_api.proxies import WebshareProxyConfig
|
6 |
-
from langchain_community.tools.playwright.utils import (
|
7 |
-
create_async_playwright_browser
|
8 |
-
)
|
9 |
-
from langchain_community.agent_toolkits import PlayWrightBrowserToolkit
|
10 |
import os
|
11 |
|
12 |
google_map_tool = Tool.from_langchain(GooglePlacesTool())
|
@@ -18,11 +14,7 @@ wikipedia_tool = Tool.from_langchain(WikipediaQueryRun(api_wrapper=WikipediaAPIW
|
|
18 |
|
19 |
arxiv_tools = [Tool.from_langchain(tool) for tool in load_tools(["arxiv"])]
|
20 |
|
21 |
-
|
22 |
-
browser_toolkit = PlayWrightBrowserToolkit.from_browser(async_browser=async_browser)
|
23 |
-
browser_tools = [Tool.from_langchain(tool) for tool in browser_toolkit.get_tools()]
|
24 |
-
|
25 |
-
community_tools = [google_map_tool, wikipedia_tool, *arxiv_tools, *browser_tools]
|
26 |
|
27 |
@tool
|
28 |
def get_youtube_transcript_from_url(video_url: str)->str:
|
|
|
3 |
from smolagents.tools import Tool, tool
|
4 |
from youtube_transcript_api import YouTubeTranscriptApi
|
5 |
from youtube_transcript_api.proxies import WebshareProxyConfig
|
|
|
|
|
|
|
|
|
6 |
import os
|
7 |
|
8 |
google_map_tool = Tool.from_langchain(GooglePlacesTool())
|
|
|
14 |
|
15 |
arxiv_tools = [Tool.from_langchain(tool) for tool in load_tools(["arxiv"])]
|
16 |
|
17 |
+
community_tools = [google_map_tool, wikipedia_tool, *arxiv_tools]
|
|
|
|
|
|
|
|
|
18 |
|
19 |
@tool
|
20 |
def get_youtube_transcript_from_url(video_url: str)->str:
|
scripts.sh
CHANGED
@@ -1,9 +1,10 @@
|
|
1 |
playwright install
|
2 |
apt-get update
|
3 |
-
apt-get install libnss3
|
4 |
-
apt-get install libnspr4
|
5 |
-
apt-get install libatk1.0-0
|
6 |
-
apt-get install libatk-bridge2.0-0
|
7 |
-
apt-get install libatspi2.0-0
|
8 |
-
apt-get install libxcomposite1
|
9 |
-
apt-get install libxdamage1
|
|
|
|
1 |
playwright install
|
2 |
apt-get update
|
3 |
+
apt-get --assume-yes install libnss3
|
4 |
+
apt-get --assume-yes install libnspr4
|
5 |
+
apt-get --assume-yes install libatk1.0-0
|
6 |
+
apt-get --assume-yes install libatk-bridge2.0-0
|
7 |
+
apt-get --assume-yes install libatspi2.0-0
|
8 |
+
apt-get --assume-yes install libxcomposite1
|
9 |
+
apt-get --assume-yes install libxdamage1
|
10 |
+
apt-get --assume-yes install libasound2
|