Extracts key information from unstructured news headlines into structured domain-specific summaries for business, logistics, and transportation sectors.
Project description
Logistics Headline Extractor
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 processllm(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:
- Get a free API key by registering at https://token.llm7.io/
- Pass your API key via the
api_keyparameter orLLM7_API_KEYenvironment variable - 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
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 logistics_headline_extractor-2025.12.21191245.tar.gz.
File metadata
- Download URL: logistics_headline_extractor-2025.12.21191245.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d41ad35b6d60cbf7aa22247ff577c1ff9bc18612fab046ddd56bb69c15a11cae
|
|
| MD5 |
adf080742839d29a2b1682a9361879de
|
|
| BLAKE2b-256 |
2b2adab688cad83a925bed412678c33bb5c04db976f00ea23eb56d00809737eb
|
File details
Details for the file logistics_headline_extractor-2025.12.21191245-py3-none-any.whl.
File metadata
- Download URL: logistics_headline_extractor-2025.12.21191245-py3-none-any.whl
- Upload date:
- Size: 7.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 |
4db5f565ef911103b128510def099c91efb2adf7a334625ba073c47b63f46bcf
|
|
| MD5 |
c3e124d52dae14eb3db41788d2104aa0
|
|
| BLAKE2b-256 |
d75b0ac1058a3dadf175afb23e3580f3a128272c1b0e733501ab29ce10807ad5
|