cognitive-decision
v0.1.0
Published
Tiny SDK to call the Cognitive Decision classification API
Maintainers
Readme
cognitive-decision
Tiny SDK to call the classify method of the Cognitive Decision.
Installation
You can install from your repo or publish the package. For local testing, from the project root:
npm install ./sdkUsage (CommonJS / Node)
const { ClassifierClient } = require('cognitive-decision');
// No URL required — defaults to the public deployment
const client = new ClassifierClient();
(async () => {
const resp = await client.classify('I love transformers!', ['positive','negative']);
console.log(resp);
})();Usage (TypeScript / ESM)
import { ClassifierClient } from 'cognitive-decision';
// No options required — defaults to https://cognitive-decision.vercel.app
const client = new ClassifierClient();
const resp = await client.classify('I love transformers!', ['positive','negative']);
console.log(resp);Notes
- The SDK uses the global
fetchAPI. In Node.js versions older than 18, installnode-fetchin your project:
npm install node-fetch- The SDK defaults the API base URL to https://cognitive-decision.vercel.app.
