A new package designed to streamline content management tasks within Textpattern CMS 4.9.0. It allows users to input text-based content or instructions related to their CMS, such as article drafts, fo
Project description
tp-llmatch-formatter
A Textpattern CMS content management package designed to streamline content formatting tasks using LLM7.
Overview
This package allows users to input text-based content or instructions related to their Textpattern CMS, such as article drafts, formatting queries, or template adjustments. The package processes this input using llmatch-messages to ensure the output adheres to specific structured formats required by Textpattern, such as article tags, template syntax, or formatting rules. This ensures that the content or instructions are correctly formatted and ready for integration into the CMS, reducing manual errors and improving efficiency in content management workflows.
Installation
pip install tp_llmatch_formatter
Usage
Basic Usage
from tp_llmatch_formatter import tp_llmatch_formatter
response = tp_llmatch_formatter(user_input="Your text input here")
Using a Custom LLM
You can use any LLM compatible with LangChain. Here are examples using different LLMs:
Using OpenAI
from langchain_openai import ChatOpenAI
from tp_llmatch_formatter import tp_llmatch_formatter
llm = ChatOpenAI()
response = tp_llmatch_formatter(user_input="Your text input here", llm=llm)
Using Anthropic
from langchain_anthropic import ChatAnthropic
from tp_llmatch_formatter import tp_llmatch_formatter
llm = ChatAnthropic()
response = tp_llmatch_formatter(user_input="Your text input here", llm=llm)
Using Google
from langchain_google_genai import ChatGoogleGenerativeAI
from tp_llmatch_formatter import tp_llmatch_formatter
llm = ChatGoogleGenerativeAI()
response = tp_llmatch_formatter(user_input="Your text input here", llm=llm)
Using LLM7 API Key
By default, the package uses the LLM7 API. You can pass your API key directly or via an environment variable.
Using Environment Variable
import os
from tp_llmatch_formatter import tp_llmatch_formatter
os.environ["LLM7_API_KEY"] = "your_api_key"
response = tp_llmatch_formatter(user_input="Your text input here")
Passing API Key Directly
from tp_llmatch_formatter import tp_llmatch_formatter
response = tp_llmatch_formatter(user_input="Your text input here", api_key="your_api_key")
Parameters
user_input(str): The user input text to process.llm(Optional[BaseChatModel]): The LangChain LLM instance to use. If not provided, the default ChatLLM7 will be used.api_key(Optional[str]): The API key for LLM7. If not provided, the package will use the environment variableLLM7_API_KEYor a default value.
Default LLM
The package uses ChatLLM7 from langchain_llm7 by default. You can safely pass your own LLM instance if you want to use another LLM.
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 for LLM7, you can pass your own API key via the environment variable LLM7_API_KEY or directly via the api_key parameter. You can get a free API key by registering at LLM7.
Issues
If you encounter any issues, please report them on the GitHub issues page.
Author
- Eugene Evstafev
- 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 tp_llmatch_formatter-2025.12.21170024.tar.gz.
File metadata
- Download URL: tp_llmatch_formatter-2025.12.21170024.tar.gz
- Upload date:
- Size: 5.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ac181ed3bc9531c7f681cddd8858fbee31566bbf079f4cb20e5c8bfda6edbb6
|
|
| MD5 |
3d6259f4ab810e560ec85957c850a691
|
|
| BLAKE2b-256 |
c8de2111fa9d04b9647dfc152dc36fbe1e1b9857c3b0195eb65a7f32999de5ff
|
File details
Details for the file tp_llmatch_formatter-2025.12.21170024-py3-none-any.whl.
File metadata
- Download URL: tp_llmatch_formatter-2025.12.21170024-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5d7d00b5a50e0df8565e2a8433597a7b61cf95e40e0765c40faaa0d363b9e42
|
|
| MD5 |
f220e67b5b3e1dbe57d0eaee9539325e
|
|
| BLAKE2b-256 |
8479b4f7da6ca7208211298c9939f371683297e36dc732e05cfe5a55c4054374
|