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

@langextract-ts/langextract

v0.1.0

Published

TypeScript information extraction library built on AI SDK v6, inspired by Google langextract.

Readme

Purpose

@langextract-ts/langextract is the TypeScript-native public package for language extraction workflows. This package defines stable entrypoints and contracts while implementation details stay behind internal module boundaries.

Attribution

This package is an independent TypeScript port of the original Google langextract project:

It is not an official Google package.

Public API

Current public API surface:

  • extract: extraction orchestration and high-level pipeline entrypoints.
  • io: document/file input and output contracts.
  • progress: terminal-friendly progress formatting and descriptors.
  • visualization: result rendering and visual summary contracts.
  • providers: model/provider wiring contracts for AI SDK v6 integrations.
  • types: shared public type exports for callers and adapters.
  • errors: exported error classes and error code contracts.

Public import example:

import { extract, createProviderRegistry } from "@langextract-ts/langextract";

Subpath entrypoint examples:

import { extract } from "@langextract-ts/langextract/extract";
import { resolveModel } from "@langextract-ts/langextract/providers";

Legacy compatibility aliases (for migration ergonomics):

  • @langextract-ts/langextract/extraction -> extract
  • @langextract-ts/langextract/factory -> providers
  • @langextract-ts/langextract/exceptions -> errors

Import Rules

  • Import through package entrypoints only.
  • Do not import from src/internal/*.
  • Do not use relative imports across package boundaries.

Provider Routing Policy

  • Routing is registry-first: provider/model resolution flows through the provider registry before model creation.
  • Default public model route is google/gemini-3-flash.
  • Alias lifecycle policy for this route is documented as Active -> Deprecated -> Sunset -> Removed in migration docs.
  • Sunset aliases are blocked by default; set LANGEXTRACT_ALLOW_SUNSET_ALIASES=1 only for temporary migration overrides.

Warning Codes

extract(...) supports onWarning and emits stable warning codes:

  • alias_lifecycle: model alias is deprecated/sunset (routing still resolved).
  • batch_length_below_max_workers: maxWorkers exceeds batchLength.
  • missing_examples: examples were omitted for extraction calls.
  • prompt_alignment_failed: prompt validation found extraction text that cannot align to source text.
  • prompt_alignment_non_exact: prompt validation found non-exact alignment.
  • schema_fences_incompatible: schema constraints are enabled while resolver fences are enabled for raw-output schema providers.
  • schema_wrapper_incompatible: schema constraints are enabled while resolver wrapper key mode is enabled for raw-output schema providers.
  • schema_constraints_ignored_with_explicit_model: caller provided model directly while enabling useSchemaConstraints.
  • provider_environment: provider environment policy produced warnings (for example conflicting API key env vars).

Validation Controls

extract(...) exposes two independent validation controls:

  • promptValidationLevel (off | warn | error): controls example alignment preflight validation (failed / non-exact extraction alignment checks).
  • promptLintLevel (off | warn | error, default off): controls prompt-string lint checks (empty prompt, unresolved template variables, missing JSON instruction when applicable).

Compatibility alias:

  • prompt_lint_level is supported for snake_case callers.

Example:

import { extract } from "@langextract-ts/langextract";

await extract({
  textOrDocuments: "Invoice total is 124.50 EUR",
  promptDescription: "Extract the currency amount",
  examples: [
    {
      text: "Subtotal is 10.00 USD",
      extractions: [{ extractionClass: "amount", extractionText: "10.00 USD" }],
    },
  ],
  promptValidationLevel: "warn", // alignment preflight
  promptLintLevel: "off", // prompt lint (default is off)
});

Status

Migration hardening is active. Public contracts above are versioned, covered by parity-focused tests, and protected by architecture/release governance checks.