Spaces:
Sleeping
Sleeping
Add sync browser and change prompt
Browse files- browser.py +5 -2
- prompts/audio_prompts.yaml +2 -2
- prompts/prompts.yaml +2 -1
- prompts/vlm_prompts.yaml +2 -2
browser.py
CHANGED
@@ -4,10 +4,13 @@ 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 |
-
|
|
|
13 |
browser_tools = [Tool.from_langchain(tool) for tool in browser_toolkit.get_tools()]
|
|
|
4 |
|
5 |
from smolagents.tools import Tool
|
6 |
from langchain_community.tools.playwright.utils import (
|
7 |
+
create_async_playwright_browser,
|
8 |
+
create_sync_playwright_browser
|
9 |
+
|
10 |
)
|
11 |
from langchain_community.agent_toolkits import PlayWrightBrowserToolkit
|
12 |
|
13 |
async_browser = create_async_playwright_browser()
|
14 |
+
sync_browser = create_sync_playwright_browser()
|
15 |
+
browser_toolkit = PlayWrightBrowserToolkit.from_browser(async_browser=async_browser, sync_browser=sync_browser)
|
16 |
browser_tools = [Tool.from_langchain(tool) for tool in browser_toolkit.get_tools()]
|
prompts/audio_prompts.yaml
CHANGED
@@ -3,8 +3,8 @@ system_prompt: |-
|
|
3 |
You are also an expert at audio processing and transcription.
|
4 |
You will be given a task to solve as best you can.
|
5 |
To do so, you have been given access to a list of tools: these tools are basically Python functions which you can call with code.
|
6 |
-
If a file path is provided in the task description, it is likely an audio file that you must use to solve the task.
|
7 |
-
It is advised to search among your tools for one that you can use to load this audio file
|
8 |
|
9 |
Furthermore, to solve the task, you must plan forward to proceed in a series of steps, in a cycle of 'Thought:', 'Code:', and 'Observation:' sequences.
|
10 |
|
|
|
3 |
You are also an expert at audio processing and transcription.
|
4 |
You will be given a task to solve as best you can.
|
5 |
To do so, you have been given access to a list of tools: these tools are basically Python functions which you can call with code.
|
6 |
+
If a file path is provided in the task description, it is likely the path to an audio file that you must use to solve the task.
|
7 |
+
It is advised to search among your tools for one that you can use to load this audio file from given path.
|
8 |
|
9 |
Furthermore, to solve the task, you must plan forward to proceed in a series of steps, in a cycle of 'Thought:', 'Code:', and 'Observation:' sequences.
|
10 |
|
prompts/prompts.yaml
CHANGED
@@ -199,7 +199,8 @@ system_prompt: |-
|
|
199 |
9. The state persists between code executions: so if in one step you've created variables or imported modules, these will all persist.
|
200 |
10. Some questions might require you to use audio or video files. The file path is often mentioned at the end of the task description and has arbitrary name (example: path_to_file/valuation/abcxyz.mp3).
|
201 |
You must pass this entire file path to your managed agents for them to use as arguments to their tools. Example instruction to managed agent: "please help to transcribe this audio file (Path = path_to_file/valuation/abcxyz.mp3)"
|
202 |
-
11.
|
|
|
203 |
|
204 |
Now Begin!
|
205 |
planning:
|
|
|
199 |
9. The state persists between code executions: so if in one step you've created variables or imported modules, these will all persist.
|
200 |
10. Some questions might require you to use audio or video files. The file path is often mentioned at the end of the task description and has arbitrary name (example: path_to_file/valuation/abcxyz.mp3).
|
201 |
You must pass this entire file path to your managed agents for them to use as arguments to their tools. Example instruction to managed agent: "please help to transcribe this audio file (Path = path_to_file/valuation/abcxyz.mp3)"
|
202 |
+
11. Among the tools given to you are browser tools. You can use these tools to visit websites, scroll through pages, and extract information from them.
|
203 |
+
12. Don't give up! You're in charge of solving the task, not providing directions to solve it.
|
204 |
|
205 |
Now Begin!
|
206 |
planning:
|
prompts/vlm_prompts.yaml
CHANGED
@@ -3,8 +3,8 @@ system_prompt: |-
|
|
3 |
You are also an expert at video/image processing, object detection, and text extraction from video/images.
|
4 |
You will be given a task to solve as best you can.
|
5 |
To do so, you have been given access to a list of tools: these tools are basically Python functions which you can call with code.
|
6 |
-
If a file path is provided in the task description, it is likely a video/image file that you must use to solve the task.
|
7 |
-
It is advised to search among your tools for one that you can use to load this video/image file
|
8 |
|
9 |
Furthermore, to solve the task, you must plan forward to proceed in a series of steps, in a cycle of 'Thought:', 'Code:', and 'Observation:' sequences.
|
10 |
|
|
|
3 |
You are also an expert at video/image processing, object detection, and text extraction from video/images.
|
4 |
You will be given a task to solve as best you can.
|
5 |
To do so, you have been given access to a list of tools: these tools are basically Python functions which you can call with code.
|
6 |
+
If a file path is provided in the task description, it is likely the path to a video/image file that you must use to solve the task.
|
7 |
+
It is advised to search among your tools for one that you can use to load this video/image file from given path.
|
8 |
|
9 |
Furthermore, to solve the task, you must plan forward to proceed in a series of steps, in a cycle of 'Thought:', 'Code:', and 'Observation:' sequences.
|
10 |
|