Skip to main content

A new package that processes text-based news or announcement summaries, such as changes in chart inclusion rules for platforms like YouTube on the U.S. Billboard Charts. It uses structured LLM interac

Project description

newspresso

PyPI version License: MIT Downloads LinkedIn

A Python package for processing text-based news or announcement summaries using structured LLM interactions. It extracts key details—such as effective dates, criteria adjustments, and impacted metrics—from text inputs, ensuring consistent and reliable output for media analysis or reporting workflows.

Installation

Install the package via pip:

pip install newspresso

Usage

Import the newspresso function and pass your text to process:

from newspresso import newspresso

user_input = "Your news or announcement text here..."
result = newspresso(user_input)
print(result)

Parameters

  • user_input (str): The text input to process (e.g., news summary or announcement).
  • llm (Optional[BaseChatModel]): A LangChain LLM instance. If not provided, the default ChatLLM7 is used.
  • api_key (Optional[str]): API key for LLM7. If not provided, the environment variable LLM7_API_KEY is used, or a default key is attempted.

Using a Custom LLM

You can use any LangChain-compatible LLM by passing it to the llm parameter. For example:

Using OpenAI

from langchain_openai import ChatOpenAI
from newspresso import newspresso

llm = ChatOpenAI()
response = newspresso(user_input, llm=llm)

Using Anthropic

from langchain_anthropic import ChatAnthropic
from newspresso import newspresso

llm = ChatAnthropic()
response = newspresso(user_input, llm=llm)

Using Google

from langchain_google_genai import ChatGoogleGenerativeAI
from newspresso import newspresso

llm = ChatGoogleGenerativeAI()
response = newspresso(user_input, llm=llm)

API Key for Default LLM7

The default LLM (ChatLLM7) is provided via the langchain_llm7 package (see PyPI). The free tier rate limits are sufficient for most use cases. For higher limits, provide your own API key:

  • Set the environment variable: LLM7_API_KEY="your_api_key"
  • Or pass directly: newspresso(user_input, api_key="your_api_key")

Get a free API key by registering at https://token.llm7.io/.

Example

from newspresso import newspresso

news_text = """
YouTube announced changes to its chart inclusion rules effective January 2025. 
Streams will now require a minimum of 1,000 plays per track, up from 500. 
These updates impact the U.S. Billboard Charts and global metrics.
"""

details = newspresso(news_text)
print(details)
# Output may include: ['effective_date: January 2025', 'criteria_adjustment: minimum streams increased to 1000', ...]

Dependencies

  • langchain_core
  • langchain_llm7 (for default LLM)
  • llmatch_messages (for pattern matching)

Issues

Report issues or contribute via GitHub: https://github.com/chigwell/newspresso

Author

Eugene Evstafev – hi@euegne.plus

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

newspresso-2025.12.21175020.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.

newspresso-2025.12.21175020-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file newspresso-2025.12.21175020.tar.gz.

File metadata

  • Download URL: newspresso-2025.12.21175020.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for newspresso-2025.12.21175020.tar.gz
Algorithm Hash digest
SHA256 2494aa70a2ef96c66a3fc25aa15f273b7c7ec45df3d47336930dc9a31008e89b
MD5 1c35250d09174b17a94d0e901f571586
BLAKE2b-256 c029eb1441b83d4db96588e57723d11b0fd5eae68f0bec13946cbf7188cc056a

See more details on using hashes here.

File details

Details for the file newspresso-2025.12.21175020-py3-none-any.whl.

File metadata

File hashes

Hashes for newspresso-2025.12.21175020-py3-none-any.whl
Algorithm Hash digest
SHA256 3558e04bb4fbda073cef4379010f939b9daf8428e0b5eb75091c5ab0da8409f5
MD5 dbd8fa14b2821bc6e05c83ee6473d3ab
BLAKE2b-256 32f231ebc1bdf95c50e186bd77424d3d0f28bb2cfdd42eff2478c2da90292d49

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