safespeak
Version:
A TypeScript/JavaScript SDK to integrate with safespeak
78 lines (60 loc) • 1.91 kB
Markdown


SafeSpeak is an API for profanity monitoring with **numeric** scores, the higher the more profane/toxic the message content is.
* [NPM](https://npmjs.com/package/safespeak)
* [Website](https://safespeak-api.vercel.app)
| Method | Route | Parameters |
| --- | --- | --- |
| GET | /api | `message`, `showMessage?` |
- `showMessage=true` – include original message in response
```json
{
"score": 0.6,
"tags": ["profanity"],
"content": "your message here" // Only if showMessage=true
}
```
---
SafeSpeak provides a TypeScript/JavaScript SDK [package](https://npmjs.com/package/safespeak) to easily integrate with SafeSpeak without using `fetch()`.
You can get started by running
```
npm i safespeak@latest
```
You can get the numeric `score` of content by using the `getScore` function provided by the SDK
```ts
import { safespeak } from "safespeak";
async function myTestFunction(message: string) {
console.log(await safespeak.getScore(message))
}
myTestFunction("All crispy clean 🔥")
```
The `isProfane` function provided by the SDK returns a boolean value
* `true` if the `score` is larger than the threshold
* `false` if the `score` is lesser than the threshold
```ts
import { safespeak } from "safespeak";
async function myTestFunction(message: string) {
const THRESHOLD = 0.6;
console.log(await safespeak.isProfane(message, THRESHOLD))
}
myTestFunction("All crispy clean 🔥")
```
* Next.js 15
* TypeScript
* shadcn/ui
* Prism.js
* TailwindCSS
* TypeScript
* Express
* Ollama (w/ llama3 model)
* JSONL