Member Junction
    Preparing search index...

    Self-managing TypeScript client for the Predictive Studio Python ML sidecar.

    Two topologies, chosen automatically:

    • Managed mode (default): start spawns the bundled FastAPI service (src/python/server.py) on 127.0.0.1 with an ephemeral port, reads PREDICTIVE_STUDIO_SIDECAR_PORT=<n> from its stdout, polls /health until ready, and registers SIGINT/SIGTERM/exit cleanup. On macOS it injects DYLD_LIBRARY_PATH=/opt/homebrew/opt/libomp/lib so xgboost/lightgbm load.
    • Remote mode: when a url option is given OR PREDICTIVE_STUDIO_SIDECAR_URL is set, it connects only — no child process is spawned — and start just verifies /health.

    The request/response contract is owned by @memberjunction/predictive-studio-core; this client adds no business logic.

    const s = new MLSidecar();
    await s.start();
    const trained = await s.train(trainRequest);
    const predictions = await s.predict(predictRequest);
    await s.stop();
    Index

    Constructors

    Properties

    DefaultRequestTimeoutMs: 300000 = 300_000

    Default per-request timeout (ms) — training can be slow.

    DefaultStartupTimeoutMs: 30000 = 30_000

    Default startup timeout (ms) for the managed Python process.

    PythonEnvVar: "PREDICTIVE_STUDIO_PYTHON" = 'PREDICTIVE_STUDIO_PYTHON'

    Env var naming an explicit interpreter for the managed sidecar (and its test runners).

    Accessors

    Methods

    • Start the sidecar.

      • Remote mode: verifies /health against the configured URL.
      • Managed mode: spawns the Python service and resolves once it is ready.

      If already running, this is a no-op.

      Returns Promise<void>

    • Pick the managed sidecar's interpreter: the explicit pythonPath option, then PREDICTIVE_STUDIO_PYTHON, then the package's bundled .venv, then python3. Blank strings count as absent at every step.

      Parameters

      • explicit: string
      • env: ProcessEnv
      • bundled: string

      Returns string