Skip to main content

A new package that extracts and structures key historical facts and insights from textual descriptions of historical events, such as the Lend-Lease program during World War II. The package takes a tex

Project description

histextractor

PyPI version License: MIT Downloads LinkedIn

histextractor is a lightweight Python package that extracts and structures key historical facts from natural‑language descriptions of historical events.
Given a text passage such as a summary of the Lend‑Lease program during World War II, the package returns a list of structured strings containing the main participants, key actions, outcomes, and notable controversies. The output follows a consistent format, making it ideal for educational tools, research databases, or historical analysis platforms.


📦 Installation

pip install histextractor

🚀 Quick Start

from histextractor import histextractor

user_input = """
The Lend‑Lease program was a U.S. policy during World War II that supplied Allied nations
with military aid. It involved the United States sending vehicles, weapons, and supplies
to the United Kingdom, the Soviet Union, China, and others. This assistance was crucial
in sustaining Allied forces before the U.S. formally entered the war.
"""

# Use the default ChatLLM7
response = histextractor(user_input)

for idx, item in enumerate(response, 1):
    print(f"{idx}. {item}")

📚 How histextractor Works

  1. LLM Choice

    • By default, the package uses ChatLLM7 from langchain_llm7.
    • You can overwrite this by passing any langchain compatible BaseChatModel.
  2. API Key

    • If you do not specify an api_key, the function will look for the environment variable LLM7_API_KEY.
    • If that is also missing, it will fall back to the string "None", which still triggers the credentials that the free tier of LLM7 provides.
  3. Output Format

    • The function returns a List[str].
    • Each entry in the list follows the regex pattern defined in pattern.py, ensuring consistent structure.

🔌 Custom LLM Examples

Using OpenAI

from langchain_openai import ChatOpenAI
from histextractor import histextractor

llm = ChatOpenAI()
response = histextractor(user_input, llm=llm)

Using Anthropic

from langchain_anthropic import ChatAnthropic
from histextractor import histextractor

llm = ChatAnthropic()
response = histextractor(user_input, llm=llm)

Using Google Gemini

from langchain_google_genai import ChatGoogleGenerativeAI
from histextractor import histextractor

llm = ChatGoogleGenerativeAI()
response = histextractor(user_input, llm=llm)

⚙️ Rate Limits & API Keys

  • LLM7 Free Tier rate limits are sufficient for most use cases.
  • For higher limits, provide your own API key via:
    • Environment variable: export LLM7_API_KEY=your_key_here
    • Parameter: histextractor(user_input, api_key="your_key_here")
  • Obtain a free API key at: https://token.llm7.io/

🐛 Issues & Feedback

Please file issues at: https://github.com/chigwell/histextractor/issues


👤 Author


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

histextractor-2025.12.21165426.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

histextractor-2025.12.21165426-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file histextractor-2025.12.21165426.tar.gz.

File metadata

File hashes

Hashes for histextractor-2025.12.21165426.tar.gz
Algorithm Hash digest
SHA256 30149b32cb9a7eb5de9827aa8ccfa36e799c7afbe90c32d0cfde12a4951425be
MD5 a265c52b4bb45f667cc757af4b4c2f5a
BLAKE2b-256 ed182036e94a739538d7a4a29f8e3e087b3ca50b58f52f47fdb6a9900e9dc639

See more details on using hashes here.

File details

Details for the file histextractor-2025.12.21165426-py3-none-any.whl.

File metadata

File hashes

Hashes for histextractor-2025.12.21165426-py3-none-any.whl
Algorithm Hash digest
SHA256 a929e536a47412f0c416a6f02792510b27e1f5915a673327d091f6c9fbda3922
MD5 27d2ed4758eeac31b5957f671ed5e40f
BLAKE2b-256 10b9487fc87493dc0812d18699809c478570464b9bc622c955fadb39b99509de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page