How to install the ClearRun SDK

Run npm install @clearrun/sdk. It works in Node.js 18 or newer. You can start in mock mode with no key, then add a key for real scores.

Last updated

Steps

  1. Install

    npm install @clearrun/sdk
  2. Try it with no key

    import { createKernelClient } from '@clearrun/sdk';
    
    const client = createKernelClient({ forceMock: true });
    const { verdict } = await client.score({ responseText: 'Our API never stores customer data.' });
    console.log(verdict.score, verdict.summary);

    This is a mock score. It is not a real evaluation.

  3. Switch to real scores

    Remove forceMock and set CLEARRUN_API_KEY. See How to create a ClearRun client (createKernelClient).

Types

TypeScript types ship with the package. The shared verdict types come from @clearrun/core-types, which installs with it.