Skip to main content

A new package designed to process and validate user inputs using advanced language models, ensuring structured and consistent responses. This package leverages the capabilities of llmatch-messages to

Project description

llmatch-validate

PyPI version License: MIT Downloads LinkedIn

A Python package for processing and validating user inputs using advanced language models, ensuring structured and consistent responses. Built on top of llmatch-messages, this package extracts and validates key information from text inputs, making it ideal for applications requiring structured data extraction, format validation, or response consistency.


📦 Installation

Install the package via pip:

pip install llmatch-validate

🚀 Features

  • Structured Data Extraction: Extracts key information from unstructured text inputs.
  • Regex Validation: Ensures extracted data matches predefined patterns.
  • Flexible LLM Integration: Works with default ChatLLM7 or any LangChain-compatible LLM.
  • Error Handling & Diagnostics: Provides clear error messages for failed validations.
  • Retry Mechanism: Built-in retry logic for robustness.

🔧 Usage

Basic Usage (Default LLM: ChatLLM7)

from llmatch_validate import llmatch_validate

response = llmatch_validate(
    user_input="Your input text here..."
)
print(response)  # Returns validated/extracted data as a list

Custom LLM Integration

You can replace the default ChatLLM7 with any LangChain-compatible LLM (e.g., OpenAI, Anthropic, Google Generative AI).

Example: Using OpenAI

from langchain_openai import ChatOpenAI
from llmatch_validate import llmatch_validate

llm = ChatOpenAI()
response = llmatch_validate(
    user_input="Your input text here...",
    llm=llm
)
print(response)

Example: Using Anthropic

from langchain_anthropic import ChatAnthropic
from llmatch_validate import llmatch_validate

llm = ChatAnthropic()
response = llmatch_validate(
    user_input="Your input text here...",
    llm=llm
)
print(response)

Example: Using Google Generative AI

from langchain_google_genai import ChatGoogleGenerativeAI
from llmatch_validate import llmatch_validate

llm = ChatGoogleGenerativeAI()
response = llmatch_validate(
    user_input="Your input text here...",
    llm=llm
)
print(response)

🔑 API Key Configuration

  • Default: Uses LLM7_API_KEY from environment variables.
  • Manual Override: Pass the API key directly:
    response = llmatch_validate(
        user_input="Your input text here...",
        api_key="your_llm7_api_key"
    )
    
  • Get a Free API Key: Register at LLM7 Token.

📌 Parameters

Parameter Type Description
user_input str The input text to process and validate.
api_key Optional[str] LLM7 API key (optional if LLM7_API_KEY is set).
llm Optional[BaseChatModel] Custom LangChain LLM (optional; defaults to ChatLLM7).

📝 Default LLM: ChatLLM7

By default, this package uses ChatLLM7 from langchain_llm7. The free tier rate limits are sufficient for most use cases. For higher limits, provide your own API key.


🔄 Rate Limits

  • LLM7 Free Tier: Sufficient for most use cases.
  • Custom API Key: Required for higher rate limits (pass via api_key or LLM7_API_KEY).

📂 License

This project is licensed under the MIT License.


📧 Support & Issues

For support or bug reports, open an issue on GitHub.


👤 Author

Eugene Evstafev (LinkedIn) | GitHub

Email: hi@euegne.plus


📚 Related Packages

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

llmatch_validate-2025.12.20175458.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

llmatch_validate-2025.12.20175458-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file llmatch_validate-2025.12.20175458.tar.gz.

File metadata

File hashes

Hashes for llmatch_validate-2025.12.20175458.tar.gz
Algorithm Hash digest
SHA256 0db478591c8e95980dea50c919286e876d49f96e972521922f47bc11bb7eefa5
MD5 1efacd10817fafb34a9231860cdebf93
BLAKE2b-256 b9055ca679270e0320f68a4712964c03f52d0e2683244d8080a552b3470f110c

See more details on using hashes here.

File details

Details for the file llmatch_validate-2025.12.20175458-py3-none-any.whl.

File metadata

File hashes

Hashes for llmatch_validate-2025.12.20175458-py3-none-any.whl
Algorithm Hash digest
SHA256 65219da4d5f53048fa9750d8e758a449827d6c68ed8297eff38d9f231344770a
MD5 ee39f99e99b4eb3a943da9cb58e4efd8
BLAKE2b-256 f2b205039bde93baf2d629b7a8784ad42ff3d2e37a6a533742b79997043a88a6

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