A new package would process user-provided text input related to historical or thematic content—such as summaries, descriptions, or analyses of topics like persuasion techniques from antiquity—and retu
Project description
thematic-structurizer
Thematic Structurizer is a Python package designed to process user-provided text related to historical or thematic content—such as summaries, descriptions, or analyses of topics like persuasion techniques from antiquity—and extract structured, pattern-validated data. It leverages large language models (LLMs) to generate responses in a predefined format, ensuring consistency and reliability through regex validation and retry mechanisms.
Installation
Install the package via pip:
pip install thematic_structurizer
Usage
Here's an example of how to use the package:
from thematic_structurizer import thematic_structurizer
# Example user input
user_input = "Describe the persuasion techniques used by Cicero in ancient Rome."
# Calling the function with default LLM (ChatLLM7)
response = thematic_structurizer(user_input)
print(response)
Custom LLM Support
The package uses ChatLLM7 from langchain_llm7 by default. You can provide your own language model instance to customize the behavior. Supported models include those from OpenAI, Anthropic, Google Generative AI, etc.
Example with a custom LLM:
from langchain_openai import ChatOpenAI
from thematic_structurizer import thematic_structurizer
llm = ChatOpenAI()
response = thematic_structurizer(user_input, llm=llm)
Alternatively, using other providers:
from langchain_anthropic import ChatAnthropic
from thematic_structurizer import thematic_structurizer
llm = ChatAnthropic()
response = thematic_structurizer(user_input, llm=llm)
API Key Management
For the default ChatLLM7, you can set your API key via environment variable:
export LLM7_API_KEY='your_api_key'
or pass it directly:
response = thematic_structurizer(user_input, api_key='your_api_key')
To obtain a free API key, register at https://token.llm7.io/.
Function Details
def thematic_structurizer(
user_input: str,
api_key: Optional[str] = None,
llm: Optional[BaseChatModel] = None
) -> List[str]:
user_input: The text to process, such as a description, summary, or analysis.llm: An optional language model instance; defaults toChatLLM7.api_key: Optional string; API key forChatLLM7.
This function processes the input, invokes the LLM, and returns a list of extracted data that match the predefined pattern validation.
License
This project is maintained by Eugene Evstafev. For issues or contributions, please visit https://github.com/chigwell/thematic-structurizer.
Contact
- Email: hi@eugene.plus
- GitHub: chigwell
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file thematic_structurizer-2025.12.21114407.tar.gz.
File metadata
- Download URL: thematic_structurizer-2025.12.21114407.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba38a8c929bac1e3fb4633353c5ccc66aa4e29ee5fe1ac0bb17c200835f84b72
|
|
| MD5 |
49e0633cfd133ab08c106bfc7106cee4
|
|
| BLAKE2b-256 |
2a784db15a792f43af0b9c0707d3aaa9700cdcf67f013f9f268b928614f34c55
|
File details
Details for the file thematic_structurizer-2025.12.21114407-py3-none-any.whl.
File metadata
- Download URL: thematic_structurizer-2025.12.21114407-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0fde17f4476e136c2967692ca7189717223a426d42478bed7e4d5e320935067b
|
|
| MD5 |
d98750f64fc1d9dc8e14639952262b4b
|
|
| BLAKE2b-256 |
421a1f23230dc2279b04dd91651fb6305e3d5f7718e15f0d445215b18551e0a3
|