Skip to content

v0.11.0

Latest
Compare
Choose a tag to compare
@futurisold futurisold released this 16 May 09:26

Release Notes for v0.11.0

✨ New Features

  • Contract Performance Statistics Tracking

    • Added a contract_perf_stats method to contract-decorated classes, which tracks and reports granular timing statistics (mean, std, min, max, percentage) for each contract operation: input validation, act execution, output validation, forward execution, total execution, and "overhead" (untracked contract time).
    • Unit tests exercise and validate this detailed performance statistics capability.
  • Improved Type and Semantic Validation

    • The contract mechanism now leverages a single TypeValidationFunction to handle both type and semantic validation, streamlining error handling and remedy functions.
    • The previously separate SemanticValidationFunction is now unified, reducing code duplication and making semantic and type checks more consistent.
  • Rich Field Descriptions for LLM Guidance

    • Strongly encourage and enforce the use of descriptive Field(description="...") for all LLMDataModel attributes. These descriptions are directly used to improve LLM prompting, validation, error messages, and data generation.
    • Updated documentation with clearer guidance and rationale on crafting informative descriptions and prompts.

🐛 Bug Fixes & Refactorings

  • Refined Contract Input and Output Handling

    • The contract decorator now strictly enforces keyword arguments (no positional input) and validates the input type up-front.
    • Input object identity and propagation through the contract lifecycle are preserved and tested (no accidental re-instantiation).
  • Improved Error Reporting & Context

    • Type and semantic validation errors are now accumulated and reported with greater clarity when remedy retries are enabled.
    • Error accumulation context is correctly passed to remedies, improving developer diagnostics.
  • Act Method Refactoring

    • The act method inside contracts is validated for correct signature and type annotations.
    • If no act is defined, the input is propagated unchanged, simplifying state-modifying contracts.
  • Output Type Checks

    • Output from contracts is checked against expected type annotation, with informative error messages if mismatches are detected.
  • Contract Performance Test Coverage

    • New and expanded tests for:
      • End-to-end contract flows with state-modifying act methods.
      • Verification that the same input object is propagated and contract state changes are handled as expected.
      • Tracking and assertion of contract performance statistics.
  • Codebase Cleanup

    • Removed unused imports (e.g., SemanticValidationError class and related references).
    • Simplified logic around data model registration and remedy handling.

📘 Documentation

  • Expanded and clarified the documentation for contracts, field descriptions, prompt design, and the role of pre/post validation.
  • Added best practices for driving LLMs with meaningful validation and semantic checks.
  • Highlighted the separation of static contract prompts and dynamic input state.

Full Changelog: v0.10.0...v0.11.0