Skip to main content

write-struct transforms user-submitted text into structured, formatted content for improved readability and consistency.

Project description

write_struct

PyPI version License: MIT Downloads LinkedIn

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 ChatLLM7 or 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_KEY from 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


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

write_struct-2025.12.21200316.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

write_struct-2025.12.21200316-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file write_struct-2025.12.21200316.tar.gz.

File metadata

  • Download URL: write_struct-2025.12.21200316.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.1

File hashes

Hashes for write_struct-2025.12.21200316.tar.gz
Algorithm Hash digest
SHA256 27fc9d2d6efd7b20c7a7a205feacf0f46150c097d2e9402f29643bb0c3e039c8
MD5 ba0a30e805a09f530aa9a9be90af2d67
BLAKE2b-256 3d5338c5a3af7ddd99f0167bae770cf2932624604ad6dba8f19dfc73fb81ff65

See more details on using hashes here.

File details

Details for the file write_struct-2025.12.21200316-py3-none-any.whl.

File metadata

File hashes

Hashes for write_struct-2025.12.21200316-py3-none-any.whl
Algorithm Hash digest
SHA256 aabaad18e1491e4a08dca0cc0d0af168471bcca976d0c6a4d444e437714b7f53
MD5 2d5514ed7c4de16a6a79d226f0166f23
BLAKE2b-256 ece56d2e6e20dbc80948a94cbb1a6bbeefca484c5f4d7955e486045dd3bf35c9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page