mallam
TypeScript icon, indicating that this package has built-in type declarations

1.0.51 • Public • Published

MaLLaM NPM Package 🌙

A zero dependency wrapper around Malaysia Large Language Model(MaLLaM) for javascript users.

Credits to Mesolitica for this amazing API

Downloads

Why?

  • Easier to modify the parameters using javascript syntaxes
  • Easy implementation for MaLLaM 🌙 in your NodeJS app
  • Helps non-phyton user to use the Mallam 🌙 API in their app

API Key

Get your API key from Mesolitica Website

Usage

Chat Completion

import { Mallam } from "mallam";

const mallam = new Mallam("your_api_key_here");

(async() => {
  const res = await mallam.chatCompletion("berapa average harga rumah dekat johor?");
  console.log(res);
})()

Chat Completion with configuration(Not Stream)

import { Mallam } from "mallam";

const mallam = new Mallam("your_api_key_here");

(async() => {
  const res = await mallam.chatCompletion("berapa average harga rumah dekat johor?", {
        temperature: 0.5,
        top_p: 0.95,
        top_k: 50,
        max_tokens: 256,
        stream: false
    });
  console.log(res);
})()

Chat Completion with configuration(Streaming Response)

import { Mallam } from "mallam";

const mallam = new Mallam("your_api_key_here");

(async() => {
  const res = await mallam.chatCompletion("berapa average harga rumah dekat johor?", {
        stream: true
  }); 

  const reader = res.getReader();
  while (true) {
	const { done, value } = await reader.read();
	if (done) break;
	  console.log(value); // This will log each chunk as it arrives
	}
})()

Available configuration:

Parameter Default Value
model "mallam-small"
temperature 0.9
top_p 0.95
top_k 50
max_tokens 256
stream false

create embeddings

import { mallam } from "mallam";

const mallam = new mallam("your_api_key_here");

(async() => {
  const res = await mallam.createEmbedding("saya sayang ibu saya");
  console.log(res);
})()

Translation

import { mallam } from "mallam";

const mallam = new mallam("your_api_key_here");

(async() => {
  const res = await mallam.translate("ddoes god reward the misunderstood or do I just have to deal with people invalidating how I truly feel all the time");
  console.log(res);
})()

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.0.511latest

Version History

VersionDownloads (Last 7 Days)Published
1.0.511
1.0.500
1.0.490
1.0.480
1.0.462
1.0.450
1.0.440
1.0.430
1.0.420
1.0.410
1.0.400
1.0.390
1.0.380
1.0.371
1.0.360
1.0.350
1.0.340
1.0.330
1.0.320
1.0.310
1.0.300
1.0.290
1.0.280
1.0.270
1.0.260
1.0.250
1.0.240
1.0.230
1.0.220
1.0.210
1.0.200
1.0.191
1.0.181
1.0.171
1.0.161
1.0.151
1.0.140
1.0.130
1.0.120
1.0.110
1.0.100
1.0.90
1.0.80
1.0.70
1.0.60
1.0.50
1.0.40
1.0.30
1.0.20
1.0.11
1.0.00

Package Sidebar

Install

npm i mallam

Weekly Downloads

10

Version

1.0.51

License

MIT

Unpacked Size

24.7 kB

Total Files

19

Last publish

Collaborators

  • nrmnqdds