Skip to main content

Add your description here

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.0.tar.gz (51.9 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.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: strux-0.1.0.tar.gz
  • Upload date:
  • Size: 51.9 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.0.tar.gz
Algorithm Hash digest
SHA256 46593206669ebbcc15d664f6cca1c6f392c31e07e7553b640bf046eea366b55a
MD5 134941c46e71bf56618881fb7400ca9f
BLAKE2b-256 561a5aa1121a7d9a74670023be21fbddbbd2e611fb2659b95073af29c1799b27

See more details on using hashes here.

File details

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

File metadata

  • Download URL: strux-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ef97b26bac4c96ac16a06c177be1008a861756e9002eaac1bf08d6faa6542aed
MD5 c2d0fe5801acddd3c525496170c50f60
BLAKE2b-256 36c34d7ff459d577770d246dd7ba2fa3bb18cb541d1a8fcb832bdf4dfe53a2fb

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