JavaScript SDK

Official JavaScript/TypeScript SDK for Sematryx. Works in Node.js, browsers, and modern JavaScript environments.

Install the JavaScript SDK
npm install @sematryx/javascript-sdk

The SDK requires Node.js 16+ or a modern browser with ES6+ support.

Initialize the SDK with your API key and start optimizing:

Basic usage example
import { Sematryx } from '@sematryx/javascript-sdk'

const sematryx = new Sematryx('your-api-key')

// Define objective function
const sphere = (x) => {
  return x.reduce((sum, val) => sum + val * val, 0)
}

// Run optimization
const result = await sematryx.optimize({
  objective_function: sphere,
  bounds: [[-5, 5], [-5, 5]],
  max_evaluations: 1000
})

console.log('Best solution:', result.best_solution)
console.log('Best fitness:', result.best_fitness)