write_struct
Transform raw text into structured, formatted content for WriteFreely and beyond.
write_struct is a Python package designed to enhance content creation by automatically converting user-submitted text into well-structured, formatted output. It leverages AI-powered pattern matching to ensure consistency, readability, and publication-ready quality for articles, blog posts, social media updates, and more.
🚀 Features
- Automated text structuring using AI-driven pattern matching.
- Flexible LLM integration – works with default
ChatLLM7or any LangChain-compatible model. - Regex-based validation to enforce output consistency.
- Lightweight and efficient for text-based content processing.
- No multimedia handling – focuses purely on text formatting.
📦 Installation
Install via pip:
pip install write_struct
🔧 Usage
Basic Usage (Default LLM7)
from write_struct import write_struct
user_input = "Your raw text here..."
response = write_struct(user_input)
print(response)
Custom LLM Integration
You can replace the default ChatLLM7 with any LangChain-compatible model (e.g., OpenAI, Anthropic, Google Generative AI):
Using OpenAI:
from langchain_openai import ChatOpenAI
from write_struct import write_struct
llm = ChatOpenAI()
response = write_struct(user_input, llm=llm)
Using Anthropic:
from langchain_anthropic import ChatAnthropic
from write_struct import write_struct
llm = ChatAnthropic()
response = write_struct(user_input, llm=llm)
Using Google Generative AI:
from langchain_google_genai import ChatGoogleGenerativeAI
from write_struct import write_struct
llm = ChatGoogleGenerativeAI()
response = write_struct(user_input, llm=llm)
🔑 API Key Configuration
- Default: Uses
LLM7_API_KEYfrom environment variables. - Manual Override: Pass the API key directly:
response = write_struct(user_input, api_key="your_api_key_here")
- Free API Key: Register at https://token.llm7.io/ for LLM7.
📜 Input Parameters
| Parameter | Type | Description |
|---|---|---|
user_input |
str |
Raw text to be structured. |
api_key |
Optional[str] |
LLM7 API key (defaults to LLM7_API_KEY env var). |
llm |
Optional[BaseChatModel] |
Custom LangChain LLM (e.g., ChatOpenAI, ChatAnthropic). Defaults to ChatLLM7. |
📊 Rate Limits
- LLM7 Free Tier: Sufficient for most use cases.
- Upgrade: For higher limits, use a custom API key or switch to a paid plan.
📝 License
MIT License.
📢 Support & Issues
For bugs, feature requests, or support, open an issue on GitHub.
👤 Author
Eugene Evstafev (@chigwell) 📧 hi@euegne.plus
Release files for write-struct 2025.12.21200316
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| write_struct-2025.12.21200316.tar.gz | 5.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| write_struct-2025.12.21200316-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.6 kB
Release files / write_struct-2025.12.21200316.tar.gz
| Download URL | write_struct-2025.12.21200316.tar.gz |
|---|---|
| Size | 5.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27fc9d2d6efd7b20c7a7a205feacf0f46150c097d2e9402f29643bb0c3e039c8
|
|
BLAKE2b-256 checksum How to use checksums |
3d5338c5a3af7ddd99f0167bae770cf2932624604ad6dba8f19dfc73fb81ff65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|
Release files / write_struct-2025.12.21200316-py3-none-any.whl
| Download URL | write_struct-2025.12.21200316-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aabaad18e1491e4a08dca0cc0d0af168471bcca976d0c6a4d444e437714b7f53
|
|
BLAKE2b-256 checksum How to use checksums |
ece56d2e6e20dbc80948a94cbb1a6bbeefca484c5f4d7955e486045dd3bf35c9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.1
|