npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

unsiloed-sdk

v0.2.0

Published

JavaScript/TypeScript SDK for Unsiloed Vision API - Parse, Extract, Classify, and Split documents

Readme

Unsiloed JavaScript SDK

The official JavaScript/TypeScript SDK for Unsiloed - a powerful document processing platform that enables you to parse, extract, classify, and split documents with ease.

Features

  • Parse: Extract structured content from documents (PDFs, images, etc.)
  • Extract: Extract specific data using JSON schemas with citations
  • Classify: Classify documents into predefined categories
  • Split: Split document pages based on categories
  • Full TypeScript Support: Complete type definitions for all APIs
  • Promise-based: Works seamlessly with async/await

Installation

npm install unsiloed-sdk

or with yarn:

yarn add unsiloed-sdk

Quick Start

Basic Usage

import { UnsiloedClient } from 'unsiloed-sdk';

const client = new UnsiloedClient({ apiKey: 'your-api-key-here' });

const result = await client.parseAndWait({ file: 'document.pdf' });
console.log(`Total chunks: ${result.total_chunks}`);

Using with JavaScript (CommonJS)

const { UnsiloedClient } = require('unsiloed-sdk');

const client = new UnsiloedClient({ apiKey: 'your-api-key-here' });

client.parseAndWait({ file: 'document.pdf' })
  .then(result => console.log(`Total chunks: ${result.total_chunks}`))
  .catch(err => console.error(err));

Authentication

Get your API key from the Unsiloed Dashboard.

import { UnsiloedClient } from 'unsiloed-sdk';

const client = new UnsiloedClient({ apiKey: 'your-api-key-here' });

Set as environment variable:

export UNSILOED_API_KEY="your-api-key"
import { UnsiloedClient } from 'unsiloed-sdk';

const client = new UnsiloedClient({
  apiKey: process.env.UNSILOED_API_KEY || ''
});

Usage Examples

Parse Documents

Extract structured content from any document:

import { UnsiloedClient } from 'unsiloed-sdk';

const client = new UnsiloedClient({ apiKey: 'your-api-key' });

const result = await client.parseAndWait({
  file: 'document.pdf',
  mergeTables: true
});

console.log(result)

Extract Data with Schema

Define exactly what data you need using JSON schema:

import { UnsiloedClient } from 'unsiloed-sdk';

const schema = {
  type: 'object',
  properties: {
    invoice_number: {
      type: 'string',
      description: 'Invoice number from the document'
    },
    date: {
      type: 'string',
      description: 'Invoice date'
    },
    total_amount: {
      type: 'number',
      description: 'Total amount'
    }
  },
  required: ['invoice_number', 'date', 'total_amount'],
  additionalProperties: false
};

const client = new UnsiloedClient({ apiKey: 'your-api-key' });

const result = await client.extractAndWait({
  file: 'invoice.pdf',
  schema
});

// Results include confidence scores
console.log(`Invoice #: ${result.result?.invoice_number?.value}`);
console.log(`Confidence: ${result.result?.invoice_number?.score}`);
console.log(`Total: $${result.result?.total_amount?.value}`);

Classify Documents

Automatically categorize your documents:

import { UnsiloedClient } from 'unsiloed-sdk';

const client = new UnsiloedClient({ apiKey: 'your-api-key' });

const result = await client.classifyAndWait({
  file: 'document.pdf',
  categories: ['Invoice', 'Receipt', 'Contract', 'Letter']
});

console.log(`Type: ${result.result?.classification}`);
console.log(`Confidence: ${result.result?.confidence}`);

Split Documents

Separate multi-document files by page type:

import { UnsiloedClient } from 'unsiloed-sdk';

const categories = [
  { name: 'Cover Page', description: 'Document cover or title page' },
  { name: 'Main Content', description: 'Primary document content and body text' }
];

const client = new UnsiloedClient({ apiKey: 'your-api-key' });

const result = await client.splitAndWait({
  file: 'report.pdf',
  categories,
  maxWait: 1800000 // 30 minutes
});

// Check if split was successful
if (result.result?.success) {
  console.log(`✓ ${result.result.message}`);

  // Access the generated split files
  for (const fileInfo of result.result.files || []) {
    console.log(`File: ${fileInfo.name}`);
    console.log(`  Confidence: ${(fileInfo.confidence_score * 100).toFixed(2)}%`);
    console.log(`  Download: ${fileInfo.full_path}`);
  }
} else {
  console.log(`Split failed: ${result.result?.message}`);
}

Advanced Examples

Manual Polling

If you need more control over the polling process:

import { UnsiloedClient } from 'unsiloed-sdk';

const client = new UnsiloedClient({ apiKey: 'your-api-key' });

// Start parsing (non-blocking)
const response = await client.parse({
  file: 'document.pdf',
  mergeTables: true,
  useHighResolution: true
});

console.log(`Job ID: ${response.job_id}`);
console.log(`Initial status: ${response.status}`);

// Poll manually with custom logic
let result;
while (true) {
  result = await client.getParseResult(response.job_id);
  console.log(`Current status: ${result.status}`);

  if (['Succeeded', 'Failed', 'completed', 'failed'].includes(result.status)) {
    break;
  }

  await new Promise(resolve => setTimeout(resolve, 2000)); // Wait 2 seconds
}

if (['Succeeded', 'completed'].includes(result.status)) {
  console.log(`Total chunks: ${result.total_chunks}`);
}

Advanced Parse Configuration

const result = await client.parseAndWait({
  file: 'contract.pdf',
  mergeTables: true,
  enhancedTable: true,
  validateTableSegments: true,
  useHighResolution: true,
  ocrMode: 'auto_ocr',
  segmentationMethod: 'smart_layout_detection',
  keepSegmentTypes: 'Text,Table,Picture',
  segmentAnalysis: {
    Table: {
      html: 'LLM',
      markdown: 'LLM',
      extended_context: true,
      crop_image: 'All'
    },
    Picture: {
      crop_image: 'All',
      html: 'LLM',
      markdown: 'LLM'
    }
  }
});

Process Multiple Documents Concurrently

import { UnsiloedClient } from 'unsiloed-sdk';

const client = new UnsiloedClient({ apiKey: 'your-api-key' });

const files = ['doc1.pdf', 'doc2.pdf', 'doc3.pdf'];

// Process all files concurrently
const results = await Promise.all(
  files.map(file => client.parseAndWait({ file }))
);

results.forEach((result, i) => {
  console.log(`${files[i]}: ${result.status} - ${result.total_chunks} chunks`);
});

Using with Buffers

You can also pass file content as a Buffer:

import * as fs from 'fs';
import { UnsiloedClient } from 'unsiloed-sdk';

const client = new UnsiloedClient({ apiKey: 'your-api-key' });

const fileBuffer = fs.readFileSync('document.pdf');

const result = await client.parseAndWait({
  file: fileBuffer
});

Error Handling

import {
  UnsiloedClient,
  AuthenticationError,
  QuotaExceededError,
  InvalidRequestError
} from 'unsiloed-sdk';

const client = new UnsiloedClient({ apiKey: 'your-api-key' });

try {
  const result = await client.parseAndWait({ file: 'document.pdf' });
  console.log(result);
} catch (error) {
  if (error instanceof AuthenticationError) {
    console.error('Invalid API key');
  } else if (error instanceof QuotaExceededError) {
    console.error('Quota exceeded:', error.responseData);
  } else if (error instanceof InvalidRequestError) {
    console.error('Invalid request:', error.message);
  } else {
    console.error('Unexpected error:', error);
  }
}

API Methods

All methods return Promises and can be used with async/await or .then()/.catch().

Parse

  • parse(options) - Start parse job
  • getParseResult(jobId) - Check job status
  • parseAndWait(options) - Parse and wait for completion ⭐ Most common

Extract

  • extract(options) - Start extract job
  • getExtractResult(jobId) - Check job status
  • extractAndWait(options) - Extract and wait for completion ⭐ Most common

Classify

  • classify(options) - Start classify job
  • getClassifyResult(jobId) - Check job status
  • classifyAndWait(options) - Classify and wait for completion ⭐ Most common

Split

  • split(options) - Start split job
  • getSplitResult(jobId) - Check job status
  • splitAndWait(options) - Split and wait for completion ⭐ Most common

Tip: Use the *AndWait() methods for simpler code. They handle polling automatically.

Configuration Options

Client Configuration

const client = new UnsiloedClient({
  apiKey: 'your-api-key',
  baseUrl: 'https://prod.visionapi.unsiloed.ai', // Optional
  timeout: 300000 // Optional, in milliseconds (default: 5 minutes)
});

Polling Configuration

const result = await client.parseAndWait({
  file: 'document.pdf',
  pollInterval: 2000,  // Check every 2 seconds (default)
  maxWait: 600000      // Maximum 10 minutes (default)
});

TypeScript Support

This SDK is written in TypeScript and includes complete type definitions. You'll get full IntelliSense and type checking in supported editors.

import { UnsiloedClient, ParseResponse, ExtractResponse } from 'unsiloed-sdk';

const client = new UnsiloedClient({ apiKey: 'your-api-key' });

// TypeScript knows the return type
const result: ParseResponse = await client.parseAndWait({
  file: 'document.pdf'
});

Examples

Check the examples/ directory for complete working examples:

  • parse-example.ts - Document parsing
  • extract-example.ts - Data extraction
  • classify-example.ts - Document classification
  • split-example.ts - Document splitting

Support

  • Documentation: https://docs.unsiloed.ai/
  • API Reference: https://docs.unsiloed.ai/api-reference
  • Support Email: [email protected]
  • Issues: https://github.com/unsiloed/unsiloed-sdk-js/issues

License

MIT License - see LICENSE file for details.