-
-
Notifications
You must be signed in to change notification settings - Fork 524
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Kye
committed
Dec 1, 2023
1 parent
3ae305e
commit a7a6d54
Showing
2 changed files
with
32 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
# Description: This is an example of how to use the Agent class to run a multi-modal workflow | ||
import os | ||
|
||
from dotenv import load_dotenv | ||
|
||
from swarms.models.gpt4_vision_api import GPT4VisionAPI | ||
from swarms.prompts.multi_modal_autonomous_instruction_prompt import ( | ||
MULTI_MODAL_AUTO_AGENT_SYSTEM_PROMPT_1, | ||
) | ||
from swarms.structs import Agent | ||
|
||
# Load the environment variables | ||
load_dotenv() | ||
|
||
# Get the API key from the environment | ||
api_key = os.environ.get("OPENAI_API_KEY") | ||
|
||
# Initialize the language model | ||
llm = GPT4VisionAPI( | ||
openai_api_key=api_key, | ||
max_tokens=500, | ||
) | ||
|
||
# Initialize the language model | ||
task = "What is the color of the object?" | ||
img = "images/swarms.jpeg" | ||
|
||
## Initialize the workflow | ||
agent = Agent( | ||
llm=llm, | ||
max_loops="auto", | ||
sop=MULTI_MODAL_AUTO_AGENT_SYSTEM_PROMPT_1, | ||
autosave=True, | ||
dashboard=True, | ||
multi_modal=True | ||
) | ||
|
||
# Run the workflow on a task | ||
out = agent.run(task=task, img=img) | ||
print(out) |