Skip to main content

PyPI version License: MIT Downloads LinkedIn

llm7-validator

llm7-validator is a Python package designed to validate message structures sent to LLM7-compatible chat completion APIs. It ensures that model names, messages, and attachments conform to the expected structure and size constraints.

Installation

To install llm7-validator, use pip:

pip install llm7-validator

Usage

Here is a minimal example of how to use it:

from llm7_validator import validate_chat_completion_request

check = validate_chat_completion_request({
    "model": "open-mistral-7b",
    "json_mode": True,
    "messages": [
        {"role": "system", "content": "hj"},
        {
            "role": "user",
            "content": [
                {"type": "text", "text": "What is this image?"},
                {"type": "image_url", "image_url": "https://example.com/image.png"},
            ],
        },
    ],
})

print(check)

Features

  • Verifies message format (role, content, etc.)

  • Validates model names against a dynamically fetched list from llm7-models.json

  • Checks:

    • Image URLs have allowed extensions (.png, .jpg, etc.)
    • Base64 image content length
    • Total request size (max 5 MB)
    • Required fields and optional tuning parameters
  • Uses cached HTTP responses for model list with a 5-minute expiration

Requirements

  • Python ≥ 3.10
  • pydantic==2.11.5
  • requests-cache==1.2.1

Contributing

Contributions, issues, and feature requests are welcome! Please visit the GitHub repo to get started.

License

llm7-validator is licensed under the MIT License.

Metadata

Release files for llm7-validator 2025.6.110528

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

Source distribution (sdist)

Source distribution for llm7-validator 2025.6.110528
File Size Uploaded Provenance
llm7_validator-2025.6.110528.tar.gz 4.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for llm7-validator 2025.6.110528
File Interpreter ABI Platform
llm7_validator-2025.6.110528-py3-none-any.whl Python 3 none any Details

Total release size: 10.0 kB

Release files / llm7_validator-2025.6.110528.tar.gz

Download URL llm7_validator-2025.6.110528.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4885fdeaa7805574802450abd6fb814bd4d1944b785bd22e653a6c06b20f6060
BLAKE2b-256 checksum
How to use checksums
f30acc2c2646ef309edf66e95b577f999aadf1d85f36b6ff4fed5dbff17c331f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.11

Release files / llm7_validator-2025.6.110528-py3-none-any.whl

Download URL llm7_validator-2025.6.110528-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a4bed50051616e34ee28f38cbaf98a42e5e635ca4abf1cbf055149e6ba722838
BLAKE2b-256 checksum
How to use checksums
6e9954288e9a1f5f868debda845d75adf1914cf5ca1b99de918e069b41853a50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.11

Security for llm7-validator 2025.6.110528

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
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