rudra-js

createNullSpecCache

import { createNullSpecCache } from '@rudra-js/core';

Call createNullSpecCache to get a cache that stores nothing, so none of the model's answers outlive the request.

createNullSpecCache() => SpecCache

Reference

createNullSpecCache()

Returns

A SpecCache to pass to createComponentGenerator as cache. Its get always resolves to undefined, and its set keeps nothing. It has no delete.

Caveats

  • With a provider, every request waits for the model. A page the model answered a moment ago gets a new call.
  • Every read is a miss, so the event's cache is never 'hit'.

Usage

Keeping no cache at all

Pass it when the model's answers can't be kept, such as when they hold shopper data you have to delete on request.

import { createAnthropicProvider } from '@rudra-js/anthropic';
import { createComponentGenerator, createNullSpecCache } from '@rudra-js/core';

export const generator = createComponentGenerator({
  provider: createAnthropicProvider({ apiKey: process.env.ANTHROPIC_API_KEY! }),
  cache: createNullSpecCache(),
});

For the rest of what a privacy review asks, see Running it in a regulated shop.