axisiscool / velocity

πŸ’¨ A super fast API Wrapper for Perspective

Home Page:https://npmjs.com/package/velocity-api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ’¨ Velocity

A super fast API Wrapper for Perspective.

Requirements

  • Node >= 16
  • Perspective API Access

Installation

Install using one of these commands (depending on your package manager):

npm i velocity-api
pnpm i velocity-api
yarn add velocity-api

Example Usage

  • Note: This is a basic usage guide.

Typescript:

import { Velocity } from 'velocity-api';

(async () => {
  const manager = new Velocity('PERSPECTIVE_API_KEY');

  const scores = await manager.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);
})();

Javascript:

const { Velocity } = require('velocity-api');

(async () => {
  const manager = new Velocity('PERSPECTIVE_API_KEY');

  const scores = await manager.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);
})();

License

This repository is licensed under the Apache 2.0 License.

About

πŸ’¨ A super fast API Wrapper for Perspective

https://npmjs.com/package/velocity-api

License:Apache License 2.0


Languages

Language:TypeScript 100.0%