A new package that takes user-provided text input and returns structured, validated output using pattern matching to ensure consistent formatting. It processes text extracted from various sources like
Project description
text-structura
A Python package that takes user-provided text input and returns structured, validated output using pattern matching to ensure consistent formatting.
Features
- Processes text from various sources like documents or audio transcripts
- Applies a system prompt to guide the LLM and a human message to frame the query
- Uses regex patterns to extract key information reliably
- Ideal for tasks like summarizing content, categorizing feedback, or generating standardized reports
- Does not rely on markdown or HTML formatting
Installation
pip install text_structura
Usage
from text_structura import text_structura
response = text_structura("Your text input here")
Using a Custom LLM
You can use your own LLM instance by passing it to the function:
from langchain_openai import ChatOpenAI
from text_structura import text_structura
llm = ChatOpenAI()
response = text_structura("Your text input here", llm=llm)
Using LLM7 with API Key
You can pass your LLM7 API key directly:
from text_structura import text_structura
response = text_structura("Your text input here", api_key="your_api_key")
Or by setting the LLM7_API_KEY environment variable. You can obtain a free API key by registering at https://token.llm7.io/.
Parameters
user_input(str): The user input text to processllm(Optional[BaseChatModel]): The langchain LLM instance to use. Defaults toChatLLM7.api_key(Optional[str]): The API key for LLM7. If not provided, the defaultChatLLM7will be used.
Default LLM
The package uses ChatLLM7 from langchain_llm7 by default. You can find more information about ChatLLM7 here.
Rate Limits
The default rate limits for LLM7 free tier are sufficient for most use cases of this package. If you want higher rate limits, you can pass your own API key via the api_key parameter or by setting the LLM7_API_KEY environment variable.
Contributing
Contributions are welcome! Please refer to the issue tracker for potential areas of improvement.
Author
- Eugene Evstafev - hi@euegne.plus
GitHub
- Project Repository: https://github.com/chigwell/text-structura
- Submit Issues: https://github.com/chigwell/text-structura/issues
- GitHub Nickname: 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 text_structura-2025.12.21090343.tar.gz.
File metadata
- Download URL: text_structura-2025.12.21090343.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cc76c80d7087c40c340c2912032cccb3f5ffde5b8f9d1424dbf560e521a770a4
|
|
| MD5 |
24fb2162e13d4ea7e4459a54c8e97698
|
|
| BLAKE2b-256 |
f3736a8694059fc2ea639fd199b38e41c14b69df8b3400228785430f873e8098
|
File details
Details for the file text_structura-2025.12.21090343-py3-none-any.whl.
File metadata
- Download URL: text_structura-2025.12.21090343-py3-none-any.whl
- Upload date:
- Size: 5.2 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 |
01cd1a1e410fce99c9d97cd8a03523d6d869b6d6eefb68a905ff1a054b0304a0
|
|
| MD5 |
4dbb7c7741b2282eeb7f4dd65bde0a7d
|
|
| BLAKE2b-256 |
2127a68016bd7345ed812430df3df9972945a7dd8e3a14415138e90d9c721009
|