JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 17
  • Score
    100M100P100Q51078F
  • License MIT

Production-safe JSON repair and schema validation for LLM outputs

Package Exports

  • llm-json-guard
  • llm-json-guard/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (llm-json-guard) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

llm-json-guard

Production-safe JSON repair and schema validation for LLM outputs.

Installation

npm install llm-json-guard

Usage

import { LLMJsonGuard } from "llm-json-guard";

const guard = new LLMJsonGuard({ apiKey: process.env.RAPIDAPI_KEY });

const result = await guard.guard( "{name: 'Harsh', age: 21,}", { type: "object", properties: { name: { type: "string" }, age: { type: "number" } }, required: ["name", "age"] } );

console.log(result.data);

Requires a RapidAPI key. Get one here: https://rapidapi.com/...