A new package that processes news headlines or short text snippets to generate structured summaries of current events. It uses an LLM to extract key entities, topics, and sentiment, ensuring the outpu
Project description
Headline Parser
A package to process news headlines or short text snippets, extracting key entities, topics, and sentiment, and outputting structured summaries in a consistent format.
Installation
pip install headline_parser
Overview
This package uses a large language model (LLM) to process input text and generate structured summaries of current events. It's suitable for:
- News aggregation
- Content moderation analysis
- Tracking public discourse on free speech and regulatory issues
- Applications not requiring raw media files
Example usage
from headline_parser import headline_parser
response = headline_parser(
user_input="Us Democrats pass a health care reform bill.",
)
print(response)
The headline_parser function can take in optional arguments:
llm: an instance oflangchain_core.language_models.BaseChatModel, which defaults tolangchain_llm7.ChatLLM7api_key: an optional API key for LLM7, which defaults to theLLM7_API_KEYenvironment variable
You can pass your own LLM instance from other providers:
# Using OpenAI
from langchain_openai import ChatOpenAI
from headline_parser import headline_parser
llm = ChatOpenAI()
response = headline_parser("Your news headline", llm=llm)
print(response)
# Using Anthropic
from langchain_anthropic import ChatAnthropic
from headline_parser import headline_parser
llm = ChatAnthropic()
response = headline_parser("Your news headline", llm=llm)
print(response)
# Using Google
from langchain_google_genai import ChatGoogleGenerativeAI
from headline_parser import headline_parser
llm = ChatGoogleGenerativeAI()
response = headline_parser("Your news headline", llm=llm)
print(response)
For higher rate limits with LLM7, you can obtain a free API key by registering at https://token.llm7.io/ and pass it either as an environment variable or directly to the function:
from headline_parser import headline_parser
# Via environment variable
os.environ["LLM7_API_KEY"] = "your_api_key"
# Or directly
response = headline_parser("Your news headline", api_key="your_api_key")
print(response)
Contributing
Found an issue or have a feature request? Please report them on GitHub.
Author
Eugene Evstafev (hi@eugene.plus)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file headline_parser-2025.12.21175317.tar.gz.
File metadata
- Download URL: headline_parser-2025.12.21175317.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
387716232fb85046ff0115a9632ea84ed59d9a3d6ec159d1ec3b86f719077a07
|
|
| MD5 |
63cac63c448fd9a8e663d3185fae4fe0
|
|
| BLAKE2b-256 |
386daba79866aebff3767c574bbbbdef3e7cdf46c81252dc9c20ef433caa87e3
|
File details
Details for the file headline_parser-2025.12.21175317-py3-none-any.whl.
File metadata
- Download URL: headline_parser-2025.12.21175317-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
631fb42bb7e5b748a6417a9d9a10d44d7796608de99a235dea912452cfa3abe4
|
|
| MD5 |
6eea918a4d2c816764b21c44f9bdc92d
|
|
| BLAKE2b-256 |
af5c6ca4febf44aad3283eb6588d5c37ac8ddd37be76f5f55e2efbb748acdbd4
|