April

TypeScript SDK

April 3rd, 2023

We now have a fully typed TypeScript SDK to make working with Humanloop even easier.

https://www.npmjs.com/package/humanloop

You can use this with your JavaScript, TypeScript or Node projects.

Installation

$npm i humanloop

Example usage

1import { Humanloop } from "humanloop"
2
3const humanloop = new Humanloop({
4 // Defining the base path is optional and defaults to https://api.humanloop.com/v3
5 // basePath: "https://api.humanloop.com/v3",
6 apiKey: 'API_KEY',
7})
8
9
10const chatResponse = await humanloop.chat({
11 "project": "project_example",
12 "messages": [
13 {
14 "role": "user",
15 "content": "Write me a song",
16 }
17 ],
18 "provider_api_keys": {
19 "openai": OPENAI_API_KEY
20 },
21 "model_config": {
22 "model": "gpt-4",
23 "temperature": 1,
24 },
25})
26
27console.log(chatResponse)