Skip to main content

A new package that processes news headlines or short text snippets to generate structured summaries. It takes a headline or brief news text as input and uses an LLM to extract key information such as

Project description

news-summerizer

PyPI version License: MIT Downloads LinkedIn

A lightweight Python package that turns concise news headlines or short snippets into structured summaries in a simple XML‑like format.
The output is well‑defined and machine‑readable, making the data usable for news aggregation, content tagging, or quick briefing generation.

Features

  • Extract key facts from a headline or short text: event, location, involved parties, significance.
  • Output is constrained by a regular expression so the result is always predictable.
  • Works with any LangChain BaseChatModel, falling back to the default LLM7 model.
  • Zero‑configuration: install once, drop into any project and call news_summerizer.

Installation

pip install news_summerizer

Quick Example

from news_summerizer import news_summerizer

user_input = (
    "Tesla's new Gigafactory in Austin expands production capacity for the Model 3 "
    "and the new Cybertruck, boosting U.S. manufacturing jobs."
)

summary = news_summerizer(user_input)
print(summary)
# [
#   "<summary>",
#   "  <event>Expanding production capacity</event>",
#   "  <location>Austin</location>",
#   "  <parties>Tesla, Model 3, Cybertruck</parties>",
#   "  <significance>Boosts U.S. manufacturing jobs</significance>",
#   "</summary>"
# ]

Parameters

Parameter Type Description
user_input str The headline or news snippet to process.
llm Optional[BaseChatModel] A LangChain chat model instance. If omitted, the package automatically creates a ChatLLM7 instance.
api_key Optional[str] LLM7 API key. If not supplied, the package looks for the LLM7_API_KEY environment variable, otherwise defaults to the free tier key ("None").

Custom LLMs

news_summerizer works with any LangChain model. Simply pass your own model instance:

OpenAI

from langchain_openai import ChatOpenAI
from news_summerizer import news_summerizer

llm = ChatOpenAI()
summary = news_summerizer(user_input, llm=llm)

Anthropic

from langchain_anthropic import ChatAnthropic
from news_summerizer import news_summerizer

llm = ChatAnthropic()
summary = news_summerizer(user_input, llm=llm)

Google Gemini

from langchain_google_genai import ChatGoogleGenerativeAI
from news_summerizer import news_summerizer

llm = ChatGoogleGenerativeAI()
summary = news_summerizer(user_input, llm=llm)

LLM7 API Key

The default free tier of LLM7 is usually sufficient. For higher rate limits:

  • Set the LLM7_API_KEY environment variable, or
  • Pass the key directly: news_summerizer(user_input, api_key="your_api_key")

Free API keys can be obtained by registering at https://token.llm7.io/.

Project Links


Author

Eugene Evstafev
📧 hi@euegne.plus
👤 LinkedIn


License: MIT
Version: 0.1.0 (check PyPI for the latest release)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

news_summerizer-2025.12.20202646.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

news_summerizer-2025.12.20202646-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file news_summerizer-2025.12.20202646.tar.gz.

File metadata

File hashes

Hashes for news_summerizer-2025.12.20202646.tar.gz
Algorithm Hash digest
SHA256 22a24d0744ef6a5561ba6077a770e45e6aae67527869cfbd3fa899c8991cd033
MD5 4e8dd93d90033a6eb0879a68acdd6070
BLAKE2b-256 69fd3ac578014f6b45351ec39f89870438c15959a868e83a8ee92c50b62d7017

See more details on using hashes here.

File details

Details for the file news_summerizer-2025.12.20202646-py3-none-any.whl.

File metadata

File hashes

Hashes for news_summerizer-2025.12.20202646-py3-none-any.whl
Algorithm Hash digest
SHA256 f944714b296ae983c15366b909513aceb6b21c21eaf91389233e43410f47e968
MD5 1c131912793f876924bcc75faeed4d22
BLAKE2b-256 d34641789fd43db72bcdf826584e94afbc73451abf6b8ad6f52579c223304601

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page