Skip to main content

Logistics Headline Extractor

PyPI version License: MIT Downloads LinkedIn

A Python package for transforming unstructured news headlines or short text snippets into structured, domain-specific summaries. Ideal for business, logistics, and transportation sectors, this tool extracts key details (e.g., entity, action, reason, location, and impact) and outputs them in a standardized JSON-like format.

Features

  • Extracts structured information from noisy text inputs
  • Outputs results in a consistent JSON-like format
  • Supports custom LLM backends via LangChain
  • Easy integration with existing workflows

Installation

Install the package via pip:

pip install logistics_headline_extractor

Usage

Basic Example

from logistics_headline_extractor import logistics_headline_extractor

user_input = "Waymo temporarily suspends service in SF amid power outage"
result = logistics_headline_extractor(user_input=user_input)
print(result)

Using a Custom LLM

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

OpenAI Example

from langchain_openai import ChatOpenAI
from logistics_headline_extractor import logistics_headline_extractor

llm = ChatOpenAI()
user_input = "Waymo temporarily suspends service in SF amid power outage"
result = logistics_headline_extractor(user_input=user_input, llm=llm)

Anthropic Example

from langchain_anthropic import ChatAnthropic
from logistics_headline_extractor import logistics_headline_extractor

llm = ChatAnthropic()
user_input = "Waymo temporarily suspends service in SF amid power outage"
result = logistics_headline_extractor(user_input=user_input, llm=llm)

Google Generative AI Example

from langchain_google_genai import ChatGoogleGenerativeAI
from logistics_headline_extractor import logistics_headline_extractor

llm = ChatGoogleGenerativeAI()
user_input = "Waymo temporarily suspends service in SF amid power outage"
result = logistics_headline_extractor(user_input=user_input, llm=llm)

Using Custom API Key

For LLM7 (default provider), you can provide your API key:

from logistics_headline_extractor import logistics_headline_extractor

user_input = "Waymo temporarily suspends service in SF amid power outage"
result = logistics_headline_extractor(user_input=user_input, api_key="your_api_key_here")

Or set it as an environment variable:

export LLM7_API_KEY="your_api_key_here"

Parameters

  • user_input (str): The text input to process
  • llm (Optional[BaseChatModel]): LangChain LLM instance (defaults to ChatLLM7)
  • api_key (Optional[str]): API key for LLM7 (if using default provider)

Default LLM Provider

This package uses ChatLLM7 by default. The free tier rate limits are sufficient for most use cases. For higher rate limits, you can:

  1. Get a free API key by registering at https://token.llm7.io/
  2. Pass your API key via the api_key parameter or LLM7_API_KEY environment variable
  3. Use a different LLM provider by passing a custom LangChain LLM instance

Output Format

The package returns a list of strings matching the pattern:

{"entity": "...", "action": "...", "reason": "...", "location": "...", "temporal": "..."}

Error Handling

If the LLM call fails, the function will raise a RuntimeError with details about the failure.

Support

For issues and feature requests, please create an issue on our GitHub repository.

Author

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

Metadata

Release files for logistics-headline-extractor 2025.12.21191245

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

Source distribution (sdist)

Source distribution for logistics-headline-extractor 2025.12.21191245
File Size Uploaded
logistics_headline_extractor-2025.12.21191245.tar.gz 6.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for logistics-headline-extractor 2025.12.21191245
File Interpreter ABI Platform
logistics_headline_extractor-2025.12.21191245-py3-none-any.whl Python 3 none any Details

Total release size: 13.3 kB

Release files / logistics_headline_extractor-2025.12.21191245.tar.gz

Download URL logistics_headline_extractor-2025.12.21191245.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d41ad35b6d60cbf7aa22247ff577c1ff9bc18612fab046ddd56bb69c15a11cae
BLAKE2b-256 checksum
How to use checksums
2b2adab688cad83a925bed412678c33bb5c04db976f00ea23eb56d00809737eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release files / logistics_headline_extractor-2025.12.21191245-py3-none-any.whl

Download URL logistics_headline_extractor-2025.12.21191245-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4db5f565ef911103b128510def099c91efb2adf7a334625ba073c47b63f46bcf
BLAKE2b-256 checksum
How to use checksums
d75b0ac1058a3dadf175afb23e3580f3a128272c1b0e733501ab29ce10807ad5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.1

Release history Release notifications | RSS feed

This release

2025.12.21191245 This release

2 release files

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