API Reference
Available Packages
Overseer provides two SDK packages:
@overseerai/sdk- Node.js SDK@overseerai/sdk-typescript- TypeScript SDK with type safety
Installation
npm install @overseerai/sdkOverseer Class
The main class for interacting with the Overseer SDK.
Constructor
constructor(config: { apiKey: string })Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| apiKey | string | Yes | Your system-specific API key from the connections page in the dashboard |
Methods
validate
async validate(content: string): Promise<ValidationResult>Validates the safety of a piece of content.
ValidationResult
| Property | Type | Description |
|---|---|---|
| isAllowed | boolean | Whether the content is safe |
| text | string | The validated content |
| details | object | Additional details about validation result |
| details.reason | string | Reason for rejection if content is not allowed |
Example Usage
import { Overseer } from '@overseerai/sdk';
// Initialize the clientconst overseer = new Overseer({ apiKey: 'your-api-key' // From connections page in dashboard});
// Validate contenttry { const result = await overseer.validate('Hello! How can I help you today?'); if (result.isAllowed) { console.log('Content is safe:', result.text); } else { console.log('Content was rejected:', result.text); console.log('Reason:', result.details?.reason); }} catch (error) { console.error('Error validating content:', error);}Installation
npm install @overseerai/sdk-typescriptOverseer Class
The main class for interacting with the Overseer SDK with full type safety.
Constructor
constructor(config: { apiKey: string })Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| apiKey | string | Yes | Your system-specific API key from the connections page in the dashboard |
Methods
validate
async validate(content: string): Promise<ValidationResult>Validates the safety of a piece of content.
ValidationResult
| Property | Type | Description |
|---|---|---|
| valid | boolean | Whether the content is safe |
| content | string | The validated content |
| issues | string[] | List of issues found if content is not valid |
Example Usage
import { Overseer } from '@overseerai/sdk-typescript';
// Initialize with type-safe configconst overseer = new Overseer({ apiKey: 'your-api-key' // From connections page in dashboard});
// Validate with type-safe optionsconst result = await overseer.validate('Hello! How can I help you today?');
if (result.valid) { console.log('Content is safe:', result.content);} else { console.log('Issues found:', result.issues);}Environment Variables
| Name | Required | Description |
|---|---|---|
| API_KEY | Yes | Your system-specific API key from the connections page in the dashboard |