undesirablereasons is a lightweight Python package that helps you extract and organize key “undesirable” reasons from free‑form text. It leverages llmatch‑messages together with a language model (by default ChatLLM7) to return a clean, structured list of reasons – perfect for content creators, researchers, or anyone who wants to summarize the negative aspects of a topic.
pip install undesirablereasonsfrom undesirablereasons import undesirablereasons
user_input = """
Becoming famous sounds great, but it also means losing privacy,
being constantly judged, dealing with paparazzi, and facing intense
pressure to maintain a public image. Fame can attract false
friendships, tax complexities, and the loss of a normal childhood.
"""
reasons = undesirablereasons(user_input)
print(reasons)Output (example)
[
"Loss of privacy",
"Constant judgment and pressure",
"Paparazzi intrusion",
"False friendships",
"Tax complexities",
"Loss of a normal childhood"
]| Parameter | Type | Description |
|---|---|---|
| user_input | str |
The raw text you want to analyse. |
| api_key | Optional[str] |
API key for LLM7. If omitted, the function reads LLM7_API_KEY from the environment or falls back to the default (free tier). |
| llm | Optional[BaseChatModel] |
Any LangChain BaseChatModel instance. If omitted, the package creates a ChatLLM7 instance automatically. |
- Returns a list of extracted reasons (strings).
- Raises
RuntimeErrorif the LLM call fails.
You can plug in any LangChain‑compatible chat model:
from langchain_openai import ChatOpenAI
from undesirablereasons import undesirablereasons
llm = ChatOpenAI(model="gpt-4o-mini")
reasons = undesirablereasons("...", llm=llm)from langchain_anthropic import ChatAnthropic
from undesirablereasons import undesirablereasons
llm = ChatAnthropic(model="claude-3-haiku-20240307")
reasons = undesirablereasons("...", llm=llm)from langchain_google_genai import ChatGoogleGenerativeAI
from undesirablereasons import undesirablereasons
llm = ChatGoogleGenerativeAI(model="gemini-1.5-flash")
reasons = undesirablereasons("...", llm=llm)The free tier of LLM7 provides generous rate limits that are sufficient for most typical uses of this package. If you need higher limits, simply provide your own API key:
reasons = undesirablereasons("...", api_key="YOUR_LLM7_API_KEY")You can obtain a free API key by registering at https://token.llm7.io/.
- Repository: https://github.com/chigwell/undesirablereasons
- Issues: https://github.com/chigwell/undesirablereasons/issues
Feel free to open an issue for bugs, feature requests, or questions.
Contributions are welcome! Fork the repository, make your changes, and submit a pull request. Please ensure that new code follows the existing style and includes appropriate tests.
This project is licensed under the MIT License.
Eugene Evstafev – hi@euegne.plus
GitHub: chigwell