The Lume Typescript Client Library is currently in beta. Please reach out to our support team if you have any questions or feature requests, or encounter any bugs.

Install

Download the Typescript Client Library using your favorite package manager.

Quickstart

Retrieve your input data and target schema.

data.json
[
    {
        "name": "Barry Devlin",
        "nickname": "Baz",
        "years_old": 42
    },
    {
        "name": "Paul Murphy",
        "nickname": "Polly",
        "years_old": 37
    }
]

Our internal schema can be represented in JSON Schema format as follows:

schema.json
{
    "type": "object"
    "properties": {
        "first_name": {
            "description": "The first name of the user.",
            "type": "string"
        },
        "last_name": {
            "description": "The last name of the user.",
            "type": "string"
        },
        "age": {
            "description": "The age of the user in years.",
            "type": "integer"
        }
    },
    "required": [
        "first_name",
        "last_name",
        "age",
    ]
}

All we need to do is create a flow with our target schema and run it with our source data to retrieve the transformed data:

import { Lume } from '@lume-ai/typescript-sdk';
import data from './data.json'
import schema from './schema.json'

const lume = new Lume('api_key');

// Method 1: Create, run, and get results in one go
const flow = await lume.flowService.createAndRunFlow({
  name: "my_flow",
  description: "Process customer data",
  target_schema: schema,
  tags: ["customers"]
}, {
  source_data: data
}, true);

// Get results from the latest run
const results = await flow.getLatestRunResults();

// Method 2: Process data with an existing flow
const flowId = "existing-flow-id";
const existingFlow = await lume.flowService.getFlow(flowId);
const moreResults = await existingFlow.process(newData);

Usage

Refer to the Library Overview for more information. The full client library is viewable on GitHub. For more detailed examples, check out our Quickstart Guide.