Skip to content

LakBud/vernLLM

Repository files navigation

vernLLM logo

VernLLM

Documentation · Package

test status lint status npm version license pnpm monorepo

A lightweight resilience layer for OpenAI-compatible chat completion calls — retries, timeouts, circuit breaking, caching, structured output, and usage tracking, with one interface across providers.

import OpenAI from 'openai';
import { VernLLM } from 'vern-llm';

const llm = new VernLLM({
  client: new OpenAI({ apiKey: process.env.OPENAI_API_KEY }),
  model: 'gpt-4o',
  maxRetries: 3,
  timeoutMs: 10_000,
  circuitBreaker: true,
});

const result = await llm.call({
  systemPrompt: 'Return JSON: { "skills": string[] }',
  userContent: 'Extract skills from: ...',
});

Works with OpenAI, Groq, Mistral, DeepSeek, Cerebras, Together AI, Fireworks AI, Ollama, Anthropic, Gemini, AWS Bedrock, or any provider reachable over HTTP via a fromFetch adapter.

Repository layout

This is a pnpm monorepo with two workspaces:

Path Description
packages/vern-llm The vern-llm npm package — source, tests, and its own README with the full API reference.
apps/docs The Fumadocs-powered documentation site.

Getting started

Requires Node 22.13+ and pnpm (this repo pins pnpm@11.15.0).

pnpm install

Common scripts, runnable from the repo root:

Command Description
pnpm build Build every workspace package (--if-present).
pnpm build:package Build just vern-llm.
pnpm build:docs Build just the docs site.
pnpm dev Run dev mode across every workspace package.
pnpm dev:package Watch-build vern-llm (tsdown --watch).
pnpm dev:docs Run the docs site locally (next dev).
pnpm typecheck Typecheck every workspace package.
pnpm test Run the vern-llm test suite (vitest run).
pnpm test:coverage Run tests with coverage (v8 provider).
pnpm lint / lint:fix Lint the whole repo with oxlint.
pnpm format / format:check Format the whole repo with oxfmt.
pnpm changeset Record a changeset for the next vern-llm release.

See packages/vern-llm/README.md for the complete API — installation, structured output, provider adapters, caching, circuit breaker, and more — and the docs site (or run pnpm dev:docs locally) for the full guided documentation.

Contributing

  1. Fork and clone the repo, then pnpm install at the root.
  2. Make your change inside packages/vern-llm (library code) or apps/docs (documentation).
  3. Add tests for library changes — see the Development section of the package README for how the test suite is organized.
  4. Run pnpm lint, pnpm typecheck, and pnpm test before opening a PR.
  5. If your change affects the published package, add a changeset: pnpm changeset.

License

MIT © LakBud

About

A lightweight resilience layer for OpenAI-compatible chat completions: retries, timeouts, caching, and circuit breaking, dependency-light and typed from the start.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Contributors