GASP (Gee Another Schema Parser) - A validator for WAIL (Widely Applicable Interface Language) schemas and JSON
Project description
GASP (Gee Another Schema Parser)
GASP is a high-performance Rust-based parser and validator for WAIL (Widely Applicable Interface Language) schemas and JSON responses. It's specifically designed to work with Large Language Models (LLMs) by providing robust error recovery for common LLM response quirks.
What is WAIL?
WAIL (Widely Applicable Interface Language) is a schema language designed for:
- Generating type-validated LLM prompts
- Validating JSON responses from LLMs
- Providing clear error messages for schema violations
Features
- Robust Error Recovery: Handles common LLM response issues like trailing commas, unquoted identifiers, and malformed JSON
- Type Validation: Strong type checking for both schema definitions and JSON responses
- High Performance: Written in Rust with Python bindings for optimal speed
- Developer Friendly: Clear error messages and intuitive schema syntax
- LLM-Optimized: Specifically designed to work with the quirks and inconsistencies of LLM outputs
Installation
pip install gasp-py
Usage
from gasp_py import WAILValidator
# Create a validator with your WAIL schema
validator = WAILValidator("""
// Define your schema here
template Response {
name: String,
age: Number,
interests: Array<String>
}
""")
# Validate JSON responses
try:
validator.validate_json("""
{
"name": "Alice",
"age": 25,
"interests": ["coding", "AI", "music"]
}
""")
except Exception as e:
print(f"Validation error: {e}")
Error Recovery
GASP includes built-in error recovery for common LLM response issues:
- Trailing commas in arrays and objects
- Unquoted identifiers in object keys
- Missing quotes around strings
- Inconsistent whitespace and formatting
License
Apache License, Version 2.0 - see LICENSE file for details.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gasp_py-0.1.1.tar.gz.
File metadata
- Download URL: gasp_py-0.1.1.tar.gz
- Upload date:
- Size: 29.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad14e421baede75ed1be430877ed1f24163c28c8280aba0322e780c4ed3aa336
|
|
| MD5 |
645c11b6036d3bd0ed5f096d6c9322fc
|
|
| BLAKE2b-256 |
ab2fa8ee7f0f490704661d0c9fbed2809d2fe401ab393054e488b757bacbc79d
|
File details
Details for the file gasp_py-0.1.1-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: gasp_py-0.1.1-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 235.3 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.8.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6c59555107e8b2ce7707757b53731aff4f15d7d4ce161ca60241536da3a776ce
|
|
| MD5 |
516a9881e8467e094ea9cfd3cf834514
|
|
| BLAKE2b-256 |
0fa8c76422ecd76a4be19cc308d87d1d8746e78f981e954c7c51cd9a52262f1f
|