|
|
|
@ -73,15 +73,17 @@ out = agent.run("Generate a 10,000 word blog on health and wellness.")
|
|
|
|
|
- Integrate Agent's with various LLMs and Multi-Modality Models
|
|
|
|
|
|
|
|
|
|
```python
|
|
|
|
|
from swarms.models import OpenAIChat, BioGPT, Anthropic
|
|
|
|
|
import os
|
|
|
|
|
from swarms.models import OpenAIChat
|
|
|
|
|
from swarms.structs import Agent
|
|
|
|
|
from swarms.structs.sequential_workflow import SequentialWorkflow
|
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
|
|
|
|
|
|
load_dotenv()
|
|
|
|
|
|
|
|
|
|
# Load the environment variables
|
|
|
|
|
api_key = os.getenv("OPENAI_API_KEY")
|
|
|
|
|
|
|
|
|
|
# Example usage
|
|
|
|
|
api_key = (
|
|
|
|
|
"" # Your actual API key here
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Initialize the language agent
|
|
|
|
|
llm = OpenAIChat(
|
|
|
|
@ -90,32 +92,28 @@ llm = OpenAIChat(
|
|
|
|
|
max_tokens=3000,
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
biochat = BioGPT()
|
|
|
|
|
|
|
|
|
|
# Use Anthropic
|
|
|
|
|
anthropic = Anthropic()
|
|
|
|
|
|
|
|
|
|
# Initialize the agent with the language agent
|
|
|
|
|
agent1 = Agent(llm=llm, max_loops=1, dashboard=False)
|
|
|
|
|
agent1 = Agent(llm=llm, max_loops=1)
|
|
|
|
|
|
|
|
|
|
# Create another agent for a different task
|
|
|
|
|
agent2 = Agent(llm=llm, max_loops=1, dashboard=False)
|
|
|
|
|
agent2 = Agent(llm=llm, max_loops=1)
|
|
|
|
|
|
|
|
|
|
# Create another agent for a different task
|
|
|
|
|
agent3 = Agent(llm=biochat, max_loops=1, dashboard=False)
|
|
|
|
|
|
|
|
|
|
# agent4 = Agent(llm=anthropic, max_loops="auto")
|
|
|
|
|
agent3 = Agent(llm=llm, max_loops=1)
|
|
|
|
|
|
|
|
|
|
# Create the workflow
|
|
|
|
|
workflow = SequentialWorkflow(max_loops=1)
|
|
|
|
|
|
|
|
|
|
# Add tasks to the workflow
|
|
|
|
|
workflow.add("Generate a 10,000 word blog on health and wellness.", agent1)
|
|
|
|
|
workflow.add(
|
|
|
|
|
agent1, "Generate a 10,000 word blog on health and wellness.",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Suppose the next task takes the output of the first task as input
|
|
|
|
|
workflow.add("Summarize the generated blog", agent2)
|
|
|
|
|
|
|
|
|
|
workflow.add("Create a references sheet of materials for the curriculm", agent3)
|
|
|
|
|
workflow.add(
|
|
|
|
|
agent2, "Summarize the generated blog",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Run the workflow
|
|
|
|
|
workflow.run()
|
|
|
|
@ -124,6 +122,7 @@ workflow.run()
|
|
|
|
|
for task in workflow.tasks:
|
|
|
|
|
print(f"Task: {task.description}, Result: {task.result}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
## `Multi Modal Autonomous Agents`
|
|
|
|
|