Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ai-driven

Package Overview
Dependencies
Maintainers
0
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ai-driven - npm Package Compare versions

Comparing version 0.1.1 to 1.0.1

10

package.json
{
"name": "ai-driven",
"version": "0.1.1",
"version": "1.0.1",
"license": "MIT",
"author": "Dimitry Ivanov <2@ivanoff.org.ua> # curl -A cv ivanoff.org.ua",
"description": "AI-Driven Assistant with zero dependencies",
"keywords": ["ai", "assistant"],
"description": "AI-driven tool for translation, text moderation, and sensitive image detection.",
"keywords": ["ai", "translation", "translate text", "text moderation", "sensitive image detection"],
"main": "./dist/index.js",

@@ -15,3 +15,7 @@ "types": "./dist/index.d.ts",

"@types/node": "^20.14.9"
},
"repository": {
"type": "git",
"url": "https://github.com/ivanoff/ai-driven.git"
}
}
# ai-driven
An AI-powered content analysis and moderation toolkit using Claude API.
`ai-driven` is a TypeScript module that provides easy-to-use functions for **content moderation**, **text translation**, and **image analysis**.
## Description
It leverages the power of Claude AI to perform various tasks such as:
`ai-driven` is a TypeScript module that provides easy-to-use functions for content moderation, text translation, and image analysis. It leverages the power of Claude AI to perform various tasks such as:
- Text translation

@@ -15,2 +13,21 @@ - Offensive language detection

## Example
### API Key
To use this library, you'll need an API key. You can obtain one from the Anthropic console:
[https://console.anthropic.com/settings/keys](https://console.anthropic.com/settings/keys)
### A Basic Example
```typescript
import Assistant from 'ai-driven';
const assistant = new Assistant({ apiKey: 'your_api_key_here' });
const translatedText = await assistant.translateText('Hello, world!', 'it');
console.log('Translated text:', translatedText); // =>
```
## Installation

@@ -21,11 +38,29 @@

```bash
npm install ai-driven
npm i -S ai-driven
```
Here's an improved version of the setup instructions, written as a native English-speaking programmer would:
## Setup
1. Create a `.env` file in the root of your project.
2. Add your Claude API key (required) and URL with Model to the `.env` file:
You can configure the assistant in two ways:
### Option 1: Direct Initialization
Provide the configuration when creating the assistant:
```typescript
const assistant = new Assistant({
apiKey: 'your_api_key_here',
apiUrl: 'https://api.anthropic.com/v1/messages', // optional
apiModel: 'claude-3-haiku-20240307' // optional
});
```
### Option 2: Using Environment Variables
1. Create a `.env` file in your project's root directory.
2. Add the following variables to the `.env` file:
```
CLAUDE_API_KEY=your_api_key_here

@@ -36,2 +71,4 @@ CLAUDE_API_URL=https://api.anthropic.com/v1/messages

The assistant will automatically use these environment variables if no configuration is provided during initialization.
## Usage

@@ -46,3 +83,3 @@

async function main() {
const assistant = new Assistant();
const assistant = new Assistant({ apiKey: 'your_api_key_here' });

@@ -100,1 +137,5 @@ // Translate text

[MIT](https://choosealicense.com/licenses/mit/)
## Created by
Dimitry Ivanov <2@ivanoff.org.ua> # curl -A cv ivanoff.org.ua

@@ -6,6 +6,10 @@ class Assistant {

constructor() {
this.apiKey = process.env.CLAUDE_API_KEY || '';
this.apiUrl = process.env.CLAUDE_API_URL || 'https://api.anthropic.com/v1/messages';
this.apiModel = process.env.CLAUDE_API_MODEL || 'claude-3-haiku-20240307';
constructor(options?: AssistantType) {
const { apiKey, apiUrl, apiModel } = options || {};
this.apiKey = apiKey || process.env.CLAUDE_API_KEY || '';
this.apiUrl = apiUrl || process.env.CLAUDE_API_URL || 'https://api.anthropic.com/v1/messages';
this.apiModel = apiModel || process.env.CLAUDE_API_MODEL || 'claude-3-haiku-20240307';
if (!this.apiKey) throw new Error('CLAUDE_API_KEY is not defined. You can obtain one from the Anthropic console: https://console.anthropic.com/settings/keys');
}

@@ -71,2 +75,8 @@

export type AssistantType = {
apiKey: string;
apiUrl?: string;
apiModel?: string;
};
export default Assistant;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc