A super fast API Wrapper for Perspective.
- Node >= 16
- Perspective API Access
Install using one of these commands (depending on your package manager):
npm i velocity-api
pnpm i velocity-api
yarn add velocity-api
- Note: This is a basic usage guide.
import{Velocity}from'velocity-api';(async()=>{constmanager=newVelocity('PERSPECTIVE_API_KEY');constscores=awaitmanager.processMessage("I don't like you!",{attributes: ['SPAM','SEVERE_TOXICITY'],languages: ['en'],doNotStore: true,});// The returned value is an object of the attributes and their score.console.log(scores.SPAM);console.log(scores.SEVERE_TOXICITY);})();const{ Velocity }=require('velocity-api');(async()=>{constmanager=newVelocity('PERSPECTIVE_API_KEY');constscores=awaitmanager.processMessage("I don't like you!",{attributes: ['SPAM','SEVERE_TOXICITY'],languages: ['en'],doNotStore: true,});// The returned value is an object of the attributes and their score.console.log(scores.SPAM);console.log(scores.SEVERE_TOXICITY);})();This repository is licensed under the Apache 2.0 License.