Skip to main content

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

Metadata

Release files for llmatch-validate 2025.12.20175458

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

Source distribution (sdist)

Source distribution for llmatch-validate 2025.12.20175458
File Size Uploaded
llmatch_validate-2025.12.20175458.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llmatch-validate 2025.12.20175458
File Interpreter ABI Platform
llmatch_validate-2025.12.20175458-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 kB

Release files / llmatch_validate-2025.12.20175458.tar.gz

Download URL llmatch_validate-2025.12.20175458.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0db478591c8e95980dea50c919286e876d49f96e972521922f47bc11bb7eefa5
BLAKE2b-256 checksum
How to use checksums
b9055ca679270e0320f68a4712964c03f52d0e2683244d8080a552b3470f110c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Release files / llmatch_validate-2025.12.20175458-py3-none-any.whl

Download URL llmatch_validate-2025.12.20175458-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
65219da4d5f53048fa9750d8e758a449827d6c68ed8297eff38d9f231344770a
BLAKE2b-256 checksum
How to use checksums
f2b205039bde93baf2d629b7a8784ad42ff3d2e37a6a533742b79997043a88a6
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.20175458 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