A new package facilitates extracting a concise, structured summary from user-provided news headlines or brief texts by utilizing pattern matching and LLM interactions. This tool aims to help researche
Project description
Text-Snippet-Summarizer
Extract structured, concise summaries from news headlines and brief texts using pattern matching and LLM interactions.
This package helps researchers, journalists, and analysts quickly categorize and understand complex domain-specific issues (e.g., environmental crises, economic policies, geopolitics) by summarizing raw textual snippets. It avoids processing full documents, multimedia, or URLs, focusing on rapid, structured insights for decision-making or reporting.
🚀 Features
- Pattern-based extraction for structured summaries
- LLM-powered summarization with configurable models
- Lightweight – works with short text snippets
- Flexible LLM integration (supports OpenAI, Anthropic, Google, etc.)
- Default LLM7 integration (free tier sufficient for most use cases)
📦 Installation
pip install text_snippet_summarizer
🔧 Usage
Basic Usage (Default LLM7)
from text_snippet_summarizer import text_snippet_summarizer
user_input = "Climate change impacts: rising temperatures, extreme weather events, and biodiversity loss."
response = text_snippet_summarizer(user_input)
print(response)
Custom LLM Integration
Using OpenAI
from langchain_openai import ChatOpenAI
from text_snippet_summarizer import text_snippet_summarizer
llm = ChatOpenAI()
response = text_snippet_summarizer(user_input, llm=llm)
Using Anthropic
from langchain_anthropic import ChatAnthropic
from text_snippet_summarizer import text_snippet_summarizer
llm = ChatAnthropic()
response = text_snippet_summarizer(user_input, llm=llm)
Using Google Generative AI
from langchain_google_genai import ChatGoogleGenerativeAI
from text_snippet_summarizer import text_snippet_summarizer
llm = ChatGoogleGenerativeAI()
response = text_snippet_summarizer(user_input, llm=llm)
🔑 API Key Configuration
- Default: Uses
LLM7_API_KEYfrom environment variables. - Manual override: Pass
api_keydirectly:response = text_snippet_summarizer(user_input, api_key="your_api_key_here")
- Get a free LLM7 API key: Register here
📝 Function Signature
text_snippet_summarizer(
user_input: str,
api_key: Optional[str] = None,
llm: Optional[BaseChatModel] = None
) -> List[str]
user_input: Raw text snippet to summarize.api_key(optional): LLM7 API key (defaults toLLM7_API_KEYenv var).llm(optional): Custom LangChain LLM (e.g.,ChatOpenAI,ChatAnthropic).
📌 Notes
- Rate Limits: LLM7 free tier is sufficient for most use cases.
- Output: Returns a list of structured summary points matching predefined patterns.
- Dependencies: Uses
langchain_llm7(default) or anyBaseChatModelfrom LangChain.
📢 Issues & Support
Report bugs or feature requests: 🔗 GitHub Issues
👤 Author
Eugene Evstafev (@chigwell) 📧 hi@euegne.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 text_snippet_summarizer-2025.12.21113112.tar.gz.
File metadata
- Download URL: text_snippet_summarizer-2025.12.21113112.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
506d9cf0c2f011ecb80ee81bd067145e7ea0b2066a7ed20c49f7d98889963b10
|
|
| MD5 |
e0b7ef5e683303aa67f04b204ec1c9da
|
|
| BLAKE2b-256 |
d4c34161058becdf8adcc1b69dcb2ef258965431c621f02597af2b53566b1351
|
File details
Details for the file text_snippet_summarizer-2025.12.21113112-py3-none-any.whl.
File metadata
- Download URL: text_snippet_summarizer-2025.12.21113112-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7b3951df20ebb27cb9de8dd54bf91f5134dffebbd89c1c2c5b2007049216ff5
|
|
| MD5 |
1a2f7a31e118d8fe3ec976c9789e9d34
|
|
| BLAKE2b-256 |
e14d61203b696813eb4c5cf31da9cb8391f5e0ce24d4074f568a98851f200ec1
|