Skip to main content

Mores

LLM-powered Python decorators for intelligent function behavior. Add validation, mocking, and output checking to your functions with a single line of code.

Installation

{pip, uv} install mores

Setup

Configure

export MORES_API_KEY=gsk_your_key_here
export MORES_SERVER_URL=https://mores.fulcrumresearch.ai

Decorators

All decorators support two modes, depending on latency and intelligence requirements, passed in as keyword arguments - mode=fast and mode=slow.

@guard - Pre-execution Validation

Validates function calls against custom rules before execution.

Basic Usage:

@guard(rules=[
    "Never allow deletion",
    "Only allow amounts under 100"
])
def transfer(amount: float, delete: bool = False):
    """Transfer an amount."""
    if delete:
        return "deleted"
    return f"transferred {amount}"

result = transfer(50, delete=False)  # ✓ Returns Value
result = transfer(200, delete=False)  # ✗ Returns Rejected
result = transfer(50, delete=True)   # ✗ Returns Rejected

Processing Guard Results:

By default, @guard returns a Maybe type (either Value or Rejected). You can handle this in the following way.

  1. Pattern matching with match/case (default):
result = transfer(50, delete=False)
match result:
    case Value(data=data):
        # Function executed successfully
        print(f"Success: {data}")
    case Rejected(reason=reason):
        # Call was rejected
        print(f"Error: {reason}")

You can also @guard(..., raise_reject=True) to return the raw output, and raise if an error is caught.

@mock - LLM-Generated Output

Replaces function execution with AI-generated mock output based on the function signature and documentation.

from mores import mock

@mock()
def calculate_fibonacci(n: int):
    """Calculate the nth Fibonacci number."""
    pass  # Implementation doesn't matter

result = calculate_fibonacci(10)
print(result)  # LLM-generated Fibonacci number

@doubt - Post-execution Validation

Validates that function output is correct given its inputs and implementation. Raises DoubtError if the output appears incorrect.

from mores import doubt, DoubtError

@doubt()
def add(a: int, b: int):
    """Add two numbers."""
    return a + b

# Correct implementation passes
result = add(2, 3)  # Returns 5, no error

# Incorrect implementation raises error
@doubt()
def broken_add(a: int, b: int):
    """Add two numbers."""
    return a * b  # Wrong! Multiplying instead

try:
    broken_add(2, 3)
except DoubtError as e:
    print(e.reason)  # "The function should add but it's multiplying..."

Metadata

Release files for mores 0.1.2

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

Source distribution (sdist)

Source distribution for mores 0.1.2
File Size Uploaded
mores-0.1.2.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mores 0.1.2
File Interpreter ABI Platform
mores-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 10.1 kB

Release files / mores-0.1.2.tar.gz

Download URL mores-0.1.2.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4cf73b83037086d08191cd7bf810d5467749edf88796d36ac89a295c044a4baa
BLAKE2b-256 checksum
How to use checksums
2e7b64f9ca09919d3e523998e32795acad4eb445594bef73dd7b25ecbe2c76b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.24

Release files / mores-0.1.2-py3-none-any.whl

Download URL mores-0.1.2-py3-none-any.whl
Size 4.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ef49d2aed71710535fcd0998aec1bccab5fb319fb179d1c3d9bf59e327e8f4f
BLAKE2b-256 checksum
How to use checksums
57c94307fabb3b293a7b230e38330d43da6b2061a7d7dff6bbe89e8fdd5fdfeb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.24

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

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