Comparing version 1.1.3 to 2.0.0
@@ -1,2 +0,13 @@ | ||
export * from './lib.js'; | ||
export * from './types.js'; | ||
/** | ||
* OpenAI API | ||
* APIs for sampling from and fine-tuning language models | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
export * from "./api"; | ||
export * from "./configuration"; |
@@ -1,2 +0,27 @@ | ||
export * from './lib.js'; | ||
export * from './types.js'; | ||
"use strict"; | ||
/* tslint:disable */ | ||
/* eslint-disable */ | ||
/** | ||
* OpenAI API | ||
* APIs for sampling from and fine-tuning language models | ||
* | ||
* The version of the OpenAPI document: 1.0.0 | ||
* | ||
* | ||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). | ||
* https://openapi-generator.tech | ||
* Do not edit the class manually. | ||
*/ | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__exportStar(require("./api"), exports); | ||
__exportStar(require("./configuration"), exports); |
{ | ||
"name": "openai", | ||
"version": "1.1.3", | ||
"description": "Tiny OpenAI API wrapper", | ||
"type": "module", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"start": "tsc -d --watch", | ||
"build": "tsc -d", | ||
"clean": "rm -rf dist", | ||
"lint": "eslint . --fix --cache && prettier --write src", | ||
"lint:nofix": "eslint . && prettier --check src", | ||
"postinstall": "node ./postinstall.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/ceifa/openai.git" | ||
}, | ||
"author": "ceifa", | ||
"license": "MIT", | ||
"keywords": [ | ||
"gpt-3", | ||
"gpt", | ||
"ai", | ||
"openai" | ||
], | ||
"bugs": { | ||
"url": "https://github.com/ceifa/openai/issues" | ||
}, | ||
"homepage": "https://github.com/ceifa/openai#readme", | ||
"devDependencies": { | ||
"@types/node": "16.11.11", | ||
"@typescript-eslint/eslint-plugin": "5.5.0", | ||
"@typescript-eslint/parser": "5.5.0", | ||
"eslint": "8.3.0", | ||
"eslint-config-prettier": "8.3.0", | ||
"eslint-plugin-prettier": "4.0.0", | ||
"eslint-plugin-sort-imports-es6-autofix": "0.6.0", | ||
"prettier": "2.5.0", | ||
"typescript": "4.5.2" | ||
}, | ||
"dependencies": { | ||
"form-data": "4.0.0", | ||
"node-fetch": "3.1.0", | ||
"openai": "^1.1.2" | ||
} | ||
"name": "openai", | ||
"version": "2.0.0", | ||
"description": "Node.js library for the OpenAI API", | ||
"keywords": [ | ||
"openai", | ||
"open", | ||
"ai", | ||
"gpt-3", | ||
"gpt3" | ||
], | ||
"author": "OpenAI", | ||
"license": "MIT", | ||
"main": "./dist/index.js", | ||
"types": "./dist/index.d.ts", | ||
"scripts": { | ||
"build": "tsc --outDir dist/" | ||
}, | ||
"dependencies": { | ||
"axios": "^0.25.0", | ||
"form-data": "^4.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^12.11.5", | ||
"typescript": "^3.6.4" | ||
} | ||
} |
@@ -1,7 +0,56 @@ | ||
# OpenAI | ||
# OpenAI Node.js Library | ||
> tl;dr: Please consider using [GPT-X](https://www.npmjs.com/package/gpt-x) instead | ||
The OpenAI Node.js library provides convenient access to the OpenAI API from Node.js applications. Most of the code in this library is generated from our [OpenAPI specification](https://github.com/openai/openai-openapi). | ||
This package will be replaced soon by an official one from OpenAI. If you still want to use the unofficial version package, just switch to the new one called [GPT-X](https://www.npmjs.com/package/gpt-x), it will remain the same API for compatibility reasons. | ||
**Important note: this library is meant for server-side usage only, as using it in client-side browser code will expose your secret API key. [See here](https://beta.openai.com/docs/api-reference/authentication) for more details.** | ||
Enter in our community about Natural language generation to share and learn about OpenAI, prompt engineering and other providers: https://discord.gg/8ZwcSt9XkD | ||
## Installation | ||
```bash | ||
$ npm install openai | ||
``` | ||
## Usage | ||
The library needs to be configured with your account's secret key, which is available on the [website](https://beta.openai.com/account/api-keys). We recommend setting it as an environment variable. Here's an example of initializing the library with the API key loaded from an environment variable and creating a completion: | ||
```javascript | ||
const { Configuration, OpenAIApi } = require("openai"); | ||
const configuration = new Configuration({ | ||
apiKey: process.env.OPENAI_API_KEY, | ||
}); | ||
const openai = new OpenAIApi(configuration); | ||
const completion = await openai.createCompletion("davinci", { | ||
prompt: "Hello world", | ||
}); | ||
console.log(completion.data.choices[0].text); | ||
``` | ||
Check out the [full API documentation](https://beta.openai.com/docs/api-reference?lang=javascript) for examples of all the available functions. | ||
### Request options | ||
All of the available API request functions additionally contain an optional final parameter where you can pass custom [axios request options](https://axios-http.com/docs/req_config), for example: | ||
```javascript | ||
const completion = await openai.createCompletion( | ||
"davinci", | ||
{ | ||
prompt: "Once upon a time", | ||
max_tokens: 5, | ||
}, | ||
{ | ||
timeout: 1000, | ||
headers: { | ||
"Example-Header": "example", | ||
}, | ||
} | ||
); | ||
``` | ||
## Thanks | ||
Thank you to [ceifa](https://github.com/ceifa) for creating and maintaining the original unofficial `openai` npm package before we released this official library! |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
294145
2
2
22
5963
57
0
1
1
1
2
No
+ Addedaxios@^0.25.0
+ Addedaxios@0.25.0(transitive)
+ Addedfollow-redirects@1.15.9(transitive)
- Removednode-fetch@3.1.0
- Removedopenai@^1.1.2
- Removeddata-uri-to-buffer@4.0.1(transitive)
- Removedfetch-blob@3.2.0(transitive)
- Removedformdata-polyfill@4.0.10(transitive)
- Removednode-domexception@1.0.0(transitive)
- Removednode-fetch@3.1.0(transitive)
- Removedweb-streams-polyfill@3.3.3(transitive)
Updatedform-data@^4.0.0