diff --git a/README.md b/README.md index 2ee2cdc7..01667647 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,36 @@ agent = OmniModalAgent(llm) agent.run("Create a video of a swarm of fish") +``` + + +### `Flow` Example +- The `Flow` is a superior iteratioin of the `LLMChain` from Langchain, our intent with `Flow` is to create the most reliable loop structure that gives the agents their "autonomy" through 3 main methods of interaction, one through user specified loops, then dynamic where the agent parses a token, and or an interactive human input verison, or a mix of all 3. +```python + +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, +) + +# Initialize the flow +flow = Flow( + llm=llm, + max_loops=5, +) + +out = flow.run("Generate a 10,000 word blog, say Stop when done") +print(out) + + ``` --- diff --git a/flow.py b/flow.py index b6b962b7..bbb91d64 100644 --- a/flow.py +++ b/flow.py @@ -9,19 +9,13 @@ api_key = "" llm = OpenAIChat( openai_api_key=api_key, temperature=0.5, - max_tokens=100, ) # Initialize the flow flow = Flow( llm=llm, max_loops=5, - # system_prompt=SYSTEM_PROMPT, - # retry_interval=1, ) out = flow.run("Generate a 10,000 word blog, say Stop when done") print(out) - -# # Now save the flow -# flow.save("flow.yaml")