prefai

0.0.5 • Public • Published

PrefAI Node.js Library

The PrefAI Node.js Library enables applications coded in node.js to interface with the PrefAI API.

It is not recommended to use this on a web client, as it would leak your API key.

Installation

Install with:

npm install prefai

Usage

The library needs an API key, which you get on your pref.ai developer account.

export PREFAI_API_KEY=<YOUR_SECRET_KEY>

We can now add a user record like this:

const PrefAI = require('prefai');

const apiKey = process.env.PREFAI_API_KEY;
const prefaiClient = new PrefAI(apiKey);

// Add record
prefaiClient.addRecord({
  user_email: "test@pref.ai",
  user_action: "What's a spicy appetizer you'd recommend for a BBQ with 6 people?",
});

For more information and next steps, read the quickstart.

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.5
    0
    • latest

Version History

Package Sidebar

Install

npm i prefai

Weekly Downloads

0

Version

0.0.5

License

MIT

Unpacked Size

4.24 kB

Total Files

4

Last publish

Collaborators

  • bobby-prefai