JSPM

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

Unified TypeScript library to generate, validate, and structure AI model outputs

Package Exports

  • genpower
  • genpower/dist/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 (genpower) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Genpower

Generate reliable, typed outputs from LLMs with schema validation and retry logic.

Genpower is a lightweight TypeScript library that helps developers integrate GenAI models like OpenAI, Gemini, and others into apps — with structured JSON output, schema validation (using Zod), and automatic retries if the model output is invalid.

Perfect for apps where you need reliable AI responses, not just raw text.


Features

  • Plug-and-play support for OpenAI (ChatGPT), Gemini (Google)
  • Use Zod schemas to define and validate output structure
  • Auto-retry when output doesn't match the schema
  • Works in TypeScript/JavaScript apps (including React Native)
  • Easy to extend to other providers

Example

const WeatherSchema = z.object({
  location: z.string(),
  temperature: z.number(),
  condition: z.string(),
});

const generator = new PromptGenerator(
  new OpenAIEngine("your-api-key"),
  WeatherSchema,
  "What’s the current weather in {city}? Return JSON with location, temperature, condition."
);

const result = await generator.generate({ city: "Berlin" });

Install

npm install genpower

# or

yarn add genpower

Prerequisites

This package relies on Zod for schema validation and parsing.

Please install Zod in your project:

npm install zod

# or

yarn add zod

Documentation

Coming soon


License

MIT — free for personal and commercial use


Want to contribute or support?

If you're interested in collaborating, supporting further development, or sharing ideas, feel free to DM me on GitHub