-
-
Notifications
You must be signed in to change notification settings - Fork 516
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kye
committed
Apr 2, 2024
1 parent
d8b42f0
commit 71f6aae
Showing
10 changed files
with
187 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Run pytest | ||
|
||
on: | ||
schedule: | ||
# This will run the job every day at a random minute past the hour | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pytest | ||
pip install swarms | ||
- name: Run tests | ||
run: pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
""" | ||
Plan -> act in a loop until observation is met | ||
# Tools | ||
- Terminal | ||
- Text Editor | ||
- Browser | ||
""" | ||
from swarms import Agent, OpenAIChat, tool | ||
import subprocess | ||
|
||
# Model | ||
llm = OpenAIChat() | ||
|
||
|
||
# Tools | ||
@tool | ||
def terminal( | ||
code: str, | ||
): | ||
""" | ||
Run code in the terminal. | ||
Args: | ||
code (str): The code to run in the terminal. | ||
Returns: | ||
str: The output of the code. | ||
""" | ||
out = subprocess.run( | ||
code, shell=True, capture_output=True, text=True | ||
).stdout | ||
return str(out) | ||
|
||
|
||
@tool | ||
def browser(query: str): | ||
""" | ||
Search the query in the browser. | ||
Args: | ||
query (str): The query to search in the browser. | ||
Returns: | ||
str: The search results. | ||
""" | ||
import webbrowser | ||
|
||
url = f"https://www.google.com/search?q={query}" | ||
webbrowser.open(url) | ||
return f"Searching for {query} in the browser." | ||
|
||
|
||
# Agent | ||
agent = Agent( | ||
agent_name="Devin", | ||
system_prompt=( | ||
"Autonomous agent that can interact with humans and other" | ||
" agents. Be Helpful and Kind. Use the tools provided to" | ||
" assist the user." | ||
), | ||
llm=llm, | ||
max_loops=4, | ||
autosave=True, | ||
dashboard=False, | ||
streaming_on=True, | ||
verbose=True, | ||
stopping_token="<DONE>", | ||
interactive=True, | ||
tools=[terminal, browser], | ||
# streaming=True, | ||
) | ||
|
||
# Run the agent | ||
out = agent("What is the weather today in palo alto?") | ||
print(out) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api" | |
|
||
[tool.poetry] | ||
name = "swarms" | ||
version = "4.7.1" | ||
version = "4.7.3" | ||
description = "Swarms - Pytorch" | ||
license = "MIT" | ||
authors = ["Kye Gomez <[email protected]>"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters