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

@novahelm/ai

v2026.6.1

Published

@novahelm/ai — Anthropic/Claude adapter: streamChat, AnthropicAdapter, RAG.

Readme

@novahelm/ai

AI integration for NovaHelm — the first-party AI surface for the platform and consumer apps. Exposes createAIProvider, streamChat, AnthropicAdapter (default), OpenAIAdapter, and OllamaAdapter, plus RAG, content pipelines, caching, rate limiting, and usage tracking. Consumers should only import from @novahelm/ai — never ai / @ai-sdk/* directly (the provider SDKs are an internal implementation detail and may change).


Quick Start

pnpm add @novahelm/ai
import { createAIProvider, streamChat } from "@novahelm/ai";

const ai = createAIProvider({
  provider: "anthropic",
  apiKey: "sk-...",
  defaultModel: "claude-sonnet-4-20250514",
});

// Stream a chat response
const stream = await streamChat({
  ai,
  messages: [{ role: "user", content: "Summarize this article..." }],
});

for await (const chunk of stream) {
  process.stdout.write(chunk);
}

RAG (Retrieval-Augmented Generation)

Index documents and search by semantic similarity using pgvector:

import { indexDocument, semanticSearch, chunkText } from "@novahelm/ai";

// Index a document (chunks + embeds automatically)
await indexDocument({
  ai,
  db,
  content: articleBody,
  metadata: { type: "article", id: article.id },
});

// Search by meaning
const results = await semanticSearch({
  ai,
  db,
  query: "How do I deploy to production?",
  limit: 5,
});

Content Pipeline

Run AI-powered content processing (summarize, tag, generate SEO):

import { runContentPipeline } from "@novahelm/ai";

const result = await runContentPipeline({
  ai,
  content: post.body,
  steps: ["summarize", "extract-tags", "generate-meta"],
});
// result.summary, result.tags, result.meta

Prompt Templates

Define reusable, parameterized prompt templates:

import { definePromptTemplate, renderPrompt } from "@novahelm/ai";

definePromptTemplate({
  id: "blog-outline",
  template: "Write an outline for a blog post about {{topic}} targeting {{audience}}.",
  variables: [
    { name: "topic", required: true },
    { name: "audience", default: "developers" },
  ],
});

const prompt = renderPrompt("blog-outline", { topic: "WebSockets" });

Caching

Cache AI responses in Redis to reduce costs and latency:

import { createAICache, withCache } from "@novahelm/ai";

const cache = createAICache({ redis, ttlSeconds: 3600 });

const response = await withCache(cache, {
  messages: [{ role: "user", content: "What is NovaHelm?" }],
  generate: () => streamChat({ ai, messages }),
});

Fallback Providers

Automatic failover between AI providers:

import { createFallbackProvider } from "@novahelm/ai";

const resilientAi = createFallbackProvider({
  providers: [
    { provider: "anthropic", apiKey: "..." },
    { provider: "openai", apiKey: "..." },
  ],
});

Client Hook

import { useNovaChat } from "@novahelm/ai/client";

function ChatUI() {
  const { messages, send, isStreaming } = useNovaChat({
    endpoint: "/api/chat",
  });

  return <button onClick={() => send("Hello!")}>Ask</button>;
}

API Reference

| Export | Description | |--------|-------------| | createAIProvider(config) | Initialize AI provider (Anthropic, OpenAI, Ollama) | | streamChat(opts) | Stream a chat completion | | semanticSearch(opts) | Vector similarity search (pgvector) | | indexDocument(opts) | Chunk and embed a document | | chunkText(text, opts) | Split text into chunks | | runContentPipeline(opts) | Run multi-step AI content processing | | extractTags(opts) | AI-powered tag extraction | | extractTagsNLP(text) | NLP-based tag extraction (no AI call) | | createAICache(config) | Create Redis-backed response cache | | withCache(cache, opts) | Wrap generation with caching | | createFallbackProvider(config) | Multi-provider failover | | definePromptTemplate(config) | Register a reusable prompt template | | renderPrompt(id, vars) | Render a template with variables | | createResilientStream(opts) | Stream with automatic retry | | createAIRateLimiter(config) | Token/request rate limiter | | trackUsage(opts) | Record token usage for billing | | getUsageSummary(range) | Query usage stats | | useNovaChat(opts) | React hook for chat UI (from /client) |