JSPM

  • Created
  • Published
  • Downloads 1432
  • Score
    100M100P100Q126453F
  • License ISC

A tiny client module for the openAI API

Package Exports

  • openai-api

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

Readme

openai-api

Overview

This package is a tiny node wrapper for the openAI API, if you find any issue please feel free to message me or open a PR :).

A few words from GPT-3

If you have any ideas on how to improve the library feel free to let me know as well!

You can also visit the Issue tracker for more information or open a new issue.

This project is not affiliated with OpenAI and was written purely out of interest.

Installation

npm i openai-api

Usage

(async () => {
    const gptResponse = await openai.complete({
        engine: 'davinci',
        prompt: 'this is a test',
        maxTokens: 5,
        temperature: 0.9,
        topP: 1,
        presencePenalty: 0,
        frequencyPenalty: 0,
        bestOf: 1,
        n: 1,
        stream: false,
        stop: ['\n', "testing"]
    });
            
    console.log(gptResponse.data);
})();
          
(async () => {
    const gptResponse = await openai.search({
        engine: 'davinci',
        documents: ["White House", "hospital", "school"],
        query: "the president"
    });
            
    console.log(gptResponse.data);
})();