JSPM

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

Call OpenAI's GPT APIs with structured responses

Package Exports

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

Readme

gpt-json

Template to kickstart creating a Node.js module using TypeScript and VSCode

Upcoming features

  • Streaming
  • Multi message support
  • Schema labeling

Getting started

Install

npm install gpt-json

Usage

import GPTJSON from 'gpt-json';
import { object, number } from 'yup';

const client = new GPTJSON({
  apiKey: 'YOUR_OPENAI_API_KEY',
});

const response = await client.executeRequest({
  model: 'gpt-4',
  request: 'Give me basic data about city Tallinn, Estonia',
  schema: object({
    population: number().required(),
    area: number().required(),
  }),
});

//=> 'hello from my package'