From 89dffeb46c8ceb4801eb472254a5aa17e2189cb6 Mon Sep 17 00:00:00 2001 From: Kye Date: Sat, 4 Nov 2023 16:20:51 -0400 Subject: [PATCH] flow -> example.py Former-commit-id: 2f31a6349419f122ad36e47516e185ca19bbdc6d --- example.py | 35 +++++++++++++++++++++++------------ flow.py | 34 ---------------------------------- 2 files changed, 23 insertions(+), 46 deletions(-) delete mode 100644 flow.py diff --git a/example.py b/example.py index e9dfac18..eb750eb7 100644 --- a/example.py +++ b/example.py @@ -1,24 +1,35 @@ from swarms.models import OpenAIChat -from swarms import Worker -from swarms.prompts import PRODUCT_AGENT_PROMPT +from swarms.structs import Flow api_key = "" +# Initialize the language model, this model can be swapped out with Anthropic, ETC, Huggingface Models like Mistral, ETC llm = OpenAIChat( + # model_name="gpt-4" openai_api_key=api_key, temperature=0.5, + #max_tokens=100, ) -node = Worker( +## Initialize the workflow +flow = Flow( llm=llm, - ai_name="Optimus Prime", - openai_api_key=api_key, - ai_role=PRODUCT_AGENT_PROMPT, - external_tools=None, - human_in_the_loop=False, - temperature=0.5, + max_loops=1, + dashboard=True, + # stopping_condition=None, # You can define a stopping condition as needed. + # loop_interval=1, + # retry_attempts=3, + # retry_interval=1, + # interactive=False, # Set to 'True' for interactive mode. + # dynamic_temperature=False, # Set to 'True' for dynamic temperature handling. ) -task = "Locate 5 trending topics on healthy living, locate a website like NYTimes, and then generate an image of people doing those topics." -response = node.run(task) -print(response) +# out = flow.load_state("flow_state.json") +# temp = flow.dynamic_temperature() +# filter = flow.add_response_filter("Trump") +out = flow.run("Generate a 10,000 word blog on health and wellness.") +# out = flow.validate_response(out) +# out = flow.analyze_feedback(out) +# out = flow.print_history_and_memory() +# out = flow.save_state("flow_state.json") +print(out) diff --git a/flow.py b/flow.py deleted file mode 100644 index ed402a92..00000000 --- a/flow.py +++ /dev/null @@ -1,34 +0,0 @@ -from swarms.models import OpenAIChat -from swarms.structs import Flow - -api_key = "" - -# Initialize the language model, this model can be swapped out with Anthropic, ETC, Huggingface Models like Mistral, ETC -llm = OpenAIChat( - openai_api_key=api_key, - temperature=0.5, - max_tokens=3000, -) - -## Initialize the workflow -flow = Flow( - llm=llm, - max_loops=1, - dashboard=True, - # stopping_condition=None, # You can define a stopping condition as needed. - # loop_interval=1, - # retry_attempts=3, - # retry_interval=1, - # interactive=False, # Set to 'True' for interactive mode. - # dynamic_temperature=False, # Set to 'True' for dynamic temperature handling. -) - -# out = flow.load_state("flow_state.json") -# temp = flow.dynamic_temperature() -# filter = flow.add_response_filter("Trump") -out = flow.run("Generate a 10,000 word blog on health and wellness.") -# out = flow.validate_response(out) -# out = flow.analyze_feedback(out) -# out = flow.print_history_and_memory() -# out = flow.save_state("flow_state.json") -print(out)