Skip to main content

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

Metadata

Release files for text-structura 2025.12.21090343

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for text-structura 2025.12.21090343
File Size Uploaded
text_structura-2025.12.21090343.tar.gz 4.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for text-structura 2025.12.21090343
File Interpreter ABI Platform
text_structura-2025.12.21090343-py3-none-any.whl Python 3 none any Details

Total release size: 9.6 kB

Release files / text_structura-2025.12.21090343.tar.gz

Download URL text_structura-2025.12.21090343.tar.gz
Size 4.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cc76c80d7087c40c340c2912032cccb3f5ffde5b8f9d1424dbf560e521a770a4
BLAKE2b-256 checksum
How to use checksums
f3736a8694059fc2ea639fd199b38e41c14b69df8b3400228785430f873e8098
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Release files / text_structura-2025.12.21090343-py3-none-any.whl

Download URL text_structura-2025.12.21090343-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01cd1a1e410fce99c9d97cd8a03523d6d869b6d6eefb68a905ff1a054b0304a0
BLAKE2b-256 checksum
How to use checksums
2127a68016bd7345ed812430df3df9972945a7dd8e3a14415138e90d9c721009
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Release history Release notifications | RSS feed

This release

2025.12.21090343 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page