From 7554fbd0cd7d572dd21ee2f322ce09c5f3599794 Mon Sep 17 00:00:00 2001 From: pliny <133052465+elder-plinius@users.noreply.github.com> Date: Sun, 19 Nov 2023 12:22:27 -0800 Subject: [PATCH] Create blog_gen_example.py --- blog_gen_example.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 blog_gen_example.py diff --git a/blog_gen_example.py b/blog_gen_example.py new file mode 100644 index 00000000..7cf95535 --- /dev/null +++ b/blog_gen_example.py @@ -0,0 +1,23 @@ +import os +from swarms.swarms.blog_gen import BlogGen + + +def main(): + api_key = os.getenv("OPENAI_API_KEY") + if not api_key: + raise ValueError("OPENAI_API_KEY environment variable not set.") + + blog_topic = input("Enter the topic for the blog generation: ") + + blog_generator = BlogGen(api_key, blog_topic) + blog_generator.TOPIC_SELECTION_SYSTEM_PROMPT = ( + blog_generator.TOPIC_SELECTION_SYSTEM_PROMPT.replace( + "{{BLOG_TOPIC}}", blog_topic + ) + ) + + blog_generator.run_workflow() + + +if __name__ == "__main__": + main()