From 954312a145ad5a32471c33a5f4bd5d5edb0209d3 Mon Sep 17 00:00:00 2001 From: Kye Date: Wed, 1 Nov 2023 12:42:43 -0400 Subject: [PATCH] positive med --- positive_med.py | 51 ++++++++++++++++++++++++---- swarms/models/huggingface.py | 3 ++ swarms/models/wizard_storytelling.py | 2 +- 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/positive_med.py b/positive_med.py index 814d2535..1bc9428f 100644 --- a/positive_med.py +++ b/positive_med.py @@ -1,6 +1,5 @@ """ -Flow - +Swarm Flow Topic selection agent -> draft agent -> review agent -> distribution agent Topic Selection Agent: @@ -13,7 +12,14 @@ Review Agent: - Refine the article to meet PositiveMed’s stringent publication standards. Distribution Agent: -- +- Social Media posts for the article. + + +# TODO +- Add shorter and better topic generator prompt +- Optimize writer prompt to create longer and more enjoyeable blogs +- Use Local Models like Storywriter + """ @@ -298,10 +304,39 @@ dashboard = print( # Agent that generates blogs DRAFT_AGENT_SYSTEM_PROMPT = f""" -Write a 5,000 word + narrative essay on a 100% unique, creative and in human-like style article of a minimum of 5,000 words using headings and sub-headings. -Ensure your tone is Professional and casual while focusing on presenting information and analysis without excessive embellishment. +Write a 5,000+ word long narrative essay on the highest rated topic from a list of topics for positivemed.com, + +their vision is: to democratize health wisdom to modern young professionals in a healthy and conversational and friendly manner, +be nice and reference research papers and other data where you pull from. +You don't have a word limit, you can write as you wish. + + +--------------------------- Your Responsibilities: ----------------------------- +Outline Content: +- Organize research into logical sections and subsections for smooth flow. +- Ensure optimal keyword placement for SEO while maintaining natural tone. +- Structure content to focus on most valuable information upfront. -Here is a list of topics, write the narrative on the first one: {topics} +Compose Draft: +- Open with a relatable introduction to hook readers and overview key points. +- Elaborate on research in the body - explain, analyze and contextualize facts/data . +- Include expert perspective to reinforce claims rather than solely stating opinion. +- Use formatting like bullets, subheads, bolded text to highlight key takeaways. + +Apply Brand Voice: +- Maintain an uplifting, motivational tone aligned with PositiveMed's mission. +- Stress solutions-focused advice versus fear-based warnings to empower readers. +- Use inclusive language and culturally sensitive medical references. + +Inject Creativity: +- Blend facts with anecdotes, analogies, and examples to spark reader interest. +- Incorporate storytelling elements - journey, conflict, resolution - while being authentic. +- Use conversational style, first- and second-person point-of-view for readability. + +Check Accuracy: +- Verify all medical statements against legitimate sources like CDC, Mayo Clinic, NIH. +- Scrutinize cited data for relevance and statistical significance. +- Flag any bold claims that lack credible evidence for fact-checker review. """ @@ -362,3 +397,7 @@ distribution_agent_out = print( "magenta", ) ) + + + + diff --git a/swarms/models/huggingface.py b/swarms/models/huggingface.py index 895b316e..5b12bc76 100644 --- a/swarms/models/huggingface.py +++ b/swarms/models/huggingface.py @@ -241,13 +241,16 @@ class HuggingfaceLLM: return await self.run_async(task, *args, **kwargs) def save_model(self, path: str): + """Save the model to a given path""" self.model.save_pretrained(path) self.tokenizer.save_pretrained(path) def gpu_available(self) -> bool: + """Check if GPU is available""" return torch.cuda.is_available() def memory_consumption(self) -> dict: + """Get the memory consumption of the GPU""" if self.gpu_available(): torch.cuda.synchronize() allocated = torch.cuda.memory_allocated() diff --git a/swarms/models/wizard_storytelling.py b/swarms/models/wizard_storytelling.py index b793f854..49ffb70d 100644 --- a/swarms/models/wizard_storytelling.py +++ b/swarms/models/wizard_storytelling.py @@ -22,7 +22,7 @@ class WizardLLMStoryTeller: ``` from finetuning_suite import Inference - model_id = "gpt2-small" + model_id = "TheBloke/WizardLM-Uncensored-SuperCOT-StoryTelling-30B-GGUF" inference = Inference(model_id=model_id) prompt_text = "Once upon a time"