From 76a1d599350b4032a9be341e6b444101ea7191e0 Mon Sep 17 00:00:00 2001 From: pliny <133052465+elder-plinius@users.noreply.github.com> Date: Thu, 23 Nov 2023 11:11:20 -0800 Subject: [PATCH] Create blog_gen_example.py --- playground/demos/blog_gen/blog_gen_example.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 playground/demos/blog_gen/blog_gen_example.py diff --git a/playground/demos/blog_gen/blog_gen_example.py b/playground/demos/blog_gen/blog_gen_example.py new file mode 100644 index 00000000..7cf95535 --- /dev/null +++ b/playground/demos/blog_gen/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()