Skip to content

Commit d411f51

Browse files
committed
Merge with upstream/dev
2 parents 33d4551 + cb30e22 commit d411f51

34 files changed

+1136
-584
lines changed

README.md

+37-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This provides a natural language way to interacting with a web browser:
1111
- Manage and automate tasks on project management platforms (like JIRA) by filtering issues, easing the workflow for users.
1212
- Provide personal shopping assistance, suggesting products based on the user's needs, such as storage options for game cards.
1313

14-
While Agent-E is growing, it is already equipped to handle a versatile range of tasks, but the best task is the one that you come up with. So, take it for a spin and tell us what you were able to do with it. For more information see our [blog article](https://blog.emergence.ai/2024/03/28/distilling-the-web-agent.html).
14+
While Agent-E is growing, it is already equipped to handle a versatile range of tasks, but the best task is the one that you come up with. So, take it for a spin and tell us what you were able to do with it. For more information see our [blog article](https://www.emergence.ai/blog/distilling-the-web-for-multi-agent-automation).
1515

1616

1717
## Quick Start
@@ -30,7 +30,8 @@ While Agent-E is growing, it is already equipped to handle a versatile range of
3030
- .env file in project root is needed with the following (sample `.env-example` is included for convience):
3131
- Follow the directions in the sample file
3232
- You will need to set `AUTOGEN_MODEL_NAME` (for example `gpt-4-turbo-preview`) and `AUTOGEN_MODEL_API_KEY`
33-
- If you are using a model other than OpenAI, you need to set `AUTOGEN_MODEL_BASE_URL` for example `https://api.groq.com/openai/v1`
33+
- If you are using a model other than OpenAI, you need to set `AUTOGEN_MODEL_BASE_URL` for example `https://api.groq.com/openai/v1` or `https://<REPLACE_AI_SERVICES>.openai.azure.com` on [Azure](https://azure.microsoft.com/).
34+
- For [Azure](https://azure.microsoft.com/), you'll also need to configure `AUTOGEN_MODEL_API_TYPE=azure` and `AUTOGEN_MODEL_API_VERSION` (for example `2023-03-15-preview`) variables.
3435
- If you want to use local chrome browser over playwright browser, go to chrome://version/ in chrome, find the path to your profile and set `BROWSER_STORAGE_DIR` to the path value
3536

3637
### pip issues
@@ -155,6 +156,39 @@ html_theme = 'sphinx_rtd_theme'
155156
7. Build the documentation, from `docs` directory, run: `sphinx-build -b html . _build`
156157

157158

159+
## Open-source models
160+
161+
Using open-source models is possible through LiteLLM with Ollama. Ollama allows users to run language models locally on their machines, and LiteLLM translates OpenAI-format inputs to local models' endpoints. To use open-source models as Agent-E backbone, follow the steps below:
162+
163+
1. Install LiteLLM
164+
```bash
165+
pip install 'litellm[proxy]'
166+
```
167+
2. Install Ollama
168+
* For Mac and Windows, download [Ollama](https://ollama.com/download).
169+
* For Linux:
170+
```bash
171+
curl -fsSL https://ollama.com/install.sh | sh
172+
```
173+
3. Pull Ollama models
174+
Before you can use a model, you need to download it from the library. The list of available models is [here](https://ollama.com/library). Here, we use Mistral v0.3:
175+
```bash
176+
ollama pull mistral:v0.3
177+
```
178+
4. Run LiteLLM
179+
To run the downloaded model with LiteLLM as a proxy, run:
180+
```bash
181+
litellm --model ollama_chat/mistral:v0.3
182+
```
183+
5. Configure model in Autogen
184+
Configure the `.env` file as follows. Note that the model name and API keys are not needed since the local model is already running.
185+
```bash
186+
AUTOGEN_MODEL_NAME=NotRequired
187+
AUTOGEN_MODEL_API_KEY=NotRequired
188+
AUTOGEN_MODEL_BASE_URL=http://0.0.0.0:400
189+
```
190+
191+
158192
## TODO
159193

160194
- Action verification - Responding from every skill with changes that took place in the DOM (Mutation Observers) so that the LLM can judge whether the skill did execute properly or not
@@ -173,7 +207,7 @@ html_theme = 'sphinx_rtd_theme'
173207
174208
## Social:
175209
176-
[Discord](https://discord.gg/czHhPDMk)
210+
[Discord](https://discord.gg/wgNfmFuqJF)
177211
178212
## Contributing
179213

ae/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
from ae import core
1+
from ae import core # type: ignore # noqa: F401

ae/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323

2424
if not os.path.exists(PROJECT_TEMP_PATH):
2525
os.makedirs(PROJECT_TEMP_PATH)
26-
print(f"Created temp folder at: {PROJECT_TEMP_PATH}")
26+
print(f"Created temp folder at: {PROJECT_TEMP_PATH}")

ae/core/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
from ae.core import agents
22
from ae.core import memory
33
from ae.core import skills
4-
54
from ae.core.autogen_wrapper import AutogenWrapper
65
from ae.core.playwright_manager import PlaywrightManager
7-
from ae.core.post_process_responses import final_reply_callback_browser_agent
86
from ae.core.post_process_responses import final_reply_callback_user_proxy
97
from ae.core.prompts import LLM_PROMPTS
108
from ae.core.system_orchestrator import SystemOrchestrator

ae/core/agents/browser_nav_agent.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,23 @@
22
from string import Template
33

44
import autogen # type: ignore
5-
from autogen.agentchat.conversable_agent import register_function # type: ignore
65

76
from ae.core.memory.static_ltm import get_user_ltm
8-
from ae.core.post_process_responses import final_reply_callback_browser_agent as print_message_from_user_proxy # type: ignore
9-
from ae.core.post_process_responses import final_reply_callback_user_proxy as print_message_from_browser_agent # type: ignore
107
from ae.core.prompts import LLM_PROMPTS
118
from ae.core.skills.click_using_selector import click as click_element
9+
10+
# from ae.core.skills.enter_text_and_click import enter_text_and_click
1211
from ae.core.skills.enter_text_using_selector import bulk_enter_text
13-
from ae.core.skills.enter_text_and_click import enter_text_and_click
14-
from ae.core.skills.pdf_text_extractor import extract_text_from_pdf
1512
from ae.core.skills.enter_text_using_selector import entertext
1613
from ae.core.skills.get_dom_with_content_type import get_dom_with_content_type
1714
from ae.core.skills.get_url import geturl
1815
from ae.core.skills.open_url import openurl
16+
from ae.core.skills.pdf_text_extractor import extract_text_from_pdf
17+
1918
#from ae.core.skills.pdf_text_extractor import extract_text_from_pdf
2019
from ae.core.skills.press_key_combination import press_key_combination
2120

2221

23-
2422
class BrowserNavAgent:
2523
def __init__(self, config_list, browser_nav_executor: autogen.UserProxyAgent): # type: ignore
2624
"""
@@ -45,7 +43,9 @@ def __init__(self, config_list, browser_nav_executor: autogen.UserProxyAgent): #
4543
llm_config={
4644
"config_list": config_list,
4745
"cache_seed": None,
48-
"temperature": 0.0
46+
"temperature": 0.0,
47+
"top_p": 0.001,
48+
"seed":12345
4949
},
5050
)
5151
self.__register_skills()
@@ -70,9 +70,9 @@ def __register_skills(self):
7070
self.browser_nav_executor.register_for_execution()(openurl)
7171

7272
# Register enter_text_and_click skill for LLM by assistant agent
73-
self.agent.register_for_llm(description=LLM_PROMPTS["ENTER_TEXT_AND_CLICK_PROMPT"])(enter_text_and_click)
73+
# self.agent.register_for_llm(description=LLM_PROMPTS["ENTER_TEXT_AND_CLICK_PROMPT"])(enter_text_and_click)
7474
# Register enter_text_and_click skill for execution by user_proxy_agent
75-
self.browser_nav_executor.register_for_execution()(enter_text_and_click)
75+
# self.browser_nav_executor.register_for_execution()(enter_text_and_click)
7676

7777
# Register get_dom_with_content_type skill for LLM by assistant agent
7878
self.agent.register_for_llm(description=LLM_PROMPTS["GET_DOM_WITH_CONTENT_TYPE_PROMPT"])(get_dom_with_content_type)
@@ -120,5 +120,5 @@ def __register_skills(self):
120120
config={"callback": None},
121121
)
122122
'''
123-
print(f">>> Function map: {self.browser_nav_executor.function_map}") # type: ignore
124-
print(">>> Registered skills for BrowserNavAgent and BrowserNavExecutorAgent")
123+
# print(f">>> Function map: {self.browser_nav_executor.function_map}") # type: ignore
124+
# print(">>> Registered skills for BrowserNavAgent and BrowserNavExecutorAgent")

ae/core/agents/high_level_planner_agent.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1+
from datetime import datetime
12
from string import Template
2-
from ae.core.post_process_responses import final_reply_callback_planner_agent as print_message_as_planner # type: ignore
3+
34
import autogen # type: ignore
5+
from autogen import ConversableAgent # type: ignore
6+
47
from ae.core.memory.static_ltm import get_user_ltm
5-
from ae.core.skills.get_user_input import get_user_input
8+
from ae.core.post_process_responses import final_reply_callback_planner_agent as print_message_as_planner # type: ignore
69
from ae.core.prompts import LLM_PROMPTS
7-
from datetime import datetime
8-
from autogen import Agent # type: ignore
9-
from autogen import ConversableAgent # type: ignore
10-
from autogen import OpenAIWrapper # type: ignore
10+
from ae.core.skills.get_user_input import get_user_input
11+
12+
1113
class PlannerAgent:
1214
def __init__(self, config_list, user_proxy_agent:ConversableAgent): # type: ignore
1315
"""
@@ -21,7 +23,7 @@ def __init__(self, config_list, user_proxy_agent:ConversableAgent): # type: igno
2123

2224
user_ltm = self.__get_ltm()
2325
system_message = LLM_PROMPTS["PLANNER_AGENT_PROMPT"]
24-
print(f">>> Planner system_message: {system_message}")
26+
2527
if user_ltm: #add the user LTM to the system prompt if it exists
2628
user_ltm = "\n" + user_ltm
2729
system_message = Template(system_message).substitute(basic_user_information=user_ltm)
@@ -32,7 +34,9 @@ def __init__(self, config_list, user_proxy_agent:ConversableAgent): # type: igno
3234
llm_config={
3335
"config_list": config_list,
3436
"cache_seed": None,
35-
"temperature": 0.0
37+
"temperature": 0.0,
38+
"top_p": 0.001,
39+
"seed":12345
3640
},
3741
)
3842

0 commit comments

Comments
 (0)