Skip to content

About

Example project testing ai-armor from npm

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

ai-armor-example

Example project testing ai-armor v0.1.7 from npm.

Setup

pnpm install

Run Tests

# Test all core features (rate limit, budget, cache, routing, fallback, pricing, logging)
pnpm test:core

# Test safety guards (prompt injection, PII, blocked patterns, max tokens)
pnpm test:safety

# Run all
pnpm test:all

What's Tested

Core Features (60 tests)

  • createArmor — all 15 methods exist
  • Rate limiting — sliding window, per-user isolation, peek
  • Budget tracking — daily/monthly cost, block/downgrade actions
  • Model routing — aliases, passthrough
  • Exact cache — miss/hit/set
  • Cost estimation — cross-provider comparison
  • Pricing API — 69 models, provider detection
  • Logging — structured logs with max entries
  • Fallback chains — primary failure, automatic fallback
  • Minimal config — empty config works

Safety Guards (16 tests)

  • Prompt injection detection (ignore instructions)
  • PII detection (SSN, credit card)
  • Custom blocked patterns (regex)
  • Max token enforcement
  • onBlocked callback
  • Combined safety rules

Results

All 76 tests pass with ai-armor@0.1.7 from npm.

About

Example project testing ai-armor from npm

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages