{"id":37072928,"url":"https://github.com/chigwell/hist-pred-extractor","last_synced_at":"2026-01-14T08:33:45.779Z","repository":{"id":329805965,"uuid":"1120716402","full_name":"chigwell/hist-pred-extractor","owner":"chigwell","description":"Extracts \u0026 structures historical predictions from text using llmatch-messages.","archived":false,"fork":false,"pushed_at":"2025-12-21T19:50:36.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-23T08:14:51.873Z","etag":null,"topics":["archiveresearch","contextanalysis","dataenrichment","historiantools","historicalpredictions","llmatchmessages","nlp","outcomeassessment","predictionvalidation","predictiveanalysis","researchassistant","semanticanalysis","structuredoutput","temporalinference","textextraction"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/hist-pred-extractor/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chigwell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-21T19:50:24.000Z","updated_at":"2025-12-21T19:50:52.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/chigwell/hist-pred-extractor","commit_stats":null,"previous_names":["chigwell/hist-pred-extractor"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/chigwell/hist-pred-extractor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chigwell%2Fhist-pred-extractor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chigwell%2Fhist-pred-extractor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chigwell%2Fhist-pred-extractor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chigwell%2Fhist-pred-extractor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chigwell","download_url":"https://codeload.github.com/chigwell/hist-pred-extractor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chigwell%2Fhist-pred-extractor/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28414338,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:31:27.429Z","status":"ssl_error","status_checked_at":"2026-01-14T08:31:19.098Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["archiveresearch","contextanalysis","dataenrichment","historiantools","historicalpredictions","llmatchmessages","nlp","outcomeassessment","predictionvalidation","predictiveanalysis","researchassistant","semanticanalysis","structuredoutput","temporalinference","textextraction"],"created_at":"2026-01-14T08:33:45.066Z","updated_at":"2026-01-14T08:33:45.766Z","avatar_url":"https://github.com/chigwell.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# hist-pred-extractor\n[![PyPI version](https://badge.fury.io/py/hist-pred-extractor.svg)](https://badge.fury.io/py/hist-pred-extractor)\n[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)\n[![Downloads](https://static.pepy.tech/badge/hist-pred-extractor)](https://pepy.tech/project/hist-pred-extractor)\n[![LinkedIn](https://img.shields.io/badge/LinkedIn-blue)](https://www.linkedin.com/in/eugene-evstafev-716669181/)\n\n\n**hist-pred-extractor** is a tiny Python package that extracts and structures historical predictions (foresights, prophecies, or prognostications) from free‑form text.  \nGiven a passage about a historical figure or event, the tool uses a LLM to locate statements that contain a prediction, validates them against a strict regex pattern, and returns a clean, structured list of the extracted predictions together with their context.\n\nThe package is useful for historians, researchers, educators, and anyone who wants to systematically analyse historical foresights.\n\n---\n\n## Features\n\n- **One‑function API** – just pass a string (and optionally a custom LLM or API key).  \n- **LLM‑agnostic** – defaults to `ChatLLM7` (via `langchain_llm7`) but works with any LangChain chat model.  \n- **Regex‑validated output** – ensures extracted data follows the pattern defined in `prompts.pattern`.  \n- **Zero‑configuration** – works out of the box with the free tier of LLM7.\n\n---\n\n## Installation\n\n```bash\npip install hist_pred_extractor\n```\n\n---\n\n## Quick Start\n\n```python\nfrom hist_pred_extractor import hist_pred_extractor\n\n# Simple call – uses the default ChatLLM7 and the LLM7_API_KEY\ntext = \"\"\"\nIn 1846, the astronomer John Herschel wrote: \"In the next fifty years, the continents will drift apart,\nforming the Atlantic as we know it today.\" This prediction was later confirmed by plate tectonics.\n\"\"\"\npredictions = hist_pred_extractor(user_input=text)\n\nprint(predictions)\n# Example output:\n# [\n#   \"In the next fifty years, the continents will drift apart, forming the Atlantic as we know it today.\"\n# ]\n```\n\n---\n\n## API Reference\n\n### `hist_pred_extractor(user_input, llm=None, api_key=None) → List[str]`\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| **user_input** | `str` | The raw text containing historical statements to be analysed. |\n| **llm** | `Optional[BaseChatModel]` | A LangChain chat model instance. If omitted, the function creates a `ChatLLM7` instance automatically. |\n| **api_key** | `Optional[str]` | API key for LLM7. If not supplied, the function reads the `LLM7_API_KEY` environment variable, falling back to the default free‑tier key. |\n\n**Returns:** `List[str]` – a list of extracted prediction strings that match the internal regex pattern.\n\n---\n\n## Using a Custom LLM\n\nYou can supply any LangChain‑compatible chat model, e.g. OpenAI, Anthropic, or Google Gemini.\n\n### OpenAI\n\n```python\nfrom langchain_openai import ChatOpenAI\nfrom hist_pred_extractor import hist_pred_extractor\n\nllm = ChatOpenAI(model=\"gpt-4o-mini\")\npredictions = hist_pred_extractor(user_input=\"...\", llm=llm)\n```\n\n### Anthropic\n\n```python\nfrom langchain_anthropic import ChatAnthropic\nfrom hist_pred_extractor import hist_pred_extractor\n\nllm = ChatAnthropic()\npredictions = hist_pred_extractor(user_input=\"...\", llm=llm)\n```\n\n### Google Gemini\n\n```python\nfrom langchain_google_genai import ChatGoogleGenerativeAI\nfrom hist_pred_extractor import hist_pred_extractor\n\nllm = ChatGoogleGenerativeAI(model=\"gemini-1.5-flash\")\npredictions = hist_pred_extractor(user_input=\"...\", llm=llm)\n```\n\n---\n\n## API Key \u0026 Rate Limits\n\n- The default free tier of **LLM7** provides enough calls for typical research tasks.  \n- For higher throughput, set your own key:\n\n```bash\nexport LLM7_API_KEY=\"your_api_key_here\"\n```\n\nor pass it directly:\n\n```python\npredictions = hist_pred_extractor(user_input=\"...\", api_key=\"your_api_key_here\")\n```\n\nYou can obtain a free API key by registering at **https://token.llm7.io/**.\n\n---\n\n## Contributing \u0026 Support\n\n- **Issue Tracker:** \u003chttps://github.com/chigwell/hist_pred_extractor/issues\u003e  \n- Feel free to open a GitHub issue for bugs, feature requests, or questions.\n\n---\n\n## License\n\nThis project is licensed under the MIT License.\n\n---\n\n## Author\n\n**Eugene Evstafev** – \u003chi@euegne.plus\u003e  \nGitHub: [chigwell](https://github.com/chigwell)\n\n---\n\n## Acknowledgements\n\n- **ChatLLM7** from the `langchain_llm7` package: \u003chttps://pypi.org/project/langchain-llm7/\u003e  \n- **LangChain** framework for unified LLM access.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchigwell%2Fhist-pred-extractor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchigwell%2Fhist-pred-extractor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchigwell%2Fhist-pred-extractor/lists"}