Skip to content

A TypeScript wrapper for the GPT-3 API, enables developers to interact with the GPT-3 API usefully and easily.

Notifications You must be signed in to change notification settings

UXTQ/gpts-wrapper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gpts-wrapper = gpt-3 + typescript\n\nA TypeScript wrapper for the GPT-3 API that enables developers to effectively interact with the GPT-3 API.\n\n---\n\n## example\n\nts\nimport { GpTs } from 'gpts-wrapper';\nconst brain = new GpTs(OPENAI_APIKEY); // dont publish your api key!\n\nconst thoughts = brain.completion({\n\tengineId: 'ada',\n\tprompt: 'whats for lunch?',\n});\n\nconsole.log(thoughts.choices[0].text); // "maybe a banana?"\n\n\nalso see demo/index.ts (need to insert your api key to run)\n\n---\n\n## install\n\n### npm\n\nnpm i gpts-wrapper\n\n### github\n\npackage.json\n\njson\n\t"dependencies": {\n\t\t"gpts-wrapper": "UXTQ/gpts-wrapper",\n\t\t...\n\t},\n\n\n---\n\n## features\n\n- engines\n - list ✅\n - retreive ✅\n- completions\n - create ✅\n - stream ⚠️ (TODO)\n- searches\n - create ✅\n- classifications\n - create ✅\n- answers\n - create ✅\n- files\n - list ✅\n - upload ✅ (server-side only)\n - retrieve ✅\n - delete ✅\n- embeddings\n - create ✅\n- fine-tunes\n - prepare dataset ⚠️ (TODO)\n - upload dataset ⚠️ (TODO)\n - check upload results ⚠️ (TODO)\n\n---\n\n## notes\n\n### general\n\n- uses openai's REST api\n- 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\n\n### client-side use\n\n- this library works client + server side using axios for http requests\n- DO NOT share your api key in public client-side frontend code\n- 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.\n\napi wrapper example:\n\nts\nimport { GpTs } from 'gpts-wrapper';\n/*\n gives your api wrapper authorization like this:\n headers: {\n 'Authorization': 'Bearer ASuperSecretPassword'\n }\n\n the constructor takes 2 arguments\n 1. the authorization bearer value\n 2. the api origin\n*/\nconst brain = new GpTs('ASuperSecretPassword', 'https://company.api-wrappers.io/gpt3');\n\n\n---\n\n## TODO\n\n- support completion streaming SSE (https://beta.openai.com/docs/api-reference/completions/create-via-get)\n- support fine-tuning management (https://beta.openai.com/docs/guides/fine-tuning/preparing-your-dataset)

About

A TypeScript wrapper for the GPT-3 API, enables developers to interact with the GPT-3 API usefully and easily.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published