Skip to content

Commit

Permalink
refactor: tweak the content generation
Browse files Browse the repository at this point in the history
  • Loading branch information
engineervix committed Dec 12, 2023
1 parent cad1019 commit c1b6237
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
14 changes: 13 additions & 1 deletion app/core/podcast/content.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,19 @@ async def create_transcript(news: list[dict[str, str]], dest: str, summarizer: C
# Add the article to the list for the corresponding source
articles_by_source[source].append(article)

prompt = f"<human>: You are {podcast_host}, an accomplished, fun and witty scriptwriter, content creator and podcast host. You have a news and current affairs podcast which runs Monday to Friday. Your secretary has gathered the news from various sources as indicated below, so go ahead and present today's episode. Add a fun and witty remark at the end, informing your audience that you are actually an AI, and not a human.\n\n"
prompt = f"<human>: You are {podcast_host}, an accomplished, fun and witty scriptwriter, content creator and podcast host. You have a news and current affairs podcast which runs Monday to Friday. Your secretary has gathered the news from various sources as indicated below. Study the content, then go ahead and present today's episode. It is important that you cover EVERYTHING, do not leave out anything. Feel free to consolidate any similar news items from different sources, and present the news in a logical sequence, based on common themes. At the end, add a fun and witty remark informing your audience that you are actually an AI, and not a human.\n\n"

metadata = f"Title: Zed News Podcast episode {await get_episode_number()}\nDate: {today_human_readable}\nHost: {podcast_host}\n\n"

unwanted_text = [
"Sure, here's a summary of the news entry in two sentences:",
"Sure, here's a summary of the news entry in not more than two sentences:",
"Sure, I can help you with that!",
"Here's a summary of the news entry in two sentences:",
"Here's a summary of the news entry in not more than two sentences:",
"Sure! Here's a possible summary of the news entry:",
]

content = ""
counter = 0
for source in articles_by_source:
Expand All @@ -78,6 +87,9 @@ async def create_transcript(news: list[dict[str, str]], dest: str, summarizer: C
text = article["content"]
summary = summarizer(text, title)

for text in unwanted_text:
summary = summary.replace(text, "")

await update_article_with_summary(title, article["url"], today, summary)

counter += 1
Expand Down
2 changes: 1 addition & 1 deletion app/core/summarization/backends/together.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def summarize(content: str, title: str) -> str:
https://docs.together.ai/reference/complete
"""

prompt = f"<human>: You are a distinguished news editor and content publisher, write a summary of the following news entry, in not more than two sentences. Your summary should be sweet, informative and engaging.\n\n {content}\n<bot>:"
prompt = f"<human>: You are a distinguished news editor and content publisher, summarize the following news entry, in not more than two sentences. Your summary should be sweet, informative and engaging.\n\n {content}\n<bot>:"
model = "togethercomputer/llama-2-70b-chat"
temperature = 0.7
max_tokens = 512
Expand Down
2 changes: 1 addition & 1 deletion social.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def create_facebook_post(content: str) -> str:
https://docs.together.ai/reference/complete
"""

prompt = f"<human>: You are a social media marketing guru. You have been hired by a podcaster to create a nice facebook post (max 130 words) inviting people to listen to today's podcast whose transcript is below. Highlight some interesting news items, appropriately paraphrasing them to grab the attention of your audience. Also, appropriately utilize bullet points, emojis, whitespace and hashtags where necessary. Do not add the link to the podcast as it will be added automatically.\n\n```{content}\n```\n<bot>:"
prompt = f"<human>: You are a social media marketing guru. You have been hired by a podcaster to create a nice, short and catchy facebook post (max 130 words) inviting people to listen to today's podcast whose transcript is below. Highlight some interesting news items, appropriately paraphrasing them to grab the attention of your audience. Also, appropriately utilize bullet points, emojis, whitespace and hashtags where necessary. Do not add the link to the podcast as it will be added automatically.\n\n```{content}\n```\n<bot>:"
model = "togethercomputer/llama-2-70b-chat"
temperature = 0.7
max_tokens = 768
Expand Down

0 comments on commit c1b6237

Please sign in to comment.