Skip to 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

Notifications You must be signed in to change notification settings

chigwell/text-structura

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

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

About

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

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages