clean up of example

Former-commit-id: 7bb3f99bf3
pull/47/head
Kye 1 year ago
parent 8508c142a7
commit 5701453372

@ -154,7 +154,7 @@ print(huggingface.generate(prompt))
```python
# Import the necessary classes
from swarms import Anthropic, HuggingFaceLLM
from swarms.models import Anthropic, HuggingFaceLLM
# Create an instance of the Anthropic class

@ -1,4 +1,4 @@
# Introduction to Agents in Swarms
Introduction to Agents in Swarms
================================
Welcome to the revolutionary world of Agents in Swarms. If you're familiar with my philosophy from the Linux world, you'll know that I'm a big believer in simplicity, modularity, and the power of open collaboration. The same principles apply here.
@ -13,7 +13,7 @@ That's it. That's as simple as it can get.
Why does this work? Because each component has a specific, well-defined role. The Language Model is the driving force, generating text based on a given prompt. The Long Term Memory stores information that the agent can draw upon to make its output more coherent and contextually relevant. The Tools provide additional capabilities, such as the ability to parse text, search the web, or interact with APIs.
But the real beauty of this system is not just in the individual components, but in how they work together. The Language Model, Long Term Memory, and Tools are not isolated silos, but interconnected parts of a whole. The output of one becomes the input of another, creating a feedback loop of continuous learning and improvement.
But the real beauty of this system is not just in the individual components, but in how they work together. The output of one becomes the input of another, creating a feedback loop of continuous learning and improvement.
And the best part? Our Agent classes are designed to be as simple as humanely possible. They are plug-and-play with any of our language model classes, vector stores, and tools. This means you can easily swap out one component for another, allowing for endless customization and flexibility.
@ -29,6 +29,48 @@ The file structure is equally straightforward:
Each directory contains different components of the swarm. The `models` directory contains the language models, the `memory` directory contains the long-term memory, the `tools` directory contains the tools, the `utils` directory contains various utility functions.
Let's see how simple it is to use these components with some examples:
```
# Import the necessary classes
from swarms.models import Anthropic, HuggingFaceLLM
# Create an instance of the Anthropic class
anthropic = Anthropic(model="claude-2", max_tokens_to_sample=100, temperature=0.8)
# Use the Anthropic instance to generate text
prompt = "Once upon a time"
stop = ["The end"]
print("Anthropic output:")
print(anthropic.generate(prompt, stop))
# Create an instance of the HuggingFaceLLM class
huggingface = HuggingFaceLLM(model_id="gpt2", device="cpu", max_length=50)
# Use the HuggingFaceLLM instance to generate text
prompt = "Once upon a time"
print("\nHuggingFaceLLM output:")
print(huggingface.generate(prompt))
```
Copy code
And to build an agent:
```
from swarms.agents import vectorstore, tool, Agent
# Create an instance of the Agent class
agent = Agent(
llm=HuggingFaceLLM,
memory=vectorstore,
tools=tool,
)
```
Copy code
In conclusion, the Agents in Swarms represent a new way of thinking about AI. They are simple, modular, and highly customizable, allowing you to create powerful AI systems that are more than the sum of their parts. And as always, we're just getting started. There's always room for improvement, for simplification, for making things even better. That's the spirit of open collaboration. That's the spirit of Swarms.
Thanks for becoming an alpha build user, email kye@apac.ai with all complaints
Thanks for becoming an alpha build user, email kye@apac.ai with all complaints

@ -2,9 +2,12 @@
#models
from swarms.agents.models.anthropic import Anthropic
from swarms.agents.models.huggingface import HuggingFaceLLM
from swarms.agents.models.palm import GooglePalm
from swarms.agents.models.petals import Petals
###########
#tools
from swarms.agents.tools.base import BaseTool, Tool, StructuredTool, ToolWrapper, BaseToolSet, ToolCreator, GlobalToolsCreator, SessionToolsCreator, ToolsFactory
from swarms.agents.tools.autogpt import pushd, process_csv, async_load_playwright, run_async, browse_web_page, WebpageQATool, web_search, query_website_tool
@ -14,4 +17,5 @@ from swarms.agents.tools.models import MaskFormer, ImageEditing, InstructPix2Pix
from swarms.agents.tools.file_mangagement import read_tool, write_tool, list_tool
from swarms.agents.tools.requests import RequestsGet
from swarms.agents.tools.developer import Terminal, CodeEditor
from swarms.agents.tools.developer import Terminal, CodeEditor

Loading…
Cancel
Save