You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
440 B
18 lines
440 B
import os
|
|
from swarms.models import OpenAIChat
|
|
from swarms.structs.flow import Flow, stop_when_repeats
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
|
|
# Initialize the OpenAIChat model
|
|
openai_api_key = os.getenv("OPENAI_API_KEY")
|
|
llm = OpenAIChat(openai_api_key=openai_api_key)
|
|
|
|
# Initialize the Flow
|
|
flow = Flow(llm=llm, max_loops=3, stopping_condition=stop_when_repeats)
|
|
|
|
# Run the Flow with a task
|
|
response = flow.run("")
|
|
print(response)
|