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

@thomasfosterau/effect-ai-ext

v0.2.0

Published

Provider-neutral AI service abstractions upstream Effect lacks — reranker, classifier, TTS, STT, image, moderation, voice conversion — each shaped like effect/unstable/ai.

Readme

@thomasfosterau/effect-ai-ext

Provider-neutral AI service abstractions that upstream Effect (effect/unstable/ai) does not yet ship. effect/unstable/ai gives you LanguageModel, EmbeddingModel, Tokenizer, Tool/Toolkit, Chat, Prompt/Response, Model, AiError, and Telemetry — and nothing for reranking, classification, speech, transcription, image generation, moderation, or voice conversion.

This package fills that gap in upstream's own idiom. Every module is written as if it could merge into effect/unstable/ai itself — the same shape as EmbeddingModel:

  • a Context.Service tag (@thomasfosterau/effect-ai-ext/<Module>),
  • Schema.Class response/usage models,
  • caller Options vs normalised ProviderOptions/ProviderResponse contracts,
  • a Service interface whose operations fail only through AiError,
  • a make(...) constructor that validates provider results before handing them back, wrapping each operation in Effect.withSpan.

No provider code, no HTTP — abstractions only. First-party provider packages (Cohere, Voyage, ElevenLabs, …) implement these services the same way effect-ai-mistral implements LanguageModel.

Install

pnpm add @thomasfosterau/effect-ai-ext effect

effect is a peer dependency (it must stay a singleton).

A superset of effect/unstable/ai

The package barrel re-exports every upstream effect/unstable/ai module (LanguageModel, EmbeddingModel, AiError, Tool/Toolkit, Chat, Prompt/Response, Model, Tokenizer, Telemetry, IdGenerator, …) alongside the abstractions below, so one import reaches the whole AI service surface — upstream and extension:

import { LanguageModel, EmbeddingModel, RerankerModel } from "@thomasfosterau/effect-ai-ext"

The re-exports are the same identities as effect/unstable/ai (effect is the singleton peer), so mixing the two import styles is safe — nothing is wrapped or shadowed. Prefer importing straight from effect/unstable/ai when you only need upstream modules.

Modules & their upstream-merge story

Each module is also available as a per-module subpath (mirroring how effect itself ships), e.g. @thomasfosterau/effect-ai-ext/RerankerModel.

| Module | Operation(s) | If it merged upstream | | --- | --- | --- | | RerankerModel | rerank | effect/unstable/ai/RerankerModel — the sibling of EmbeddingModel for relevance reordering. Validates indices (in range, unique, count ≤ topN), sorts by descending score, short-circuits empty inputs. | | ClassifierModel | classify, fromLanguageModel | effect/unstable/ai/ClassifierModel — single/multi-label text classification with confidences and optional example-shots. | | SpeechModel | generate, stream | effect/unstable/ai/SpeechModel — text-to-speech with both a one-shot buffer surface and a streaming surface, like LanguageModel.generateText/streamText. | | TranscriptionModel | transcribe | effect/unstable/ai/TranscriptionModel — speech-to-text with optional segment timestamps and detected language. | | ImageModel | generate | effect/unstable/ai/ImageModel — prompt-to-image with base64-or-bytes result parts. | | ModerationModel | moderate, fromLanguageModel | effect/unstable/ai/ModerationModel — per-category policy scores plus a flagged verdict. | | VoiceConversionModel | convert | effect/unstable/ai/VoiceConversionModel — re-voice audio into a target voice. |

ClassifierModel and ModerationModel additionally expose a fromLanguageModel adapter that backs the abstraction with any LanguageModel via structured-output prompting (LanguageModel.generateObject), running the model's output back through the same make validation path.

Example

import { Effect } from "effect"
import { RerankerModel } from "@thomasfosterau/effect-ai-ext"

// A provider package builds the service via RerankerModel.make(...);
// consumers depend on the tag.
const program = Effect.gen(function* () {
  const reranker = yield* RerankerModel.RerankerModel
  const response = yield* reranker.rerank({
    query: "best editor",
    documents: ["vim", "emacs", "nano"],
    topN: 2,
  })
  return response.results // sorted by descending relevanceScore
})

Backing a classifier with a language model:

import { Effect, Layer } from "effect"
import { LanguageModel } from "effect/unstable/ai"
import { ClassifierModel } from "@thomasfosterau/effect-ai-ext"

declare const SomeLanguageModelLayer: Layer.Layer<LanguageModel.LanguageModel>

const ClassifierLayer = Layer.effect(
  ClassifierModel.ClassifierModel,
  ClassifierModel.fromLanguageModel,
).pipe(Layer.provide(SomeLanguageModelLayer))

RerankerModel moved here

RerankerModel previously lived in @thomasfosterau/effect-ai-gateway — a reranker abstraction never belonged in a routing package. It now lives here; the gateway package re-exports it from @thomasfosterau/effect-ai-ext/RerankerModel through a deprecation shim.

Development

Part of the effect-ai-ext monorepo. See AGENTS.md for the toolchain.

pnpm run check   # type-check (native TS7 tsc)
pnpm run test    # vitest (stubbed fixtures, no live network)
pnpm run build   # tsup → one dist file per module entry

License

MIT