simulacra-summarizer
simulacra-summarizer provides a lightweight, reliable way to analyze and summarize user‑provided text (e.g., articles, queries, or any free‑form prose) using a language model.
The package validates the LLM output against a regular‑expression pattern, retrying automatically until a correct, well‑structured summary is produced.
Features
- One‑function API – just call
simulacra_summarizer()with the text you want summarized. - Regex‑based validation – ensures the output follows the expected format.
- Built‑in retry logic – keeps querying the LLM until a valid response is returned.
- Pluggable LLMs – defaults to
ChatLLM7(fromlangchain_llm7) but any LangChain‑compatible chat model can be supplied. - Simple installation – pure‑Python package, no extra system dependencies.
Installation
pip install simulacra_summarizer
Quick Start
from simulacra_summarizer import simulacra_summarizer
# Basic usage – uses the default ChatLLM7 (API key taken from env LLM7_API_KEY)
summary = simulacra_summarizer(
user_input="The simulation hypothesis suggests that our reality might be a sophisticated computer simulation..."
)
print(summary) # -> List of strings that match the predefined pattern
Using a custom LLM
You can pass any LangChain BaseChatModel instance (e.g., OpenAI, Anthropic, Google) if you prefer a different provider.
OpenAI
from langchain_openai import ChatOpenAI
from simulacra_summarizer import simulacra_summarizer
llm = ChatOpenAI()
response = simulacra_summarizer(
user_input="Explain the simulation hypothesis in simple terms.",
llm=llm
)
Anthropic
from langchain_anthropic import ChatAnthropic
from simulacra_summarizer import simulacra_summarizer
llm = ChatAnthropic()
response = simulacra_summarizer(
user_input="What are the philosophical implications of living in a simulation?",
llm=llm
)
Google Generative AI
from langchain_google_genai import ChatGoogleGenerativeAI
from simulacra_summarizer import simulacra_summarizer
llm = ChatGoogleGenerativeAI()
response = simulacra_summarizer(
user_input="Summarize recent research on simulation theory.",
llm=llm
)
Supplying a custom API key for LLM7
from simulacra_summarizer import simulacra_summarizer
summary = simulacra_summarizer(
user_input="Why do some scientists argue that we might be living in a simulation?",
api_key="your-llm7-api-key"
)
You can also set the environment variable LLM7_API_KEY and omit the argument.
API Reference
def simulacra_summarizer(
user_input: str,
api_key: Optional[str] = None,
llm: Optional[BaseChatModel] = None
) -> List[str]:
| Parameter | Type | Description |
|---|---|---|
| user_input | str |
The raw text you want to be summarized. |
| api_key | Optional[str] |
API key for ChatLLM7. If omitted, the function reads LLM7_API_KEY from the environment; if still missing, a placeholder "None" is used (which will cause an authentication error). |
| llm | Optional[BaseChatModel] |
A LangChain chat model instance. When provided, api_key is ignored and the supplied LLM is used instead. |
Returns: List[str] – a list of strings that match the predefined regex pattern (simulacra_summarizer.pattern). If the LLM cannot produce a valid output, a RuntimeError is raised.
Under the Hood
- LLM: By default the function creates a
ChatLLM7instance from thelangchain_llm7package (see https://pypi.org/project/langchain-llm7). - Prompting: System and human prompts are defined in
simulacra_summarizer.prompts. - Validation: The LLM response is matched against a compiled regular expression (
simulacra_summarizer.pattern). Only a successful match is returned to the caller. - Retry Logic: The helper
llmatchfromllmatch_messageshandles repeated calls until the pattern matches or a hard failure occurs.
Rate Limits
The free tier of LLM7 provides generous rate limits for most typical summarization workloads.
If you require higher throughput, supply your own API key (via the environment variable LLM7_API_KEY or the api_key argument). Free API keys can be obtained by registering at https://token.llm7.io/.
Contributing & Support
- Bug reports / Feature requests: https://github....
- Author: Eugene Evstafev
- Email: hi@euegne.plus
- GitHub: chigwell
Feel free to open an issue or submit a pull request—contributions are welcome!
License
This project is licensed under the MIT License. See the LICENSE file for details.
Release files for simulacra-summarizer 2025.12.21100341
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| simulacra_summarizer-2025.12.21100341.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| simulacra_summarizer-2025.12.21100341-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.9 kB
Release files / simulacra_summarizer-2025.12.21100341.tar.gz
| Download URL | simulacra_summarizer-2025.12.21100341.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7244135c837595b7c20b75f2134f1a729270652757722933e87af99861edcc2d
|
|
BLAKE2b-256 checksum How to use checksums |
34ee79db7efaa69c0c1211ba9b3dc9b211a27ddd5c083dce8855920e371a7977
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.11
|
Release files / simulacra_summarizer-2025.12.21100341-py3-none-any.whl
| Download URL | simulacra_summarizer-2025.12.21100341-py3-none-any.whl |
|---|---|
| Size | 6.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
48a3fb945f6df8f4a278355050d24c4d5e96b5b2ecf9260fc6fadb6e5ccd3d4d
|
|
BLAKE2b-256 checksum How to use checksums |
dea12056e2b9fd800e99b44408e0807b8333c854eb2a60c743f89f807763ec3e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.11
|