3.2.0 • Published 2 years ago
humanloop-typescript-sdk v3.2.0
humanloop-typescript-sdk@3.2.0
This library that utilizes axios. The generated Node module can be used in the following environments:
Environment
- Node.js
- Webpack
- Browserify
Language level
- ES5 - you must have a Promises/A+ library installed
- ES6
Module system
- CommonJS
- ES6 module system
Building
To build and compile the typescript sources to javascript use:
npm install
npm run build
Consuming
navigate to the folder of your consuming project and run the following command.
npm install humanloop-typescript-sdk@3.2.0 --save
Getting Started
import { Humanloop } from "humanloop-typescript-sdk"
const humanloop = new Humanloop({
// Defining the base path is optional and defaults to https://api.humanloop.com/v3
// basePath: "https://api.humanloop.com/v3",
apiKey: 'API_KEY',
})
const submitResponse = await humanloop.feedback({
"type": "string_example",
})
console.log(submitResponse)
const generateResponse = await humanloop.generate({
"project": "project_example",
"inputs": {},
"provider_api_keys": {
},
"num_samples": 1,
"stream": false,
"model_config": {
"model": "model_example",
"prompt_template": "prompt_template_example",
"temperature": 1,
"max_tokens": 16,
"top_p": 1,
"presence_penalty": 0,
"frequency_penalty": 0,
},
})
console.log(generateResponse)
const logResponse = await humanloop.log({
"project": "project_example",
"inputs": {},
"output": "output_example",
})
console.log(logResponse)
Documentation for API Endpoints
All URIs are relative to https://api.humanloop.com/v3
Class | Method | HTTP request | Description |
---|---|---|---|
ExperimentsApi | create | POST /projects/{project_id}/experiments | Create Project Experiment |
ExperimentsApi | delete | DELETE /experiments/{experiment_id} | Delete Experiment |
ExperimentsApi | getModelConfig | GET /experiments/{experiment_id}/model-config | Get Model Config From Experiment |
ExperimentsApi | list | GET /projects/{project_id}/experiments | Get Project Experiments |
ExperimentsApi | update | PATCH /experiments/{experiment_id} | Update Experiment |
FeedbackApi | submit | POST /feedback | Feedback |
GenerateApi | generate | POST /generate | Generate |
LogsApi | log | POST /logs | Log |
MetricsApi | create | POST /projects/{project_id}/metrics | Create Metric |
MetricsApi | delete | DELETE /projects/{project_id}/metrics/{metric_id} | Delete Metric |
MetricsApi | list | GET /projects/{project_id}/metrics | Get Metrics |
MetricsApi | update | PATCH /projects/{project_id}/metrics/{metric_id} | Update Metric |
ModelConfigsApi | get | GET /model-configs/{id} | Get Model Config |
ModelConfigsApi | register | POST /model-configs | Register Project Model Config |
OrganizationsApi | createTool | POST /organizations/{id}/tools | Create Organization Tool |
OrganizationsApi | get | GET /organizations/{id} | Get Organization |
OrganizationsApi | getApiKeys | GET /organizations/{id}/api-keys | Get Api Keys |
OrganizationsApi | getSubscriptions | GET /organizations/{id}/subscriptions | Get Organization Subscriptions |
OrganizationsApi | getTools | GET /organizations/{id}/tools | Get Organization Tools |
OrganizationsApi | removeUser | DELETE /organizations/{id}/users/{user_id} | Remove User From Organization |
OrganizationsApi | update | PATCH /organizations/{id} | Update Organization |
OrganizationsApi | updateTool | PATCH /organizations/{id}/tools/{tool_id} | Update Organization Tool |
OrganizationsApi | updateUserRole | PUT /organizations/{id}/users/{user_id}/role | Update Organization User Role |
ProjectsApi | create | POST /projects | Create Project |
ProjectsApi | deleteActiveExperiment | DELETE /projects/{id}/active-experiment | Delete Active Experiment |
ProjectsApi | deleteActiveModelConfig | DELETE /projects/{id}/active-model-config | Delete Active Model Config |
ProjectsApi | exportDatapoints | POST /projects/{id}/export | Export Datapoints |
ProjectsApi | get | GET /projects/{id} | Get Project |
ProjectsApi | getModelConfig | GET /projects/{id}/model-config | Get Model Config From Project |
ProjectsApi | getModelConfigs | GET /projects/{id}/model-configs | Get Project Model Configs |
ProjectsApi | list | GET /projects | Get Projects |
ProjectsApi | update | PATCH /projects/{id} | Update Project |
ProjectsApi | updateFeedbackTypes | PATCH /projects/{id}/feedback-types | Update Feedback Types |
ToolsApi | getSpecs | GET /tools | Get Tool Specs |