Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kyegomez authored Aug 21, 2024
1 parent b7324a3 commit 869ee3a
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,10 @@ agent.run(
An LLM equipped with long term memory and tools, a full stack agent capable of automating all and any digital tasks given a good prompt.

```python
import logging
from dotenv import load_dotenv
from swarms import Agent, OpenAIChat
from swarms_memory import ChromaDB
import subprocess
import os

# Making an instance of the ChromaDB class
memory = ChromaDB(
Expand All @@ -193,6 +192,14 @@ memory = ChromaDB(
docs_folder="docs",
)

# Model
model = OpenAIChat(
api_key=os.getenv("OPENAI_API_KEY"),
model_name="gpt-4o-mini",
temperature=0.1,
)


# Tools in swarms are simple python functions and docstrings
def terminal(
code: str,
Expand All @@ -211,6 +218,7 @@ def terminal(
).stdout
return str(out)


def browser(query: str):
"""
Search the query in the browser with the `browser` tool.
Expand All @@ -227,6 +235,7 @@ def browser(query: str):
webbrowser.open(url)
return f"Searching for {query} in the browser."


def create_file(file_path: str, content: str):
"""
Create a file using the file editor tool.
Expand All @@ -242,6 +251,7 @@ def create_file(file_path: str, content: str):
file.write(content)
return f"File {file_path} created successfully."


def file_editor(file_path: str, mode: str, content: str):
"""
Edit a file using the file editor tool.
Expand All @@ -267,7 +277,7 @@ agent = Agent(
" agents. Be Helpful and Kind. Use the tools provided to"
" assist the user. Return all code in markdown format."
),
llm=llm,
llm=model,
max_loops="auto",
autosave=True,
dashboard=False,
Expand All @@ -281,7 +291,9 @@ agent = Agent(
)

# Run the agent
out = agent("Create a new file for a plan to take over the world.")
out = agent(
"Create a CSV file with the latest tax rates for C corporations in the following ten states and the District of Columbia: Alabama, California, Florida, Georgia, Illinois, New York, North Carolina, Ohio, Texas, and Washington."
)
print(out)

```
Expand Down

0 comments on commit 869ee3a

Please sign in to comment.