Python SDK
Official Python SDK for Sematryx. Full-featured client library with support for optimization, intelligence configuration, and domain-specific libraries.
Install the Python SDK
pip install sematryxThe SDK requires Python 3.8 or higher. For domain-specific optimizations, install with extras:
Install with domain libraries
pip install sematryx[financial,healthcare,supply_chain]The simplest way to use Sematryx is with the main sematryx() function:
Basic optimization example
from sematryx import optimize
# Define your objective function
def sphere(x):
return sum(xi**2 for xi in x)
# Run optimization (cloud API - requires API key)
result = optimize(
objective_function=sphere,
bounds=[[-5, 5], [-5, 5]],
max_evaluations=1000,
api_key="sk-..." # or set SEMATRYX_API_KEY env var
)
print(f"Best solution: {result.solution}")
print(f"Best value: {result.objective_value}")