You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

@braum-ai/sdk

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package was removed
Sorry, it seems this package was removed from the registry

@braum-ai/sdk

Braum JavaScript SDK

0.0.7
unpublished
latest
Source
npmnpm
Version published
Maintainers
1
Created
Source

TypeScript / JavaScript SDK

This is the official Braum AI SDK for TypeScript / JavaScript.

Installation

# npm
npm install @braum-ai/sdk

# yarn
yarn add @braum-ai/sdk

# pnpm
pnpm add @braum-ai/sdk

Usage

import { BraumAPI } from "@braum-ai/sdk";

const client = new BraumAPI({
  apiKey: "braum_api_key",
  modelId: "braum_model_id",
  projectId: "braum_project_id",
});

const items = await client.recommend({
  context: {
    user_id: 1,
  },
});

console.log(items);

// [
//   {
//     id: '847',
//     score: 0.99,
//   },
//   {
//     id: '1244',
//     score: 0.998,
//   },
//   {
//     id: '97714',
//     score: 0.985,
//   },
//   ...
// ]

Recommend similar items

import { BraumAPI } from "@braum-ai/sdk";

const client = new BraumAPI({
  apiKey: "braum_api_key",
  modelId: "braum_model_id",
  projectId: "braum_project_id",
});

const items = await client.recommendSimilar(4562, {
  context: {
    user_id: 1,
  },
});

Sort items in personalized order

import { BraumAPI } from "@braum-ai/sdk";

const client = new BraumAPI({
  apiKey: "braum_api_key",
  modelId: "braum_model_id",
  projectId: "braum_project_id",
});

const items = await client.sort([4562, 1245, 245], {
  context: {
    user_id: 1,
  },
});
import { BraumAPI } from "@braum-ai/sdk";

const items = await client.recommend({
  options: {
    limit: 100,
  },
  context: {
    user_id: 1,
  },
  filters: [
    {
      query: "SELECT * FROM items WHERE type = 'shoes'",
    },
  ],
});

Boost certain type of content (e.g. shoes)

import { BraumAPI } from "@braum-ai/sdk";

const items = await client.recommend({
  options: {
    limit: 100,
  },
  context: {
    user_id: 1,
  },
  boosters: [
    {
      query:
        "SELECT *, CASE type WHEN 'shoes' THEN 1.2 WHEN 'hoodies' THEN 1.5 ELSE 1 END AS factor FROM items",
    },
  ],
});

Recommend sections (blueprints)

const sections = await client.blueprints.fetch("blueprint_id", {
  context: {
    variables: {
      game_id_one: "asdas",
      game_id_two: "asdsaa",
      list_of_users: [
        212, 3123, 12312, 312, 312
      ]
    }
  }
})

const items = await client.blueprints.recommend({
  sections: [
    {
      name: "asdas",
      method: "asdas",
      filters: [
        {
          query: "SELECT * FROM items WHERE type = 'shoes'",
        },
      ],
      boosters: [
        {
          query: "SELECT *, CASE type WHEN 'shoes' THEN 1.2 ELSE 1 END AS factor FROM items",
        }
      ]
      options: {
        limit: 10,
      },
    },
  ],
  context: {
    user_id: 1,
  },
});

FAQs

Package last updated on 28 Jun 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.