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.
- 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.
Install via pip:
pip install write_structfrom write_struct import write_struct
user_input = "Your raw text here..."
response = write_struct(user_input)
print(response)You can replace the default ChatLLM7 with any LangChain-compatible model (e.g., OpenAI, Anthropic, Google Generative AI):
from langchain_openai import ChatOpenAI
from write_struct import write_struct
llm = ChatOpenAI()
response = write_struct(user_input, llm=llm)from langchain_anthropic import ChatAnthropic
from write_struct import write_struct
llm = ChatAnthropic()
response = write_struct(user_input, llm=llm)from langchain_google_genai import ChatGoogleGenerativeAI
from write_struct import write_struct
llm = ChatGoogleGenerativeAI()
response = write_struct(user_input, llm=llm)- 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.
| 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. |
- LLM7 Free Tier: Sufficient for most use cases.
- Upgrade: For higher limits, use a custom API key or switch to a paid plan.
MIT License.
For bugs, feature requests, or support, open an issue on GitHub.
Eugene Evstafev (@chigwell) 📧 hi@euegne.plus