New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

gpts

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gpts

typescript wrapper for gpt-3 api

latest
Source
npmnpm
Version
1.0.8
Version published
Weekly downloads
25
-32.43%
Maintainers
1
Weekly downloads
 
Created
Source

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 ✅ (server-side only)
    • retrieve ✅
    • delete ✅
  • embeddings
    • create ✅
  • fine-tunes
    • prepare dataset ⚠️ (TODO)
    • upload dataset ⚠️ (TODO)
    • check upload results ⚠️ (TODO)

notes

general

  • uses openai's REST api
  • 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

client-side use

  • this library works client + server side using axios for http requests
  • DO NOT share your api key in public client-side frontend code
  • one way to hide your openai api key for client-side use is by hosting an api wrapper endpoint that enforces your own authentication, then updating the origin this library looks to use like the below.

api wrapper example:

import { GpTs } from 'gpts';
/*
    gives your api wrapper authorization like this:
        headers: {
            'Authorization': 'Bearer ASuperSecretPassword'
        }

    the constructor takes 2 arguments
        1. the authorization bearer value
        2. the api origin
*/
const brain = new GpTs('ASuperSecretPassword', 'https://company.api-wrappers.io/gpt3');

TODO

Keywords

gpt

FAQs

Package last updated on 02 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts