@commonbase/sdk
TypeScript icon, indicating that this package has built-in type declarations

0.15.2 • Public • Published

Commonbase Typescript SDK for building LLM integrations faster and easier

npm version

Commonbase allows developers to integrate with any popular LLM API provider without needing to change any code. The SDK helps with collecting data and feedback from the users and helps you fine-tune models for your specific use case.

Installation

Install Commonbase from npm using your preferred package manager:

npm add @commonbase/sdk
pnpm add @commonbase/sdk
yarn add @commonbase/sdk

Usage

A Project ID and API Key are required for all Commonbase requests. You can find your project ID and generate an API key in the Commonbase Dashboard.

To create a completion, configure a Client with your API Key and provide your Project ID and prompt to createCompletion.

import { Client } from "@commonbase/sdk";

const client = new Client({
  apiKey: "API_KEY",
});

const completion = await client.createCompletion({
  projectId: "PROJECT_ID",
  prompt: "Hello",
});

console.log(completion.bestChoice.text);

To stream a completion as it is generated, use streamChatCompletion.

For more examples, see /examples.

Package Sidebar

Install

npm i @commonbase/sdk

Weekly Downloads

5

Version

0.15.2

License

MIT

Unpacked Size

11.5 kB

Total Files

4

Last publish

Collaborators

  • commonbasebot
  • heikir