Skip to content

TRINITY-21/tldr

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📰 tldr

A URL/article summarizer CLI powered by Groq AI. Fetch any URL, extract the article, and get an AI-powered summary — all from your terminal.

Python Groq


Setup

1. Get a Groq API Key (Free)

Sign up at console.groq.com and create an API key. No credit card required.

2. Clone and Install

git clone https://github.com/TRINITY-21/tldr.git
cd tldr
pip install -r requirements.txt

3. Configure

cp .env.example .env

Open .env and add your API key:

GROQ_API_KEY=gsk_your_key_here

4. Run

python tldr.py <command> [options]

Commands

summarize <URL> — Summarize an Article

python tldr.py summarize "https://www.paulgraham.com/greatwork.html"
╭───────────────────────────────── 📄 Article ─────────────────────────────────╮
│ Title:   How to Do Great Work                                                │
│ Date:    2023-01-01                                                          │
│ Words:   11,822                                                              │
│ URL:     https://www.paulgraham.com/greatwork.html                           │
╰──────────────────────────────────────────────────────────────────────────────╯

🤖 Summarizing with llama-3.3-70b-versatile...

The article by Paul Graham discusses how to do great work, emphasizing the
importance of finding something you have natural aptitude for and deep interest
in, then working hard enough to reach the frontier of knowledge.

Options

Flag Description Default
--length brief/detailed Summary length brief
--bullets Key points as a bullet list off
--lang <language> Translate summary to another language none
--save <file> Save output to a markdown file none
--fast Use faster model (llama-3.1-8b) off

Examples

# Bullet-point key takeaways
python tldr.py summarize "https://example.com/article" --bullets

# Detailed 3-4 paragraph summary
python tldr.py summarize "https://example.com/article" --length detailed

# Summarize in Spanish
python tldr.py summarize "https://example.com/article" --lang spanish

# Save summary to markdown
python tldr.py summarize "https://example.com/article" --bullets --save summary.md

# Use faster model for quicker results
python tldr.py summarize "https://example.com/article" --fast

Bullet points output:

🤖 Summarizing with llama-3.3-70b-versatile...

• AI adoption in enterprise has doubled since 2024
• Open-source models now rival proprietary ones
• Key bottleneck has shifted from compute to data quality
• Regulation remains fragmented across regions
• Three emerging trends: agents, multimodal, on-device

ask <URL> "<question>" — Ask a Question About an Article

python tldr.py ask "https://en.wikipedia.org/wiki/Python_(programming_language)" "Who created Python and when?"
╭───────────────────────────────── 📄 Article ─────────────────────────────────╮
│ Title:   Python (programming language) - Wikipedia                           │
│ Date:    2001-10-29                                                          │
│ Words:   11,530                                                              │
│ URL:     https://en.wikipedia.org/wiki/Python_(programming_language)         │
╰──────────────────────────────────────────────────────────────────────────────╯

❓ Who created Python and when?

🤖 Answering with llama-3.3-70b-versatile...

Guido van Rossum created Python. He began working on Python in the late 1980s,
and the first version, Python 0.9.0, was released in 1991.

Options

Flag Description
--save <file> Save Q&A to markdown
--fast Use faster model

Pipe from stdin

# Pipe HTML from curl
curl -s https://example.com/article | python tldr.py summarize -

# Pipe a local file
cat article.html | python tldr.py summarize -

Tech Stack

Concern Tool
Language Python
CLI framework Click
Terminal styling Rich
Article extraction trafilatura
AI summarization Groq (Llama 3.3 70B / Llama 3.1 8B)
Env config python-dotenv

Project Structure

tldr/
├── tldr.py          # CLI entry point — commands and routing
├── extractor.py     # Article extraction (URL → clean text + metadata)
├── groq_client.py   # Groq API client (prompts, streaming, model selection)
├── display.py       # Rich-based terminal output (panels, streaming, errors)
├── .env             # Your API key (gitignored)
├── .env.example     # Template
├── .gitignore
└── requirements.txt

Models

Model Speed Quality Free Tier
llama-3.3-70b-versatile (default) Fast Best 1K req/day
llama-3.1-8b-instant (--fast) Fastest Good 14.4K req/day

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages