0.1.11 • Published 9 months ago

@kluai/core v0.1.11

Weekly downloads
-
License
ISC
Repository
-
Last release
9 months ago

Klu.ai Typescript SDK

Description

Klu.ai SDK for building AI-powerered apps

The Klu.ai Typescript SDK is a library that provides access to the Klu API, allowing developers to interact with their Klu workspace, including: Apps, Actions, Context, Data, and Models.

Requirements

The Klu.ai Typescript SDK can be installed in any JS / TS environment. The only requirements is to have npm.

Installation

To install the Klu.ai Typescript SDK, simply run:

pnpm i @kluai/core

Getting Started

First obtain an API key from your Klu workspace. Using your API key, create a klu object:

import Klu from '@kluai/core';

const klu = new Klu('YOUR_API_KEY');

Models

With the klu object, you can access the Models available in your Klu workspace:

import Klu from '@kluai/core';

const klu = new Klu('YOUR_API_KEY');
const models = await klu.models.getAllModels();

Get Apps

To list all Apps in your workspace, use:

import Klu from '@kluai/core';

const klu = new Klu('YOUR_API_KEY');
const apps = await klu.apps.paginator.list();

Action with Variables

Action prompts support dynamic variables injected at run time.

import Klu from '@kluai/core';

const klu = new Klu('API_KEY');

async function promptAction() {
  const result = klu.actions.prompt(actionId, {
    topic: 'Machine Learning.',
    task: 'Correct any grammar or spelling mistakes.',
  });
  console.log(result);
}

promptAction();

Streaming

Streaming is commonly used to improve the user experience. A unique streaming url generates as part of the Action response and the Klu SDK manages the SSR session.

import Klu from '@kluai/core';

const klu = new Klu('YOUR_API_KEY');

const dataStream = await klu.actions.stream('actionGuid', 'prompt input');
for await (const token of dataStream) {
  tokens.push(token || '');
}

Get Action Data

Get a list of Data generations for an Action, you can use:

import Klu from '@kluai/core';

const klu = new Klu('YOUR_API_KEY');
const data = await klu.actions.getData('actionGUID');

Documentation

For more detailed information on how to use the Klu.ai Typescript SDK, please refer to the SDK documentation.

License

Free Software: MIT License

The Klu SDK is open source software released under the MIT License. This permissive license allows you to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Klu SDK, subject to a few simple conditions:

  • Copyright notice - You must include the copyright notice in all copies or substantial portions of the software.
  • License notice - You must include the license notice in all copies or substantial portions of the software.
  • Warranty disclaimer - The software is provided "as is" without warranty of any kind. The authors and copyright holders are not liable for any claim, damages or other liability.
  • Liability limitation - In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise.
0.1.11

9 months ago

0.1.10

10 months ago

0.1.8

1 year ago

0.1.9

10 months ago

0.1.7

1 year ago

0.1.67

1 year ago

0.0.66

1 year ago

0.0.63

1 year ago

0.0.64

1 year ago

0.0.65

1 year ago

0.0.62

1 year ago

0.0.61

1 year ago

0.0.6

1 year ago

0.0.59

1 year ago

0.0.58

1 year ago

0.0.57

1 year ago

0.0.55

1 year ago

0.0.56

1 year ago

0.0.54

1 year ago

0.0.53

1 year ago

0.0.52

2 years ago

0.0.51

2 years ago

0.0.50

2 years ago

0.0.48

2 years ago

0.0.49

2 years ago

0.0.47

2 years ago

0.0.45

2 years ago

0.0.46

2 years ago

0.0.44

2 years ago

0.0.43

2 years ago

0.0.42

2 years ago

0.0.41

2 years ago

0.0.40

2 years ago

0.0.39

2 years ago

0.0.38

2 years ago

0.0.37

2 years ago

0.0.36

2 years ago

0.0.35

2 years ago

0.0.34

2 years ago

0.0.33

2 years ago

0.0.32

2 years ago

0.0.31

2 years ago

0.0.30

2 years ago

0.0.29

2 years ago

0.0.28

2 years ago

0.0.27

2 years ago

0.0.26

2 years ago

0.0.25

2 years ago

0.0.23

2 years ago

0.0.22

2 years ago

0.0.21

2 years ago

0.0.20

2 years ago

0.0.19

2 years ago

0.0.15

2 years ago

0.0.14

2 years ago

0.0.13

2 years ago

0.0.11

2 years ago