parent
4b12ecae7b
commit
7febc47960
@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
# Basic Usage Guide
|
||||||
|
|
||||||
|
## Getting Started
|
||||||
|
|
||||||
|
This guide demonstrates how to use the basic features of the Swarms framework.
|
||||||
|
|
||||||
|
### Basic Agent Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from swarms.structs.agent import Agent
|
||||||
|
|
||||||
|
# Initialize agent
|
||||||
|
agent = Agent(
|
||||||
|
agent_name="Basic-Example-Agent",
|
||||||
|
agent_description="A simple example agent",
|
||||||
|
system_prompt="You are a helpful assistant.",
|
||||||
|
model_name="gpt-4",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Run the agent
|
||||||
|
response = agent.run("What is 2+2?")
|
||||||
|
print(f"Agent response: {response}")
|
||||||
|
```
|
@ -0,0 +1,18 @@
|
|||||||
|
|
||||||
|
from swarms.structs.agent import Agent
|
||||||
|
|
||||||
|
def main():
|
||||||
|
# Initialize basic agent
|
||||||
|
agent = Agent(
|
||||||
|
agent_name="Basic-Example-Agent",
|
||||||
|
agent_description="A simple example agent",
|
||||||
|
system_prompt="You are a helpful assistant.",
|
||||||
|
model_name="gpt-4",
|
||||||
|
)
|
||||||
|
|
||||||
|
# Run the agent
|
||||||
|
response = agent.run("What is 2+2?")
|
||||||
|
print(f"Agent response: {response}")
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
import unittest
|
||||||
|
from swarms.structs.agent import Agent
|
||||||
|
|
||||||
|
class TestBasicExample(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.agent = Agent(
|
||||||
|
agent_name="Test-Agent",
|
||||||
|
agent_description="A test agent",
|
||||||
|
system_prompt="You are a helpful assistant.",
|
||||||
|
model_name="gpt-4",
|
||||||
|
)
|
||||||
|
|
||||||
|
def test_agent_initialization(self):
|
||||||
|
self.assertEqual(self.agent.agent_name, "Test-Agent")
|
||||||
|
self.assertEqual(self.agent.agent_description, "A test agent")
|
||||||
|
|
||||||
|
def test_agent_run(self):
|
||||||
|
response = self.agent.run("What is 2+2?")
|
||||||
|
self.assertIsNotNone(response)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
unittest.main()
|
Loading…
Reference in new issue