UNPKG

@flike/recommend

Version:

Wrapper for the Flike Recommendation API.

61 lines (50 loc) 1.48 kB
More information about Flike can be found [here](https://goflike.app). ## Installation Install the [@flike/recommend](https://www.npmjs.com/package/@flike/recommend) package: ``` npm install @flike/recommend ``` ## Quick Guide 1. Install the module as described in [Installation](#installation). 2. Import the module into your code ```typescript import {Recommender} from '@flike/recommend ``` 3. Instantiate the `Recommender` with your API key. ```typescript const recommender = new Recommender(<your API key>); ``` 4. Retrieve recommendations in real time: ```typescript const recs = await recommender.recommend("<user_id>", 6); console.log(recs); // { // items: [ // { // item_id: "eE8iqyS3nEYGMdSFVa4T", // probability: 0.4804032, // }, // { // item_id: "uItDAqQhm5MMXtJRGXUx", // probability: 0.1196371, // }, // { // item_id: "ZpJCKlbj7fglMhTzPFCQ", // probability: 0.041603, // }, // { // item_id: "YUrKof1INQJ2HMzWnVar", // probability: 0.024264, // }, // { // item_id: "mDSLnJEe37qEYsLpM2dG", // probability: 0.018669, // }, // ], // correlation_id: "cid-9461ba9d-856d-4d5e-b776-bb90e6eed35d", // } ``` ## Reference Refer to the [library reference](https://flikeapp.github.io/flike-predict-npm/classes/Recommender.html) for further documentation.