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

@betterdb/ai

v1.0.1

Published

One install for the BetterDB AI stack on Valkey: agent cache, semantic cache, retrieval, agent memory, and search helpers

Readme

@betterdb/ai

One install for the BetterDB AI stack on Valkey.

npm install @betterdb/ai iovalkey

Usage

import Valkey from 'iovalkey';
import { AgentCache, SemanticCache, MemoryStore, Retriever } from '@betterdb/ai';

const client = new Valkey({ host: 'localhost', port: 6379 });
const cache = new AgentCache({ client });

Framework adapters

| Import | Provides | | ------------------------------- | ------------------------------------------------------------- | | @betterdb/ai/langchain | BetterDBLlmCache, BetterDBSemanticCache | | @betterdb/ai/langgraph | BetterDBSaver, BetterDBSemanticStore | | @betterdb/ai/vercel | createAgentCacheMiddleware, createSemanticCacheMiddleware | | @betterdb/ai/openai | prepareParams, prepareSemanticParams | | @betterdb/ai/openai-responses | prepareParams, prepareSemanticParams | | @betterdb/ai/anthropic | prepareParams, prepareSemanticParams | | @betterdb/ai/llamaindex | prepareParams, prepareSemanticParams |

Install the matching framework yourself. Six framework peers are optional (/openai and /openai-responses both use the openai peer) — iovalkey is the seventh peer and is required.

Subpath imports (everything but the root @betterdb/ai import) require "moduleResolution" set to "node16", "nodenext", or "bundler" in your tsconfig.json. The root import works under classic "node" resolution too.

Embedding functions

SemanticCache requires an embedFn to turn text into a vector. Bring your own, or use one of these provider-backed factories:

| Import | Provides | | ---------------------------- | -------------------- | | @betterdb/ai/embed/openai | createOpenAIEmbed | | @betterdb/ai/embed/bedrock | createBedrockEmbed | | @betterdb/ai/embed/voyage | createVoyageEmbed | | @betterdb/ai/embed/cohere | createCohereEmbed | | @betterdb/ai/embed/ollama | createOllamaEmbed | | @betterdb/ai/embed/google | createGoogleEmbed |

import { SemanticCache } from '@betterdb/ai';
import { createOpenAIEmbed } from '@betterdb/ai/embed/openai';

const cache = new SemanticCache({ client, embedFn: createOpenAIEmbed() });

Namespaces

A handful of names are declared by more than one underlying package, so they are not exported flat. Reach them through the namespace for the package you want:

import Valkey from 'iovalkey';
import { AgentCache, agentCache, semanticCache } from '@betterdb/ai';

const cache = new AgentCache({ client: new Valkey() });

try {
  await cache.llm.check({
    model: 'claude-sonnet-4-5',
    messages: [{ role: 'user', content: 'hello' }],
  });
} catch (err) {
  if (err instanceof agentCache.ValkeyCommandError) {
    // agent-cache errors extend AgentCacheError
  } else if (err instanceof semanticCache.ValkeyCommandError) {
    // semantic-cache's ValkeyCommandError extends Error — a different class
    // that happens to share the name
  }
}

const block: agentCache.ContentBlock = { type: 'text', text: 'hello' };

Namespaces: agentCache, semanticCache, retrieval, memory, searchKit. Each mirrors the corresponding package's full root export surface, so anything not available flat is available here.

Relationship to the individual packages

@betterdb/ai re-exports, and pins exact versions of:

They remain published and supported. Install them directly if you want a narrower dependency; install @betterdb/ai if you want the whole stack at one mutually-compatible set of versions.

Versioning

Facade releases are automatic patch bumps triggered by each child's own release, and may carry breaking changes from a child package. Consumers who need strict semver guarantees should pin @betterdb/ai to an exact version.