A new package designed to extract and structure key financial and business insights from unstructured news text. The package takes raw news text as input and returns a structured summary containing th
Project description
fintextract
fintextract is a lightweight Python package that extracts and structures key financial and business insights from unstructured news text.
Give it a raw news sentence and receive a clear, machine‑readable summary containing:
- Subject – the main person or organization
- Key figures – monetary amounts, percentages, etc.
- Significant event – the core business event described
Designed for financial analysts, business reporters, and investors who need to quickly parse breaking news.
Features
- One‑function API (
fintextract) that returns a list of extracted data items. - Built‑in default LLM: ChatLLM7 (via the
langchain_llm7integration). - Seamless integration with any LangChain‑compatible LLM (OpenAI, Anthropic, Google, …).
- Simple regex‑based output validation ensures the response matches the expected pattern.
Installation
pip install fintextract
Quick Start
from fintextract import fintextract
news = "Elon Musk becomes first person worth $700B following pay package ruling."
result = fintextract(user_input=news)
print(result)
# Example output:
# ['Subject: Elon Musk', 'Key figure: $700B', 'Event: pay package ruling']
API Reference
def fintextract(
user_input: str,
api_key: Optional[str] = None,
llm: Optional[BaseChatModel] = None,
) -> List[str]:
| Parameter | Type | Description |
|---|---|---|
| user_input | str |
The raw news text you want to analyze. |
| api_key | Optional[str] |
API key for ChatLLM7. If omitted, the function reads LLM7_API_KEY from the environment. |
| llm | Optional[BaseChatModel] |
A LangChain LLM instance. If not provided, the default ChatLLM7 is instantiated automatically. |
The function returns a list of strings that match the pre‑defined output pattern (subject, key figure, event).
Using a Custom LLM
If you prefer another language model, simply pass a LangChain LLM instance:
OpenAI
from langchain_openai import ChatOpenAI
from fintextract import fintextract
llm = ChatOpenAI()
response = fintextract(user_input="Your news text", llm=llm)
Anthropic
from langchain_anthropic import ChatAnthropic
from fintextract import fintextract
llm = ChatAnthropic()
response = fintextract(user_input="Your news text", llm=llm)
Google Generative AI
from langchain_google_genai import ChatGoogleGenerativeAI
from fintextract import fintextract
llm = ChatGoogleGenerativeAI()
response = fintextract(user_input="Your news text", llm=llm)
Any LangChain‑compatible BaseChatModel can be used in the same way.
API Key & Rate Limits
- ChatLLM7 (the default) uses the free tier rate limits, which are sufficient for typical usage.
- To obtain a free API key, register at https://token.llm7.io/.
- Set the key via the environment variable
LLM7_API_KEYor pass it directly:
response = fintextract(user_input="Your news text", api_key="YOUR_API_KEY")
If higher limits are needed, upgrade your LLM7 plan accordingly.
Contributing
Contributions, bug reports, and feature requests are welcome!
Please open an issue or submit a pull request on GitHub:
Issues: https://github.com/chigwell/fintextract/issues
Pull Requests: https://github.com/chigwell/fintextract/pulls
License
This project is licensed under the MIT License.
Author
Eugene Evstafev – hi@euegne.plus
GitHub: chigwell
Acknowledgements
- ChatLLM7 integration from the
langchain_llm7package – https://pypi.org/project/langchain-llm7/ - Pattern matching powered by
llmatch_messages.llmatch.
Happy extracting!
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 fintextract-2025.12.21122420.tar.gz.
File metadata
- Download URL: fintextract-2025.12.21122420.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f9f9dabe6f00456fb4b6f110178e2d57f8ba949c4bb7c85a4af767eae168683
|
|
| MD5 |
2c702903f00abf312a1032e5a94403e6
|
|
| BLAKE2b-256 |
a6241463e1fdcb12a2ee8f09aa6028812835fa2aac2e4d8e1a651e86c97460ca
|
File details
Details for the file fintextract-2025.12.21122420-py3-none-any.whl.
File metadata
- Download URL: fintextract-2025.12.21122420-py3-none-any.whl
- Upload date:
- Size: 6.4 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 |
eba7fa1ee05e0be7727f7a76b6663d7231f0f2d999a4250ee860bcc9e332b9f7
|
|
| MD5 |
b373b43daa2821d88806ee4a39281d32
|
|
| BLAKE2b-256 |
7de999a7d93f8d7da0157c7a027479aa95cd05b1d2c8eab8a172617e58a1debd
|