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.
- 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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mores-0.1.2.tar.gz | 5.5 kB | Without provenance | Details for mores-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mores-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for mores-0.1.2-py3-none-any.whl |
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
|
Security for mores 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.