Building Your Own AI News Digest: A Developer’s Tutorial A developer built a personalized AI news digest using Python, NewsAPI, and an LLM. The system fetches articles, filters them by relevance, and generates one-sentence summaries for a scannable daily digest. The tutorial covers code for fetching, filtering, and summarizing news, with options for local models to reduce cost. You’re a developer. You know AI is moving fast—new models, frameworks, papers, and tools drop daily. Trying to keep up by scanning Twitter, Reddit, and a dozen newsletters is a full-time job. What if you could build a personalized, automated AI news digest that pulls the stories you actually care about, summarizes them, and delivers them to your inbox or Slack? In this tutorial, I’ll show you how to build exactly that using Python, a few free APIs, and an LLM like GPT or a local model . No fluff, just code and a system you can deploy in an afternoon. We’ll use NewsAPI to query for articles with the keyword “AI”. You can also pull from arXiv, Hacker News, or RSS – but the API is the simplest. python import requests from datetime import datetime, timedelta NEWS API KEY = "your key here" def fetch ai news : url = "https://newsapi.org/v2/everything" params = { "q": "artificial intelligence OR machine learning OR LLM", "from": datetime.now - timedelta days=1 .strftime "%Y-%m-%d" , "sortBy": "popularity", "language": "en", "pageSize": 20, "apiKey": NEWS API KEY } response = requests.get url, params=params response.raise for status articles = response.json .get "articles", Deduplicate by title simple seen = set unique = for art in articles: if art "title" not in seen: seen.add art "title" unique.append art return unique Output: a list of dicts with title , description , url , source , and publishedAt . Not every article is worth your time. Let’s rank them using a simple keyword density check or, better, an embedding similarity to your interests. For a lightweight filter, use functools.lru cache to compute a “relevance score” from the title + description: KEYWORDS = "transformer", "GPT", "PyTorch", "fine-tuning", "RAG", "diffusion", "agent" def relevance score article : text = f"{article 'title' } {article.get 'description', '' }".lower return sum 1 for kw in KEYWORDS if kw in text Keep only top 10 most relevant def filter articles articles, top k=10 : scored = sorted articles, key=relevance score, reverse=True return a for a in scored if relevance score a 0 :top k Pro tip: For a more sophisticated filter, use sentence-transformers to compare article embeddings with your own interest vector. But that’s a whole separate post – keep it simple first. Now the fun part. We’ll send each article’s title and description to an LLM and ask for a one‑sentence summary. This makes your digest dense and scannable. python import openai openai.api key = "sk-..." def summarize article article : prompt = f""" Summarize the following AI news article in one clear, factual sentence. Focus on the key insight for a developer. Title: {article 'title' } Description: {article.get 'description', ' No description ' } Summary: """ response = openai.ChatCompletion.create model="gpt-3.5-turbo", messages= {"role": "user", "content": prompt} , temperature=0.3, max tokens=60 return response.choices 0 .message.content.strip Why this works: The LLM condenses the noise into the signal. Even a free model like gpt-3.5-turbo-0125 does a decent job for under $0.001 per article. Warning: For 10 articles, you’re looking at ~$0.01 per run. Use a local model e.g., Phi-3-mini via Ollama if you want zero cost and total privacy. I like Markdown – it’s clean, and I can drop it into an email or a GitHub Issue. Here’s a simple template: python def build digest md articles summaries : lines = " 🤖 AI News Digest", f" {datetime.now .strftime '%A, %B %d, %Y' } \n" for title, summary, url in articles summaries: lines.append f"- {title} " lines.append f" {summary}" lines.append f" Read more {url} \n" return "\n".join lines Example output: You have several options: smtplib with Gmail or SendGrid. I’ll show a simple email version: python import smtplib from email.mime.text import MIMEText def send email subject, body, to email="you@example.com" : msg = MIMEText body, "markdown" msg "Subject" = subject msg "From" = "digest-bot@example.com" msg "To" = to email with smtplib.SMTP "smtp.gmail.com", 587 as server: server.starttls server.login "your email", "app password" server.send message msg Use an app‑specific password for Gmail; never hardcode secrets – use environment variables. Create .github/workflows/digest.yml : yaml name: Daily AI Digest on: