Skip to main content

The package lets users input a textual description of a claim about paradox‑free time travel backed by mathematics. It then uses an LLM together with llmatch‑messages to parse the text, extract the co

Project description

time-travel-math-parser

PyPI version License: MIT Downloads LinkedIn

Time‑Travel Math Parser transforms free‑form textual claims about paradox‑free time‑travel into a clean, structured JSON format that downstream tools can consume reliably.


Highlights

  • LLM‑powered extraction using the llmatch-messages library to enforce a strict output format.
  • Works out‑of‑the‑box with the free tier of LLM7 thanks to a sensible default implementation (ChatLLM7 from langchain_llm7).
  • Easy to swap LLMs – you can pass any langchain compatible BaseChatModel (OpenAI, Anthropic, Google, etc.) to replace the default.

Installation

pip install time-travel-math-parser

Quick Start

from time_travel_math_parser import time_travel_math_parser

user_input = """
The paper proves that any universe with a closed timelike curve will eventually resolve paradoxes by introducing a feedback loop that nullifies causal inconsistencies. 
Key assumptions: (1) spacetime is differentiable, (2) causality violation is limited to the region within the wormhole throat, and (3) quantum fluctuations are suppressed.
"""

# Using the default ChatLLM7
output = time_travel_math_parser(user_input)

print(output)

output will be a list of extracted JSON objects, for example:

[
  {
    "claim": "any universe with a closed timelike curve will eventually resolve paradoxes ...",
    "theorem_summary": "...feedback loop that nullifies causal inconsistencies",
    "assumptions": [
      "spacetime is differentiable",
      "causality violation is limited to the region within the wormhole throat",
      "quantum fluctuations are suppressed"
    ],
    "paradox_handling": "...",
    "confidence_score": 0.92
  }
]

Using Your Own LLM

time_travel_math_parser accepts an optional llm argument that should be an instance of langchain BaseChatModel.
Below are examples for the three most common LLM back‑ends.

OpenAI

from langchain_openai import ChatOpenAI
from time_travel_math_parser import time_travel_math_parser

llm = ChatOpenAI()          # configure API key through environment variable or kwargs
result = time_travel_math_parser(user_input, llm=llm)

Anthropic

from langchain_anthropic import ChatAnthropic
from time_travel_math_parser import time_travel_math_parser

llm = ChatAnthropic()
result = time_travel_math_parser(user_input, llm=llm)

Google Gemini

from langchain_google_genai import ChatGoogleGenerativeAI
from time_travel_math_parser import time_travel_math_parser

llm = ChatGoogleGenerativeAI()
result = time_travel_math_parser(user_input, llm=llm)

Parameters

Parameter Type Description
user_input str The free‑form text describing the time‑travel claim to parse.
llm Optional[BaseChatModel] A LangChain chat model instance. If omitted, ChatLLM7 (free tier) is used.
api_key Optional[str] LLM7 API key. If not supplied, the function looks for LLM7_API_KEY in the environment; if still missing it falls back to the default public key.

Rate Limits

LLM7’s free tier provides ample throughput for most development and testing workloads.
If you require higher limits, supply a personal API key:

export LLM7_API_KEY=YOUR_KEY

or:

time_travel_math_parser(user_input, api_key="YOUR_KEY")

Free keys are available from https://token.llm7.io/.


Contributing & Issues

If you encounter bugs or have feature requests, please open an issue on GitHub: https://github.com/chigwell/time-travel-math-parser/issues

Feel free to fork and submit pull requests!


License

MIT © Eugene Evstafev – hi@eugene.plus


Author

Eugene Evstafev (chigwell)
https://github.com/chigwell
LinkedIn: https://linkedin.com/in/chigwell

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

time_travel_math_parser-2025.12.20185553.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file time_travel_math_parser-2025.12.20185553.tar.gz.

File metadata

File hashes

Hashes for time_travel_math_parser-2025.12.20185553.tar.gz
Algorithm Hash digest
SHA256 cd602aff9b0860581f4986b4d0da5982e6551751426aec3e6e88af56cdde85cf
MD5 ac8ccfc0d44c6b594967b22604bf9f79
BLAKE2b-256 d3c4c30c8cbfa55dcb56a66d5e6127c7f9e4935a7f710e66db6c4499501bf1ba

See more details on using hashes here.

File details

Details for the file time_travel_math_parser-2025.12.20185553-py3-none-any.whl.

File metadata

File hashes

Hashes for time_travel_math_parser-2025.12.20185553-py3-none-any.whl
Algorithm Hash digest
SHA256 139b2bb4abb6cfcebcacebe8d2610fdaeba47f1407d7e92912a0d5fb1980c058
MD5 7ec458bbb5d4072dfb95439815266700
BLAKE2b-256 840b8df1dcfb25da3a7762de4b06ea4591b54f59b1cfef5471f5e50fc240b00b

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