JSPM

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

typescript wrapper for gpt-3 api

Package Exports

  • gpts

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

Readme

gpts = gpt-3 + typescript

typescript wrapper for gpt-3 api


example

import { GpTs } from 'gpts';
const brain = new GpTs(OPENAI_APIKEY); // dont publish your api key!

const thoughts = brain.completion({
    engineId: 'ada',
    prompt: 'whats for lunch?',
});

console.log(thoughts.choices[0].text); // "maybe a banana?"

also see demo/index.ts (need to insert your api key to run)


install

npm

npm i gpts

github

package.json

    "dependencies": {
        "gpts": "thencc/gpts",
        ...
    },

features

  • engines
    • list ✅
    • retreive ✅
  • completions
    • create ✅
    • stream ⚠️ (TODO)
  • searches
    • create ✅
  • classifications
    • create ✅
  • answers
    • create ✅
  • files
    • list ✅
    • upload ✅
    • retrieve ✅
    • delete ✅

notes

  • uses OpenAI's REST api
  • backend: depends on node-fetch
  • frontend: works client-side too (but DO NOT share your api key in public client-side code)
  • for the /classifications and /answers endpoints openai seems to switch the syntax from engineId -> model so if you specify both in the options argument, options.model takes precedence

TODO