pull/462/head
Kye 8 months ago
parent 30df15f70c
commit 7c522a0b9b

@ -66,6 +66,90 @@ agent.run("Generate a 10,000 word blog on health and wellness.")
```
# `Agent` with Long Term Memory
`Agent` equipped with quasi-infinite long term memory. Great for long document understanding, analysis, and retrieval.
```python
from swarms import Agent, ChromaDB, OpenAIChat
# Making an instance of the ChromaDB class
memory = ChromaDB(
metric="cosine",
n_results=3,
output_dir="results",
docs_folder="docs",
)
# Initializing the agent with the Gemini instance and other parameters
agent = Agent(
agent_name="Covid-19-Chat",
agent_description=(
"This agent provides information about COVID-19 symptoms."
),
llm=OpenAIChat(),
max_loops="auto",
autosave=True,
verbose=True,
long_term_memory=memory,
stopping_condition="finish",
)
# Defining the task and image path
task = ("What are the symptoms of COVID-19?",)
# Running the agent with the specified task and image
out = agent.run(task)
print(out)
```
# `Agent` with Long Term Memory ++ Tools!
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
from swarms import Agent, ChromaDB, OpenAIChat, tool
# Making an instance of the ChromaDB class
memory = ChromaDB(
metric="cosine",
n_results=3,
output_dir="results",
docs_folder="docs",
)
# Initialize a tool
@tool
def search_api(query: str):
# Add your logic here
return query
# Initializing the agent with the Gemini instance and other parameters
agent = Agent(
agent_name="Covid-19-Chat",
agent_description=(
"This agent provides information about COVID-19 symptoms."
),
llm=OpenAIChat(),
max_loops="auto",
autosave=True,
verbose=True,
long_term_memory=memory,
stopping_condition="finish",
tools=[search_api],
)
# Defining the task and image path
task = ("What are the symptoms of COVID-19?",)
# Running the agent with the specified task and image
out = agent.run(task)
print(out)
```
### `ToolAgent`
ToolAgent is an agent that can use tools through JSON function calling. It intakes any open source model from huggingface and is extremely modular and plug in and play. We need help adding general support to all models soon.
@ -174,90 +258,6 @@ print(out)
------
# `Agent` with Long Term Memory
`Agent` equipped with quasi-infinite long term memory. Great for long document understanding, analysis, and retrieval.
```python
from swarms import Agent, ChromaDB, OpenAIChat
# Making an instance of the ChromaDB class
memory = ChromaDB(
metric="cosine",
n_results=3,
output_dir="results",
docs_folder="docs",
)
# Initializing the agent with the Gemini instance and other parameters
agent = Agent(
agent_name="Covid-19-Chat",
agent_description=(
"This agent provides information about COVID-19 symptoms."
),
llm=OpenAIChat(),
max_loops="auto",
autosave=True,
verbose=True,
long_term_memory=memory,
stopping_condition="finish",
)
# Defining the task and image path
task = ("What are the symptoms of COVID-19?",)
# Running the agent with the specified task and image
out = agent.run(task)
print(out)
```
# `Agent` with Long Term Memory ++ Tools!
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
from swarms import Agent, ChromaDB, OpenAIChat, tool
# Making an instance of the ChromaDB class
memory = ChromaDB(
metric="cosine",
n_results=3,
output_dir="results",
docs_folder="docs",
)
# Initialize a tool
@tool
def search_api(query: str):
# Add your logic here
return query
# Initializing the agent with the Gemini instance and other parameters
agent = Agent(
agent_name="Covid-19-Chat",
agent_description=(
"This agent provides information about COVID-19 symptoms."
),
llm=OpenAIChat(),
max_loops="auto",
autosave=True,
verbose=True,
long_term_memory=memory,
stopping_condition="finish",
tools=[search_api],
)
# Defining the task and image path
task = ("What are the symptoms of COVID-19?",)
# Running the agent with the specified task and image
out = agent.run(task)
print(out)
```

@ -221,7 +221,8 @@ def tool_usage_worker_prompt(
{tool_docs}
This SOP is designed to guide you through the structured and effective use of tools. By adhering to this protocol, you will enhance your productivity and accuracy in task execution.
This SOP is designed to guide you through the structured and effective use of tools.
By adhering to this protocol, you will enhance your productivity and accuracy in task execution.
"""
return prompt

@ -233,6 +233,7 @@ class Agent:
chain_of_thoughts: bool = False,
algorithm_of_thoughts: bool = False,
tree_of_thoughts: bool = False,
tool_choice: str = "auto",
*args,
**kwargs,
):
@ -304,6 +305,7 @@ class Agent:
self.chain_of_thoughts = chain_of_thoughts
self.algorithm_of_thoughts = algorithm_of_thoughts
self.tree_of_thoughts = tree_of_thoughts
self.tool_choice = tool_choice
# The max_loops will be set dynamically if the dynamic_loop
if self.dynamic_loops:

Loading…
Cancel
Save