@interpretai/sdk
v0.1.10
Published
Official TypeScript / JavaScript SDK for the InterpretAI public HTTP API.
Readme
@interpretai/sdk
Official TypeScript / JavaScript SDK for the InterpretAI public HTTP API.
npm install @interpretai/sdkimport { createClient } from '@interpretai/sdk';
const client = createClient({ apiKey: process.env.INTERPRETAI_API_KEY! });
const { jobId } = await client.publicReviewer.submit({
subjects: [
{ text: 'Loves trail running and surfing.', label: 'a' },
{ text: 'Mostly reads indoors.', label: 'b' },
],
prompt: 'Which subject is more outdoorsy?',
modelTier: 'tsmall',
});
const result = await client.publicReviewer.wait(jobId, { timeoutMs: 120_000 });
console.log(result.score, result.reasoning);See the top-level SDK README for the full design notes.
Resources
client.auth.me()— connectivity / API-key smoke test.client.publicReviewer.{submit, get, wait}— pair-compare scoring.client.ssc.{submit, get, wait}— Spec/Submittal compliance SRS one-shot review.client.rca.{submit, get, wait}— Root-cause analysis jobs.
Per-request overrides
const fast = client.withOptions({ timeoutMs: 10_000, maxRetries: 0 });
await fast.publicReviewer.submit({ ... });
await client.publicReviewer.submit({ ... }, { extraHeaders: { 'X-Trace': 'abc' } });Requirements
Node 18+, modern browsers, or any runtime with the Web Fetch API,
AbortController, and crypto.randomUUID() available globally.
Scripts
npm install
npm run typecheck
npm test
npm run build