From 0933b5f616fd36a580293740db605fa0c77c3550 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 22 Jul 2025 10:07:14 +0200 Subject: [PATCH 1/5] feat: Ensure some more consistency in headlines --- prophet/infra/llm_groq.py | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/prophet/infra/llm_groq.py b/prophet/infra/llm_groq.py index 60dc29b..57bb6e7 100644 --- a/prophet/infra/llm_groq.py +++ b/prophet/infra/llm_groq.py @@ -41,7 +41,6 @@ class GroqClient(LLMClient): custom_prompt if custom_prompt else f""" - Political context: We are in the year 2025, Donald Trump is President of the United States again. There has been a crackdown on 'illegal' immigration, with controversial disappearings happening @@ -57,11 +56,14 @@ class GroqClient(LLMClient): Do not create a headline naming Trump if more than 2 of the previous headlines already do so and he is not specifically - referenced in the original headline. + referenced in the original headline. Ensure you do not repeat too + much wording from your previous headlines. - {"The previous 5 headlines you created are the following:\n- " if previous_titles else ""} + {"The previous 5 headlines you created were the following:\n- " if previous_titles else ""} {"\n- ".join(previous_titles) if previous_titles else ""} + When creating the new headline, try to stick close to the topic of + the original headline. """ ) suggestions = self.client.chat.completions.create( @@ -72,7 +74,7 @@ class GroqClient(LLMClient): }, { "role": "user", - "content": original_content, + "content": f"The headline to rewrite is the following: {original_content}", }, ], model="llama-3.3-70b-versatile", @@ -153,3 +155,20 @@ class GroqClient(LLMClient): raise ValueError print("Improved summary", summary_str) return summary_str.strip(" \"'") + + +if __name__ == "__main__": + from datetime import datetime + + cfg = AiConfig.from_env() + llm = GroqClient(cfg) + print( + llm.rewrite( + Original( + title="Obama Argues He Can’t Be Charged With Treason Since He Wasn’t Born In America", + summary="WASHINGTON, D.C. — In a blow to hopes from conservatives that the former president would face severe consequences for allegedly overseeing an attempt to deligitimize the Trump presidency, Barack Obama argued that he can't be charged with treason since he wasn't born in America and isn't a legitimate American citizen.", + link="", + date=datetime.now(), + ) + ) + ) From 678382b2f71383b493beee95bdc7a0eba647ae62 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Tue, 22 Jul 2025 10:34:07 +0200 Subject: [PATCH 2/5] docs: Update readme --- README.md | 14 ++++++++++++-- pyproject.toml | 4 ++-- templates/index.html | 6 +++--- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c4e2b39..71435f1 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,19 @@ -# Pollen Prophet +# The Bee's Knees + +When fact checking is optional, but irony is not. ## Ideas -- switch on-the-fly between original and improvements +- [x] switch on-the-fly between original and improvements - vote-mode for the best suggestion - when opening the article shows all suggestions made - user can vote for the best one and the one with the most votes becomes the new headline - associated image generation? + +## What is this? + +The Bee's knees is a running AI rewrite of the newest Babylon Bee headlines. +Some will be on point, some will be nonsensical, +but rest assured in the knowledge that all will at least be better than the original. + +You can switch back-and-forth between the original and the AI generated version with a button. diff --git a/pyproject.toml b/pyproject.toml index 50e5827..6b8d7e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] -name = "pollen-prophet" +name = "bees-knees" version = "0.1.0" -description = "Add your description here" +description = "Where fact checking is optional, but irony is not." readme = "README.md" requires-python = ">=3.13" dependencies = [ diff --git a/templates/index.html b/templates/index.html index 79f2a8a..f307ac9 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1,7 +1,7 @@ - The Pollen Prophet + The Bee's Knees