0.0.6 • Published 6 months ago

hiveminded-js v0.0.6

Weekly downloads
-
License
-
Repository
-
Last release
6 months ago

HiveMindedJS

HiveMindedJS is a credit management system designed to help AI developers quickly build applications without worrying about credit management. It provides a simple and intuitive API to manage credits for different users and sessions.

Installation

npm install hiveminded-js

Quickstart

Import HiveMinded.

import HiveMinded from 'hiveminded-js';

Initialize your app at the root of your project.

HiveMinded.init({organizationID: '<--- YOUR-ORG --->', namespace: '<--- YOUR-APP --->'});

Create a session (1 per user).

const session = HiveMinded.createSession({userID: 'my-user'});

You can then manage credits for this session using the following methods:

session.consume(1); // Consume 1 credit
session.refund(1); // Refund 1 credit
sesion.credits(); // Returns number of credits assigned to the user.

Example

session.consume(1);

try {

    // Your cool ai code here
    //...

} catch (err) {
    session.refund(1);
}
0.0.6

6 months ago

0.0.5

6 months ago

0.0.4

6 months ago

0.0.3

6 months ago

0.0.2

6 months ago

0.0.1

6 months ago