Skip to main content

Strux is a Python framework for structured outputs model versioning

Project description

Strux

Strux is a Python library for building type-safe regression testing pipelines for structured outputs. It enables developers to easily validate model outputs against expected schemas and thresholds with minimal boilerplate.

Python 3.10+

Key Features

  • 🔒 Type-Safe: Built on Pydantic for robust schema validation and type checking
  • 🔄 Flexible Pipelines: Chain multiple inference steps with automatic schema validation
  • 📊 Configurable Validation: Define strict, relaxed, or custom validation strategies
  • 🔌 Extensible: Built-in PostgreSQL support with easy extension for other data sources
  • 📈 Rich Results: Detailed validation reports with field-level insights

Quick Start

from strux import Sequential, RegressionConfig, ValidationLevel
from pydantic import BaseModel

Define your Schemas

class InputSchema(BaseModel):
    value: float
    text: str

class OutputSchema(BaseModel):
    processed: bool
    confidence: float

Define your Inference Function

def process_text(data: InputSchema) -> OutputSchema:
    return OutputSchema(
    processed=data.text.upper(),
    confidence=data.value 100
)

Create and run pipeline

pipeline = Sequential.from_steps(
    data_source=your_data_source,
    steps=[
        ("process", process_text, OutputSchema)
    ],
config=RegressionConfig(
    OutputSchema,
    strict_fields=["processed"],
    relaxed_fields=["confidence"]
    )
)
results = pipeline.run()

Installation

pip install strux

Why Strux?

  • Type Safety: Catch schema mismatches early with Pydantic validation
  • Flexible Validation: Configure different validation levels per field
  • Pipeline Composition: Chain multiple inference steps with automatic validation
  • Production Ready: Built-in support for batch processing and error handling

Documentation

For detailed documentation, see the docs/ directory:

Contributing

Contributions are welcome! Please read our Contributing Guidelines for details.

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

strux-0.1.1.tar.gz (77.1 kB view details)

Uploaded Source

Built Distribution

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

strux-0.1.1-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file strux-0.1.1.tar.gz.

File metadata

  • Download URL: strux-0.1.1.tar.gz
  • Upload date:
  • Size: 77.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.12

File hashes

Hashes for strux-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b05b5d28901c0182ef71ec07a4c4bc379c4a74a8199eb502f92f16d7ce7073c1
MD5 6f54e190d4e50374b993b7df5a382267
BLAKE2b-256 f1b871031b634fb414c8112339353ab120537f23d6cd882cd1e2cd16d2fe4ffb

See more details on using hashes here.

File details

Details for the file strux-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: strux-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.12

File hashes

Hashes for strux-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 182caebc92e75d7ffd8e60f7f0c1a6a71da47704ddb587cb035c0c5e6be5ae5c
MD5 5f4086870adc810613c7e200f8c15782
BLAKE2b-256 e53fb466c2317fb6463df823e1e920ae3b96fde521c6cbf2c86711112236cbbd

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