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.
Install the package via pip:
pip install newspressoImport 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)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 defaultChatLLM7is used.api_key(Optional[str]): API key for LLM7. If not provided, the environment variableLLM7_API_KEYis used, or a default key is attempted.
You can use any LangChain-compatible LLM by passing it to the llm parameter. For example:
from langchain_openai import ChatOpenAI
from newspresso import newspresso
llm = ChatOpenAI()
response = newspresso(user_input, llm=llm)from langchain_anthropic import ChatAnthropic
from newspresso import newspresso
llm = ChatAnthropic()
response = newspresso(user_input, llm=llm)from langchain_google_genai import ChatGoogleGenerativeAI
from newspresso import newspresso
llm = ChatGoogleGenerativeAI()
response = newspresso(user_input, llm=llm)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/.
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', ...]langchain_corelangchain_llm7(for default LLM)llmatch_messages(for pattern matching)
Report issues or contribute via GitHub: https://github.com/chigwell/newspresso
Eugene Evstafev – hi@euegne.plus