Metadata-Version: 2.4
Name: sematryx
Version: 0.1.0
Summary: Python SDK for Sematryx - AI-powered optimization that explains itself
Project-URL: Homepage, https://sematryx.com
Project-URL: Documentation, https://sematryx.com/docs
Project-URL: Repository, https://github.com/sematryx/sematryx-python
Project-URL: Changelog, https://github.com/sematryx/sematryx-python/releases
Author-email: Sematryx <support@sematryx.com>
License-Expression: MIT
License-File: LICENSE
Keywords: ai,constraint-optimization,explainable-ai,machine-learning,optimization,portfolio-optimization,supply-chain
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Mathematics
Requires-Python: >=3.9
Requires-Dist: httpx>=0.24.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: rich>=13.0.0
Requires-Dist: typer>=0.9.0
Provides-Extra: dev
Requires-Dist: black>=23.0; extra == 'dev'
Requires-Dist: mypy>=1.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21; extra == 'dev'
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Description-Content-Type: text/markdown

# Sematryx Python SDK

Official Python SDK for [Sematryx](https://sematryx.com) - AI-powered optimization that explains itself.

## Installation

```bash
pip install sematryx
```

## Quick Start

```python
from sematryx import Sematryx

client = Sematryx(api_key="sk-your-api-key")

# Simple optimization
result = client.optimize(
    objective="minimize",
    variables=[
        {"name": "x", "bounds": (-5, 5)},
        {"name": "y", "bounds": (-5, 5)},
    ],
    objective_function="x**2 + y**2",
)

print(f"Solution: {result.solution}")  # {'x': 0.0, 'y': 0.0}
print(f"Explanation: {result.explanation}")
```

## Features

- **Simple API** - One function call to optimize
- **Explainable Results** - Understand why the optimizer made its decisions
- **Audit Trails** - Full traceability for regulated industries
- **Private Learning** - Your optimizations improve over time
- **Domain Libraries** - Pre-built for finance, healthcare, supply chain

## CLI Usage

```bash
# Install
pip install sematryx

# Set API key
export SEMATRYX_API_KEY=sk-your-api-key

# Run optimization
sematryx optimize "x**2 + y**2" --bounds '{"x": [-5, 5], "y": [-5, 5]}'

# Check usage
sematryx usage
```

## Async Support

```python
from sematryx import AsyncSematryx

async with AsyncSematryx(api_key="sk-...") as client:
    result = await client.optimize(
        objective="minimize",
        variables=[{"name": "x", "bounds": (-5, 5)}],
        objective_function="x**2",
    )
```

## Portfolio Optimization

```python
result = client.optimize_portfolio(
    assets=["AAPL", "GOOGL", "MSFT", "AMZN"],
    returns=[0.12, 0.10, 0.08, 0.15],
    covariance=[...],  # 4x4 covariance matrix
    target_return=0.10,
    max_position=0.4,
    explanation_level=3,
)

print(result.solution)  # {'AAPL': 0.25, 'GOOGL': 0.20, ...}
print(result.explanation)  # "Allocated to maximize Sharpe ratio..."
```

## Private Learning Store

Your optimizations improve over time:

```python
result = client.optimize(
    ...,
    learning={
        "read_from_private": True,   # Learn from your past optimizations
        "write_to_private": True,    # Store this result for future learning
    }
)
```

## Documentation

Full documentation at [sematryx.com/docs](https://sematryx.com/docs)

## License

MIT

