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

@kognitivedev/documents

v0.2.29

Published

Cloud document SDK for Kognitive parsing, extraction, and pipelines APIs

Readme

@kognitivedev/documents

TypeScript SDK for the Kognitive Documents API.

Use it to upload files, create parse jobs, run schema-based extraction, and work with managed document pipelines.

Managed pipelines are the canonical knowledge-base resource in Kognitive. The dashboard "Knowledge bases" view, cloud pipeline APIs, and @kognitivedev/cloud-knowledge-base all use the same pipeline IDs and indexed artifacts.

Pipeline search is Qdrant hybrid by default: parsed artifacts are indexed with dense embeddings plus Qdrant BM25 sparse vectors, so semantic questions and exact keyword/ID lookups both work.

Installation

bun add @kognitivedev/documents

Common Flow

Most applications start with:

  1. Upload a file
  2. Optionally parse it
  3. Optionally extract structured fields directly from the uploaded file
import { KognitiveDocumentsClient } from "@kognitivedev/documents";

const documents = new KognitiveDocumentsClient({
  baseUrl: "http://localhost:3001",
  apiKey: process.env.KOGNITIVE_API_KEY,
  logLevel: "debug",
});

const file = await documents.files.upload({
  filename: "invoice.pdf",
  mimeType: "application/pdf",
  data: await Bun.file("./invoice.pdf").arrayBuffer(),
});

const extractJob = await documents.extract.createJob({
  fileId: file.id,
  config: {
    target: "per_doc",
    tier: "cost_effective",
    preset: "invoice",
    schema: {
      type: "object",
      properties: {
        invoiceNumber: { type: "string" },
        total: { type: "string" },
        status: { type: "string" },
      },
    },
    citeSources: true,
    confidenceScores: true,
  },
});

const extraction = await documents.extract.waitForCompletion(extractJob.id);
console.log(extraction.payload);

If you also need the parsed text, read the completed extraction job and fetch its derived parse result:

const completedExtractJob = await documents.extract.getJob(extractJob.id);
const parsed = await documents.parsing.getResult(completedExtractJob.parsingJobId!);

Easiest Parse Options

Start with:

  • tier
  • preset
  • targetPages
await documents.parsing.createJob({
  fileId,
  tier: "agentic",
  preset: "scientific",
  targetPages: [1, 2],
});

Presets

  • invoice: invoices, receipts, bills
  • scientific: papers and research PDFs
  • technicalDocumentation: technical docs and manuals
  • forms: forms and checklists

If you are unsure, start with:

{ tier: "cost_effective" }

Common Methods

Files

  • files.upload()
  • files.list()
  • files.get()
  • files.download()
  • files.delete()

Parsing

  • parsing.createJob()
  • parsing.waitForCompletion()
  • parsing.getJob()
  • parsing.getResult()
  • parsing.getPage()
  • parsing.getArtifacts()

Extraction

  • extract.createConfig()
  • extract.updateConfig()
  • extract.createJob()
  • extract.waitForCompletion()

Pipelines

  • pipelines.create()
  • pipelines.addFile()
  • pipelines.sync() returns a queued pipeline run (202 Accepted)
  • pipelines.listRuns()
  • pipelines.getRun()
  • pipelines.search()
  • pipelines.searchImages()

Pipeline defaults are intentionally zero-config:

  • embeddings: text-embedding-3-small
  • vector store: Qdrant
  • retrieval: Qdrant hybrid BM25 sparse-vector + dense semantic
  • retrieval modes: chunks, files_via_metadata, files_via_content, auto_routed

Managed pipeline indexing requires REDIS_URL, QDRANT_URL, and OPENROUTER_API_KEY on the backend. Sync is worker-backed and asynchronous; poll pipelines.getRun() or pipelines.getStatus() until the run completes before search. QDRANT_API_KEY is optional for local deployments and required when your Qdrant instance uses API-key auth. PgVectorStore remains available in @kognitivedev/rag for local/custom RAG, but it is not the managed knowledge-base default.

For production retrieval integrations, prefer:

  • @kognitivedev/documents when you want the raw pipeline lifecycle and search APIs
  • @kognitivedev/cloud-knowledge-base when you want normalized citations, agent context adapters, and workflow KB steps

Logging

Enable SDK request logging with:

const documents = new KognitiveDocumentsClient({
  baseUrl: "http://localhost:3001",
  apiKey: process.env.KOGNITIVE_API_KEY,
  logLevel: "debug",
});

This logs SDK request and response activity in your browser or Node process.