Skip to main content

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

PyPI version License: MIT Downloads LinkedIn

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 process
  • llm (Optional[BaseChatModel]): The langchain LLM instance to use. Defaults to ChatLLM7.
  • api_key (Optional[str]): The API key for LLM7. If not provided, the default ChatLLM7 will 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

GitHub

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

text_structura-2025.12.21090343.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

text_structura-2025.12.21090343-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file text_structura-2025.12.21090343.tar.gz.

File metadata

File hashes

Hashes for text_structura-2025.12.21090343.tar.gz
Algorithm Hash digest
SHA256 cc76c80d7087c40c340c2912032cccb3f5ffde5b8f9d1424dbf560e521a770a4
MD5 24fb2162e13d4ea7e4459a54c8e97698
BLAKE2b-256 f3736a8694059fc2ea639fd199b38e41c14b69df8b3400228785430f873e8098

See more details on using hashes here.

File details

Details for the file text_structura-2025.12.21090343-py3-none-any.whl.

File metadata

File hashes

Hashes for text_structura-2025.12.21090343-py3-none-any.whl
Algorithm Hash digest
SHA256 01cd1a1e410fce99c9d97cd8a03523d6d869b6d6eefb68a905ff1a054b0304a0
MD5 4dbb7c7741b2282eeb7f4dd65bde0a7d
BLAKE2b-256 2127a68016bd7345ed812430df3df9972945a7dd8e3a14415138e90d9c721009

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