Comparing version 2.0.0 to 2.0.1
{ | ||
"name": "openai", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "Node.js library for the OpenAI API", | ||
@@ -12,2 +12,6 @@ "keywords": [ | ||
], | ||
"repository": { | ||
"type": "git", | ||
"url": "git@github.com:openai/openai-node.git" | ||
}, | ||
"author": "OpenAI", | ||
@@ -14,0 +18,0 @@ "license": "MIT", |
@@ -31,3 +31,3 @@ # OpenAI Node.js Library | ||
Check out the [full API documentation](https://beta.openai.com/docs/api-reference?lang=javascript) for examples of all the available functions. | ||
Check out the [full API documentation](https://beta.openai.com/docs/api-reference?lang=node.js) for examples of all the available functions. | ||
@@ -55,4 +55,24 @@ ### Request options | ||
### Error handling | ||
API requests can potentially return errors due to invalid inputs or other issues. These errors can be handled with a `try...catch` statement, and the error details can be found in either `error.response` or `error.message`: | ||
```javascript | ||
try { | ||
const completion = await openai.createCompletion("davinci", { | ||
prompt: "Hello world", | ||
}); | ||
console.log(completion.data.choices[0].text); | ||
} catch (error) { | ||
if (error.response) { | ||
console.log(error.response.status); | ||
console.log(error.response.data); | ||
} else { | ||
console.log(error.message); | ||
} | ||
} | ||
``` | ||
## 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! | ||
Thank you to [ceifa](https://github.com/ceifa) for creating and maintaining the original unofficial `openai` npm package before we released this official library! ceifa's original package has been renamed to [gpt-x](https://www.npmjs.com/package/gpt-x). |
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
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 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
294910
77
0
0