Update README.md

pull/571/merge
Kye Gomez 5 months ago committed by GitHub
parent b7324a33e7
commit 869ee3ae87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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. 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 ```python
import logging
from dotenv import load_dotenv
from swarms import Agent, OpenAIChat from swarms import Agent, OpenAIChat
from swarms_memory import ChromaDB from swarms_memory import ChromaDB
import subprocess import subprocess
import os
# Making an instance of the ChromaDB class # Making an instance of the ChromaDB class
memory = ChromaDB( memory = ChromaDB(
@ -193,6 +192,14 @@ memory = ChromaDB(
docs_folder="docs", 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 # Tools in swarms are simple python functions and docstrings
def terminal( def terminal(
code: str, code: str,
@ -211,6 +218,7 @@ def terminal(
).stdout ).stdout
return str(out) return str(out)
def browser(query: str): def browser(query: str):
""" """
Search the query in the browser with the `browser` tool. Search the query in the browser with the `browser` tool.
@ -227,6 +235,7 @@ def browser(query: str):
webbrowser.open(url) webbrowser.open(url)
return f"Searching for {query} in the browser." return f"Searching for {query} in the browser."
def create_file(file_path: str, content: str): def create_file(file_path: str, content: str):
""" """
Create a file using the file editor tool. Create a file using the file editor tool.
@ -242,6 +251,7 @@ def create_file(file_path: str, content: str):
file.write(content) file.write(content)
return f"File {file_path} created successfully." return f"File {file_path} created successfully."
def file_editor(file_path: str, mode: str, content: str): def file_editor(file_path: str, mode: str, content: str):
""" """
Edit a file using the file editor tool. Edit a file using the file editor tool.
@ -267,7 +277,7 @@ agent = Agent(
" agents. Be Helpful and Kind. Use the tools provided to" " agents. Be Helpful and Kind. Use the tools provided to"
" assist the user. Return all code in markdown format." " assist the user. Return all code in markdown format."
), ),
llm=llm, llm=model,
max_loops="auto", max_loops="auto",
autosave=True, autosave=True,
dashboard=False, dashboard=False,
@ -281,7 +291,9 @@ agent = Agent(
) )
# Run the 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) print(out)
``` ```

Loading…
Cancel
Save