Skip to main content

newsstructure

PyPI version License: MIT Downloads LinkedIn

A Python package that takes a news headline or short text snippet as input and returns a structured summary of the key event, actors, and context. It uses an LLM to generate the content and pattern matching to ensure the output follows a consistent format. Ideal for news aggregation, automated reporting, and content tagging.

Installation

pip install newsstructure

Usage

Basic Example

from newsstructure import newsstructure

user_input = "Apple announces new iPhone with advanced AI features"
result = newsstructure(user_input)
print(result)

Using a Custom LLM

You can pass your own LangChain-compatible LLM instance. For example, to use OpenAI:

from langchain_openai import ChatOpenAI
from newsstructure import newsstructure

llm = ChatOpenAI()
user_input = "Tesla stock surges after earnings report"
response = newsstructure(user_input, llm=llm)

To use Anthropic:

from langchain_anthropic import ChatAnthropic
from newsstructure import newsstructure

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

To use Google Generative AI:

from langchain_google_genai import ChatGoogleGenerativeAI
from newsstructure import newsstructure

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

Using a Custom API Key

By default, the package uses the free tier of LLM7 (via langchain_llm7). You can provide your own API key either via environment variable or directly:

import os
os.environ["LLM7_API_KEY"] = "your_api_key_here"

# or

response = newsstructure(user_input, api_key="your_api_key_here")

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

Parameters

  • user_input (str): The text input (e.g., news headline or snippet) to process.
  • llm (Optional[BaseChatModel]): A LangChain LLM instance. If not provided, defaults to ChatLLM7.
  • api_key (Optional[str]): API key for LLM7. If not provided, the package will try to read from the LLM7_API_KEY environment variable.

License

This project is licensed under the MIT License.

Issues

Report issues or feature requests on GitHub.

Author

Eugene Evstafev
Email: hi@euegne.plus
GitHub: chigwell

Metadata

Release files for newsstructure 2025.12.20202005

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for newsstructure 2025.12.20202005
File Size Uploaded Provenance Actions
newsstructure-2025.12.20202005.tar.gz 4.3 kB Without provenance Details for newsstructure-2025.12.20202005.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for newsstructure 2025.12.20202005
File Interpreter ABI Platform Actions
newsstructure-2025.12.20202005-py3-none-any.whl Python 3 none any Details for newsstructure-2025.12.20202005-py3-none-any.whl

Total release size: 9.3 kB

Release files / newsstructure-2025.12.20202005.tar.gz

Download URL newsstructure-2025.12.20202005.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
06aa45aa79a466c6cece728319c9f8fa789df7a73761baad24eab5fdd314f8aa
BLAKE2b-256 checksum
How to use checksums
4e15c30e5688cc9ee0f566838c7a12c2b98a459c4f302636329730bc6f7c3980
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Release files / newsstructure-2025.12.20202005-py3-none-any.whl

Download URL newsstructure-2025.12.20202005-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c83b3797815d810744dc7a194822bc0df03cfdfa5d787427d5cb0d8f52a07def
BLAKE2b-256 checksum
How to use checksums
c4d0367ad4eccb8d36fff38ac8dd34d03e85c883a6535df8fe9ae1ac8282e274
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Security for newsstructure 2025.12.20202005

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page